Skip to content

Commit

Permalink
core: detach PCI devices before shutting down VM
Browse files Browse the repository at this point in the history
When VM is shutting down it doesn't disconnect PCI frontend (?), so when
VM is destroyed it ends up in timeouts in PCI backend shutdown (which
can't communicate with frontend at that stage). Prevent this by
detaching PCI devices while VM is still running.

Fixes QubesOS/qubes-issues#1494
Fixes QubesOS/qubes-issues#1425
  • Loading branch information
marmarek committed Dec 6, 2015
1 parent 9f04743 commit 2658c9a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core-modules/000QubesVm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,14 @@ def shutdown(self, force=False, xid = None):
if not self.is_running():
raise QubesException ("VM already stopped!")

# try to gracefully detach PCI devices before shutdown, to mitigate
# timeouts on forcible detach at domain destroy; if that fails, too bad
try:
for pcidev in self.pcidevs:
self.libvirt_domain.detachDevice(self._format_pci_dev(pcidev))
except libvirt.libvirtError:
pass

self.libvirt_domain.shutdown()

def force_shutdown(self, xid = None):
Expand Down

0 comments on commit 2658c9a

Please sign in to comment.