vm/qubesvm: handle libvirt reporting domain already dead when killing
If domain die when trying to kill it, qubesd may loose a race and try to kill it anyway. Handle libvirt exception in that case and conver it to QubesVMNotStartedError - as it would be if qubesd would win the race. Fixes QubesOS/qubes-issues#3755
This commit is contained in:
parent
1e9bf18bcf
commit
f4be284331
@ -1024,7 +1024,13 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
if not self.is_running() and not self.is_paused():
|
||||
raise qubes.exc.QubesVMNotStartedError(self)
|
||||
|
||||
try:
|
||||
self.libvirt_domain.destroy()
|
||||
except libvirt.libvirtError as e:
|
||||
if e.get_error_code() == libvirt.VIR_ERR_OPERATION_INVALID:
|
||||
raise qubes.exc.QubesVMNotStartedError(self)
|
||||
else:
|
||||
raise
|
||||
|
||||
return self
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user