If stopping an instance failed, the configuration would already be gone
and other operations depending on it (e.g. migration) would no longer
work. With this patch the configuration file is only removed once the
instance was succesfully stopped or destroyed.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
"""
if name is None:
name = instance.name
- self._RemoveConfigFile(name)
+
if force:
command = [constants.XEN_CMD, "destroy", name]
else:
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.