vm: restore code for suspending domains with PCI devices
This commit is contained in:
parent
4c4f903fe3
commit
f80fddf7ae
@ -977,17 +977,15 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
|
|
||||||
:raises qubes.exc.QubesVMNotRunnignError: \
|
:raises qubes.exc.QubesVMNotRunnignError: \
|
||||||
when domain is already shut down.
|
when domain is already shut down.
|
||||||
:raises qubes.exc.QubesNotImplemetedError: \
|
|
||||||
when domain has PCI devices attached.
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if not self.is_running() and not self.is_paused():
|
if not self.is_running() and not self.is_paused():
|
||||||
raise qubes.exc.QubesVMNotRunningError(self)
|
raise qubes.exc.QubesVMNotRunningError(self)
|
||||||
|
|
||||||
if list(self.devices['pci'].attached()):
|
if list(self.devices['pci'].attached()):
|
||||||
raise qubes.exc.QubesNotImplementedError(
|
yield from self.run_service_for_stdio('qubes.SuspendPre')
|
||||||
'Cannot suspend domain {!r} which has PCI devices attached'
|
self.libvirt_domain.pMSuspendForDuration(
|
||||||
.format(self.name))
|
libvirt.VIR_NODE_SUSPEND_TARGET_MEM, 0, 0)
|
||||||
else:
|
else:
|
||||||
self.libvirt_domain.suspend()
|
self.libvirt_domain.suspend()
|
||||||
|
|
||||||
@ -995,13 +993,12 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def pause(self):
|
def pause(self):
|
||||||
'''Pause (suspend) domain. This currently delegates to \
|
'''Pause (suspend) domain.'''
|
||||||
:py:meth:`suspend`.'''
|
|
||||||
|
|
||||||
if not self.is_running():
|
if not self.is_running():
|
||||||
raise qubes.exc.QubesVMNotRunningError(self)
|
raise qubes.exc.QubesVMNotRunningError(self)
|
||||||
|
|
||||||
self.suspend()
|
self.libvirt_domain.suspend()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@ -1013,11 +1010,12 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
:raises qubes.exc.QubesVMError: when machine is suspended
|
:raises qubes.exc.QubesVMError: when machine is suspended
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
# pylint: disable=not-an-iterable
|
||||||
if self.get_power_state() == "Suspended":
|
if self.get_power_state() == "Suspended":
|
||||||
raise qubes.exc.QubesVMError(self,
|
self.libvirt_domain.pMWakeup()
|
||||||
'Cannot resume suspended domain {!r}'.format(self.name))
|
yield from self.run_service_for_stdio('qubes.SuspendPost')
|
||||||
else:
|
else:
|
||||||
self.unpause()
|
yield from self.unpause()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@ -1397,7 +1395,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
``'Transient'`` Machine is running, but does not have :program:`guid`
|
``'Transient'`` Machine is running, but does not have :program:`guid`
|
||||||
or :program:`qrexec` available.
|
or :program:`qrexec` available.
|
||||||
``'Running'`` Machine is ready and running.
|
``'Running'`` Machine is ready and running.
|
||||||
``'Paused'`` Machine is paused (currently not available, see below).
|
``'Paused'`` Machine is paused.
|
||||||
``'Suspended'`` Machine is S3-suspended.
|
``'Suspended'`` Machine is S3-suspended.
|
||||||
``'Halting'`` Machine is in process of shutting down.
|
``'Halting'`` Machine is in process of shutting down.
|
||||||
``'Dying'`` Machine crashed and is unusable.
|
``'Dying'`` Machine crashed and is unusable.
|
||||||
@ -1407,9 +1405,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
is undefined).
|
is undefined).
|
||||||
=============== ========================================================
|
=============== ========================================================
|
||||||
|
|
||||||
``Paused`` state is currently unavailable because of missing code in
|
|
||||||
libvirt/xen glue.
|
|
||||||
|
|
||||||
FIXME: graph below may be incomplete and wrong. Click on method name to
|
FIXME: graph below may be incomplete and wrong. Click on method name to
|
||||||
see its documentation.
|
see its documentation.
|
||||||
|
|
||||||
@ -1459,13 +1454,13 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
[label="pause()" URL="#qubes.vm.qubesvm.QubesVM.pause"
|
[label="pause()" URL="#qubes.vm.qubesvm.QubesVM.pause"
|
||||||
color=gray75 fontcolor=gray75];
|
color=gray75 fontcolor=gray75];
|
||||||
Running -> Suspended
|
Running -> Suspended
|
||||||
[label="pause()" URL="#qubes.vm.qubesvm.QubesVM.pause"
|
[label="suspend()" URL="#qubes.vm.qubesvm.QubesVM.suspend"
|
||||||
color=gray50 fontcolor=gray50];
|
color=gray50 fontcolor=gray50];
|
||||||
Paused -> Running
|
Paused -> Running
|
||||||
[label="unpause()" URL="#qubes.vm.qubesvm.QubesVM.unpause"
|
[label="unpause()" URL="#qubes.vm.qubesvm.QubesVM.unpause"
|
||||||
color=gray75 fontcolor=gray75];
|
color=gray75 fontcolor=gray75];
|
||||||
Suspended -> Running
|
Suspended -> Running
|
||||||
[label="unpause()" URL="#qubes.vm.qubesvm.QubesVM.unpause"
|
[label="resume()" URL="#qubes.vm.qubesvm.QubesVM.resume"
|
||||||
color=gray50 fontcolor=gray50];
|
color=gray50 fontcolor=gray50];
|
||||||
|
|
||||||
Running -> Suspended
|
Running -> Suspended
|
||||||
|
Loading…
Reference in New Issue
Block a user