Commit 8904b35c authored by Guido Trotter's avatar Guido Trotter
Browse files

KVM: move post-shutdown cleanup operations

Currently putting the cleanup just after the actual shutdown ensures
that it never gets called, due to how the retry/shutdown cycle works.
So we move those cleanups to their new dedicated place.
Signed-off-by: default avatarGuido Trotter <>
Reviewed-by: default avatarIustin Pop <>
parent 9d91c6ab
......@@ -631,18 +631,21 @@ class KVMHypervisor(hv_base.BaseHypervisor):
acpi = instance.hvparams[constants.HV_ACPI]
acpi = False
pidfile, pid, alive = self._InstancePidAlive(name)
_, pid, alive = self._InstancePidAlive(name)
if pid > 0 and alive:
if force or not acpi:
self._CallMonitorCommand(name, 'system_powerdown')
if not self._InstancePidAlive(name)[2]:
self._RemoveInstanceRuntimeFiles(pidfile, name)
return True
return False
def CleanupInstance(self, instance_name):
"""Cleanup after a stopped instance
pidfile, pid, alive = self._InstancePidAlive(instance_name)
if pid > 0 and alive:
raise errors.HypervisorError("Cannot cleanup a live instance")
self._RemoveInstanceRuntimeFiles(pidfile, instance_name)
def RebootInstance(self, instance):
"""Reboot an instance.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment