dom0: start guid as soon as possible (#377)
This commit is contained in:
parent
566f5c02e0
commit
99ffed089c
@ -1049,6 +1049,26 @@ class QubesVm(object):
|
|||||||
raise QubesException ("Network attach timed out!")
|
raise QubesException ("Network attach timed out!")
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
|
def start_guid(self, verbose = True, notify_function = None):
|
||||||
|
if verbose:
|
||||||
|
print >> sys.stderr, "--> Starting Qubes GUId..."
|
||||||
|
xid = self.get_xid()
|
||||||
|
|
||||||
|
retcode = subprocess.call ([qubes_guid_path, "-d", str(xid), "-c", self.label.color, "-i", self.label.icon, "-l", str(self.label.index)])
|
||||||
|
if (retcode != 0) :
|
||||||
|
raise QubesException("Cannot start qubes_guid!")
|
||||||
|
|
||||||
|
if verbose:
|
||||||
|
print >> sys.stderr, "--> Waiting for qubes-session..."
|
||||||
|
|
||||||
|
subprocess.call([qrexec_client_path, "-d", str(xid), "user:echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && exec sleep 365d"])
|
||||||
|
|
||||||
|
retcode = subprocess.call([qubes_clipd_path])
|
||||||
|
if retcode != 0:
|
||||||
|
print >> sys.stderr, "ERROR: Cannot start qclipd!"
|
||||||
|
if notify_function is not None:
|
||||||
|
notify_function("error", "ERROR: Cannot start the Qubes Clipboard Notifier!")
|
||||||
|
|
||||||
def start(self, debug_console = False, verbose = False, preparing_dvm = False):
|
def start(self, debug_console = False, verbose = False, preparing_dvm = False):
|
||||||
if dry_run:
|
if dry_run:
|
||||||
return
|
return
|
||||||
@ -1125,6 +1145,8 @@ class QubesVm(object):
|
|||||||
self.force_shutdown()
|
self.force_shutdown()
|
||||||
raise OSError ("ERROR: Cannot execute qrexec_daemon!")
|
raise OSError ("ERROR: Cannot execute qrexec_daemon!")
|
||||||
|
|
||||||
|
self.start_guid(verbose=verbose)
|
||||||
|
|
||||||
if preparing_dvm:
|
if preparing_dvm:
|
||||||
if verbose:
|
if verbose:
|
||||||
print >> sys.stderr, "--> Preparing config template for DispVM"
|
print >> sys.stderr, "--> Preparing config template for DispVM"
|
||||||
|
@ -229,26 +229,6 @@ def block_detach(vm, frontend = "xvdi", vm_xid = None):
|
|||||||
xl_cmd = [ '/usr/sbin/xl', 'block-detach', str(vm_xid), str(frontend)]
|
xl_cmd = [ '/usr/sbin/xl', 'block-detach', str(vm_xid), str(frontend)]
|
||||||
subprocess.check_call(xl_cmd)
|
subprocess.check_call(xl_cmd)
|
||||||
|
|
||||||
def start_guid(vm, verbose = True, notify_function = None):
|
|
||||||
if verbose:
|
|
||||||
print >> sys.stderr, "--> Starting Qubes GUId..."
|
|
||||||
xid = vm.get_xid()
|
|
||||||
|
|
||||||
retcode = subprocess.call ([qubes_guid_path, "-d", str(xid), "-c", vm.label.color, "-i", vm.label.icon, "-l", str(vm.label.index)])
|
|
||||||
if (retcode != 0) :
|
|
||||||
raise QubesException("Cannot start qubes_guid!")
|
|
||||||
|
|
||||||
if verbose:
|
|
||||||
print >> sys.stderr, "--> Waiting for qubes-session..."
|
|
||||||
|
|
||||||
subprocess.call([qrexec_client_path, "-d", str(xid), "user:echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && exec sleep 365d"])
|
|
||||||
|
|
||||||
retcode = subprocess.call([qubes_clipd_path])
|
|
||||||
if retcode != 0:
|
|
||||||
print >> sys.stderr, "ERROR: Cannot start qclipd!"
|
|
||||||
if notify_function is not None:
|
|
||||||
notify_function("error", "ERROR: Cannot start the Qubes Clipboard Notifier!")
|
|
||||||
|
|
||||||
def run_in_vm(vm, command, verbose = True, autostart = False, notify_function = None, passio = False, localcmd = None):
|
def run_in_vm(vm, command, verbose = True, autostart = False, notify_function = None, passio = False, localcmd = None):
|
||||||
assert vm is not None
|
assert vm is not None
|
||||||
|
|
||||||
@ -270,7 +250,7 @@ def run_in_vm(vm, command, verbose = True, autostart = False, notify_function =
|
|||||||
|
|
||||||
xid = vm.get_xid()
|
xid = vm.get_xid()
|
||||||
if os.getenv("DISPLAY") is not None and not os.path.isfile("/var/run/qubes/guid_running.{0}".format(xid)):
|
if os.getenv("DISPLAY") is not None and not os.path.isfile("/var/run/qubes/guid_running.{0}".format(xid)):
|
||||||
start_guid(vm, verbose = verbose, notify_function = notify_function)
|
vm.start_guid(verbose = verbose, notify_function = notify_function)
|
||||||
|
|
||||||
args = [qrexec_client_path, "-d", str(xid), command]
|
args = [qrexec_client_path, "-d", str(xid), command]
|
||||||
if localcmd is not None:
|
if localcmd is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user