qubes/vm/qubesvm: move is_guid_running to GUI extension
This commit is contained in:
parent
341bbb4ef3
commit
fe8fdb264b
@ -202,3 +202,25 @@ class GUI(qubes.ext.Extension):
|
|||||||
pipe.stdin.write(''.join(monitor_layout))
|
pipe.stdin.write(''.join(monitor_layout))
|
||||||
pipe.stdin.close()
|
pipe.stdin.close()
|
||||||
pipe.wait()
|
pipe.wait()
|
||||||
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def is_guid_running(vm):
|
||||||
|
'''Check whether gui daemon for this domain is available.
|
||||||
|
|
||||||
|
:returns: :py:obj:`True` if guid is running, \
|
||||||
|
:py:obj:`False` otherwise.
|
||||||
|
:rtype: bool
|
||||||
|
'''
|
||||||
|
xid = self.xid
|
||||||
|
if xid < 0:
|
||||||
|
return False
|
||||||
|
if not os.path.exists('/var/run/qubes/guid-running.{}'.format(xid)):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@qubes.ext.handler('domain-is-fully-usable')
|
||||||
|
def on_domain_is_fully_usable(self, vm, event):
|
||||||
|
if not self.is_guid_running(vm):
|
||||||
|
yield False
|
||||||
|
@ -1312,21 +1312,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
and self.libvirt_domain.state() == libvirt.VIR_DOMAIN_PAUSED
|
and self.libvirt_domain.state() == libvirt.VIR_DOMAIN_PAUSED
|
||||||
|
|
||||||
|
|
||||||
def is_guid_running(self):
|
|
||||||
'''Check whether gui daemon for this domain is available.
|
|
||||||
|
|
||||||
:returns: :py:obj:`True` if guid is running, \
|
|
||||||
:py:obj:`False` otherwise.
|
|
||||||
:rtype: bool
|
|
||||||
'''
|
|
||||||
xid = self.xid
|
|
||||||
if xid < 0:
|
|
||||||
return False
|
|
||||||
if not os.path.exists('/var/run/qubes/guid-running.%d' % xid):
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def is_qrexec_running(self):
|
def is_qrexec_running(self):
|
||||||
'''Check whether qrexec for this domain is available.
|
'''Check whether qrexec for this domain is available.
|
||||||
|
|
||||||
@ -1340,21 +1325,19 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
|
|
||||||
|
|
||||||
def is_fully_usable(self):
|
def is_fully_usable(self):
|
||||||
|
return all(self.fire_event('domain-is-fully-usable'))
|
||||||
|
|
||||||
|
|
||||||
|
@qubes.events.handler('domain-is-fully-usable')
|
||||||
|
def on_domain_is_fully_usable(self, event):
|
||||||
'''Check whether domain is running and sane.
|
'''Check whether domain is running and sane.
|
||||||
|
|
||||||
Currently this checks for running guid and qrexec.
|
Currently this checks for running qrexec.
|
||||||
|
|
||||||
:returns: :py:obj:`True` if qrexec is running, \
|
|
||||||
:py:obj:`False` otherwise.
|
|
||||||
:rtype: bool
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# Running gui-daemon implies also VM running
|
# Running gui-daemon implies also VM running
|
||||||
if not self.is_guid_running():
|
|
||||||
return False
|
|
||||||
if not self.is_qrexec_running():
|
if not self.is_qrexec_running():
|
||||||
return False
|
yield False
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
# memory and disk
|
# memory and disk
|
||||||
|
Loading…
Reference in New Issue
Block a user