dom0/core: support for qrexec for Windows HVM
Because not every HVM will have qrexec agent installed, introduce VM property 'qrexec_installed'. If it is set, spawn qrexec_daemon at VM startup and allow use of qvm-run.
This commit is contained in:
parent
5504142187
commit
e6a75c732e
@ -268,6 +268,7 @@ class QubesVm(object):
|
|||||||
"kernels_dir": { 'eval': 'qubes_kernels_base_dir + "/" + self.kernel if self.kernel is not None else ' + \
|
"kernels_dir": { 'eval': 'qubes_kernels_base_dir + "/" + self.kernel if self.kernel is not None else ' + \
|
||||||
# for backward compatibility (or another rare case): kernel=None -> kernel in VM dir
|
# for backward compatibility (or another rare case): kernel=None -> kernel in VM dir
|
||||||
'self.dir_path + "/" + default_kernels_subdir' },
|
'self.dir_path + "/" + default_kernels_subdir' },
|
||||||
|
"_start_guid_first": { 'eval': 'False' },
|
||||||
}
|
}
|
||||||
|
|
||||||
### Mark attrs for XML inclusion
|
### Mark attrs for XML inclusion
|
||||||
@ -1479,10 +1480,13 @@ class QubesVm(object):
|
|||||||
# the successful unpause is some indicator of it
|
# the successful unpause is some indicator of it
|
||||||
qmemman_client.close()
|
qmemman_client.close()
|
||||||
|
|
||||||
|
if self._start_guid_first and start_guid and not preparing_dvm and os.path.exists('/var/run/shm.id'):
|
||||||
|
self.start_guid(verbose=verbose)
|
||||||
|
|
||||||
if not preparing_dvm:
|
if not preparing_dvm:
|
||||||
self.start_qrexec_daemon(verbose=verbose)
|
self.start_qrexec_daemon(verbose=verbose)
|
||||||
|
|
||||||
if start_guid and not preparing_dvm and os.path.exists('/var/run/shm.id'):
|
if not self._start_guid_first and start_guid and not preparing_dvm and os.path.exists('/var/run/shm.id'):
|
||||||
self.start_guid(verbose=verbose)
|
self.start_guid(verbose=verbose)
|
||||||
|
|
||||||
if preparing_dvm:
|
if preparing_dvm:
|
||||||
@ -2227,6 +2231,8 @@ class QubesHVm(QubesVm):
|
|||||||
attrs['drive'] = { 'save': 'str(self.drive)' }
|
attrs['drive'] = { 'save': 'str(self.drive)' }
|
||||||
attrs['maxmem'].pop('save')
|
attrs['maxmem'].pop('save')
|
||||||
attrs['timezone'] = { 'default': 'localtime', 'save': 'str(self.timezone)' }
|
attrs['timezone'] = { 'default': 'localtime', 'save': 'str(self.timezone)' }
|
||||||
|
attrs['qrexec_installed'] = { 'default': False, 'save': 'str(self.qrexec_installed)' }
|
||||||
|
attrs['_start_guid_first']['eval'] = 'True'
|
||||||
|
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
@ -2397,7 +2403,10 @@ class QubesHVm(QubesVm):
|
|||||||
return "vif{0}.+".format(self.stubdom_xid)
|
return "vif{0}.+".format(self.stubdom_xid)
|
||||||
|
|
||||||
def run(self, command, **kwargs):
|
def run(self, command, **kwargs):
|
||||||
raise NotImplementedError("Needs qrexec agent - TODO")
|
if self.qrexec_installed:
|
||||||
|
super(QubesHVm, self).run(command, **kwargs)
|
||||||
|
else:
|
||||||
|
raise QubesException("Needs qrexec agent installed in VM to use this function. See also qvm-prefs.")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stubdom_xid(self):
|
def stubdom_xid(self):
|
||||||
@ -2419,7 +2428,8 @@ class QubesHVm(QubesVm):
|
|||||||
raise QubesException("Cannot start qubes_guid!")
|
raise QubesException("Cannot start qubes_guid!")
|
||||||
|
|
||||||
def start_qrexec_daemon(self, **kwargs):
|
def start_qrexec_daemon(self, **kwargs):
|
||||||
pass
|
if self.qrexec_installed:
|
||||||
|
super(QubesHVm, self).start_qrexec_daemon(**kwargs)
|
||||||
|
|
||||||
def pause(self):
|
def pause(self):
|
||||||
if dry_run:
|
if dry_run:
|
||||||
@ -2805,7 +2815,7 @@ class QubesVmCollection(dict):
|
|||||||
"installed_by_rpm", "internal",
|
"installed_by_rpm", "internal",
|
||||||
"uses_default_netvm", "label", "memory", "vcpus", "pcidevs",
|
"uses_default_netvm", "label", "memory", "vcpus", "pcidevs",
|
||||||
"maxmem", "kernel", "uses_default_kernel", "kernelopts", "uses_default_kernelopts",
|
"maxmem", "kernel", "uses_default_kernel", "kernelopts", "uses_default_kernelopts",
|
||||||
"mac", "services", "include_in_backups", "debug", "drive" )
|
"mac", "services", "include_in_backups", "debug", "qrexec_installed", "drive" )
|
||||||
|
|
||||||
for attribute in common_attr_list:
|
for attribute in common_attr_list:
|
||||||
kwargs[attribute] = element.get(attribute)
|
kwargs[attribute] = element.get(attribute)
|
||||||
@ -2867,6 +2877,9 @@ class QubesVmCollection(dict):
|
|||||||
if "debug" in kwargs:
|
if "debug" in kwargs:
|
||||||
kwargs["debug"] = True if kwargs["debug"] == "True" else False
|
kwargs["debug"] = True if kwargs["debug"] == "True" else False
|
||||||
|
|
||||||
|
if "qrexec_installed" in kwargs:
|
||||||
|
kwargs["qrexec_installed"] = True if kwargs["qrexec_installed"] == "True" else False
|
||||||
|
|
||||||
if "drive" in kwargs and kwargs["drive"] == "None":
|
if "drive" in kwargs and kwargs["drive"] == "None":
|
||||||
kwargs["drive"] = None
|
kwargs["drive"] = None
|
||||||
|
|
||||||
|
@ -78,6 +78,9 @@ def do_list(vm):
|
|||||||
if hasattr(vm, 'debug'):
|
if hasattr(vm, 'debug'):
|
||||||
print fmt.format("debug", "on" if vm.debug else "off")
|
print fmt.format("debug", "on" if vm.debug else "off")
|
||||||
|
|
||||||
|
if hasattr(vm, 'qrexec_installed'):
|
||||||
|
print fmt.format("qrexec_installed", str(vm.qrexec_installed))
|
||||||
|
|
||||||
if hasattr(vm, 'drive'):
|
if hasattr(vm, 'drive'):
|
||||||
print fmt.format("drive", str(vm.drive))
|
print fmt.format("drive", str(vm.drive))
|
||||||
|
|
||||||
@ -311,6 +314,14 @@ def set_debug(vms, vm, args):
|
|||||||
vm.debug = bool(eval(args[0].capitalize()))
|
vm.debug = bool(eval(args[0].capitalize()))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def set_qrexec_installed(vms, vm, args):
|
||||||
|
if len (args) != 1:
|
||||||
|
print >> sys.stderr, "Missing value (True/False)!"
|
||||||
|
return False
|
||||||
|
|
||||||
|
vm.qrexec_installed = bool(eval(args[0].capitalize()))
|
||||||
|
return True
|
||||||
|
|
||||||
def set_timezone(vms, vm, args):
|
def set_timezone(vms, vm, args):
|
||||||
if len (args) != 1:
|
if len (args) != 1:
|
||||||
print >> sys.stderr, "Missing value ('localtime' or timeoffset in seconds)!"
|
print >> sys.stderr, "Missing value ('localtime' or timeoffset in seconds)!"
|
||||||
@ -338,6 +349,7 @@ properties = {
|
|||||||
"drive": set_drive,
|
"drive": set_drive,
|
||||||
"mac": set_mac,
|
"mac": set_mac,
|
||||||
"debug": set_debug,
|
"debug": set_debug,
|
||||||
|
"qrexec_installed": set_qrexec_installed,
|
||||||
"timezone": set_timezone,
|
"timezone": set_timezone,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user