diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py index 7b07e98f8945d341bc2b9cee8e388778a77f0d29..583cc52b0866b4ba6b7b1d6d260a7a48a7679110 100644 --- a/lib/hypervisor/hv_xen.py +++ b/lib/hypervisor/hv_xen.py @@ -462,7 +462,7 @@ class XenHypervisor(hv_base.BaseHypervisor): """ if name is None: name = instance.name - self._RemoveConfigFile(name) + if force: command = [constants.XEN_CMD, "destroy", name] else: @@ -473,6 +473,9 @@ class XenHypervisor(hv_base.BaseHypervisor): raise errors.HypervisorError("Failed to stop instance %s: %s, %s" % (name, result.fail_reason, result.output)) + # Remove configuration file if stopping/starting instance was successful + self._RemoveConfigFile(name) + def RebootInstance(self, instance): """Reboot an instance.