qvm-tools/qvm-shutdown: handle domains with xl daemon killed (#903)

When system is going down, systemd kills all the users processes,
including 'xl' daemons waiting for domain shutdown. This results in
zombie domains not cleaned up. The proper fix would be somehow extract
those processes from user session scope (most likely by starting them as
a service).

But because it applies only to system shutdown (qvm-shutdown
call there), it is simpler to add appropriate handling code to
qvm-shutdown.

In R3 the problem will vanish, because of use libvirtd deamon, so no
user processes required to track domains state.
This commit is contained in:
Marek Marczykowski-Górecki 2014-09-24 14:16:13 +02:00
parent fc7d686b2e
commit 68460fb272

View File

@ -93,6 +93,7 @@ def main():
print >> sys.stderr, "Waiting for the VM(s) to shutdown..."
shutdown_counter = 0
halting_vms = []
while len (vms_list):
if options.verbose:
print >> sys.stderr, "Waiting for VMs: ", [vm.name for vm in vms_list]
@ -100,6 +101,12 @@ def main():
if not vm.is_running():
vms_list.remove (vm)
continue
if vm.get_power_state() == "Halting":
if vm in halting_vms:
vm.force_shutdown()
continue
else:
halting_vms.append(vm)
if shutdown_counter > defaults["shutdown_counter_max"]:
# kill the VM
if options.verbose: