diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py index 623f1bd0c47a87e75892c44d3fc3e868b48163d5..626994f32ab849b91b8fd130819819a76c06fc9f 100644 --- a/lib/hypervisor/hv_xen.py +++ b/lib/hypervisor/hv_xen.py @@ -272,7 +272,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: @@ -283,6 +283,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.