core: call ACPI S3 emulation only for VMs with PCI devices

Actually it looks to be needed only there.
But also another problem: this suspend doesn't work for firewallvm, for
unknown reason.
This commit is contained in:
Marek Marczykowski-Górecki 2013-10-24 04:10:07 +02:00
parent 149971ae2e
commit dfe0b18382

View File

@ -1542,17 +1542,20 @@ class QubesVm(object):
if not self.is_running() and not self.is_paused(): if not self.is_running() and not self.is_paused():
raise QubesException ("VM already stopped!") raise QubesException ("VM already stopped!")
xs_path = '/local/domain/%d/control/shutdown' % self.get_xid() if len (self.pcidevs) > 0:
xs.write('', xs_path, 'suspend') xs_path = '/local/domain/%d/control/shutdown' % self.get_xid()
tries = 0 xs.write('', xs_path, 'suspend')
while self.get_power_state() != "Suspended": tries = 0
tries += 1 while self.get_power_state() != "Suspended":
if tries > 15: tries += 1
# fallback to pause if tries > 15:
print >>sys.stderr, "Failed to suspend domain %s, falling back to pause method" % self.name # fallback to pause
self.pause() print >>sys.stderr, "Failed to suspend domain %s, falling back to pause method" % self.name
break self.pause()
time.sleep(0.2) break
time.sleep(0.2)
else:
self.pause()
def resume(self): def resume(self):
if dry_run: if dry_run: