dom0: start guid as soon as possible (#377)

This commit is contained in:
Marek Marczykowski 2011-12-05 13:36:13 +01:00
parent 566f5c02e0
commit 99ffed089c
2 changed files with 23 additions and 21 deletions

View File

@ -1049,6 +1049,26 @@ class QubesVm(object):
raise QubesException ("Network attach timed out!")
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):
if dry_run:
return
@ -1125,6 +1145,8 @@ class QubesVm(object):
self.force_shutdown()
raise OSError ("ERROR: Cannot execute qrexec_daemon!")
self.start_guid(verbose=verbose)
if preparing_dvm:
if verbose:
print >> sys.stderr, "--> Preparing config template for DispVM"

View File

@ -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)]
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):
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()
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]
if localcmd is not None: