dom0/core: VM property for qrexec startup timeout (#27 pro)
This commit is contained in:
parent
c26e21d883
commit
c1214bfef9
@ -260,6 +260,7 @@ class QubesVm(object):
|
||||
"services": { "default": {}, "eval": "eval(str(value))" },
|
||||
"debug": { "default": False },
|
||||
"default_user": { "default": "user" },
|
||||
"qrexec_timeout": { "default": 60, "eval": "int(value)" },
|
||||
##### Internal attributes - will be overriden in __init__ regardless of args
|
||||
"appmenus_templates_dir": { "eval": \
|
||||
'self.dir_path + "/" + default_appmenus_templates_subdir if self.updateable else ' + \
|
||||
@ -280,7 +281,7 @@ class QubesVm(object):
|
||||
'uses_default_kernel', 'kernel', 'uses_default_kernelopts',\
|
||||
'kernelopts', 'services', 'installed_by_rpm',\
|
||||
'uses_default_netvm', 'include_in_backups', 'debug',\
|
||||
'default_user' ]:
|
||||
'default_user', 'qrexec_timeout' ]:
|
||||
attrs[prop]['save'] = 'str(self.%s)' % prop
|
||||
# Simple paths
|
||||
for prop in ['conf_file', 'root_img', 'volatile_img', 'private_img']:
|
||||
@ -1442,7 +1443,9 @@ class QubesVm(object):
|
||||
if verbose:
|
||||
print >> sys.stderr, "--> Starting the qrexec daemon..."
|
||||
xid = self.get_xid()
|
||||
retcode = subprocess.call ([qrexec_daemon_path, str(xid), self.default_user])
|
||||
qrexec_env = os.environ
|
||||
qrexec_env['QREXEC_STARTUP_TIMEOUT'] = str(self.qrexec_timeout)
|
||||
retcode = subprocess.call ([qrexec_daemon_path, str(xid), self.default_user], env=qrexec_env)
|
||||
if (retcode != 0) :
|
||||
self.force_shutdown()
|
||||
raise OSError ("ERROR: Cannot execute qrexec_daemon!")
|
||||
@ -2867,7 +2870,8 @@ class QubesVmCollection(dict):
|
||||
"installed_by_rpm", "internal",
|
||||
"uses_default_netvm", "label", "memory", "vcpus", "pcidevs",
|
||||
"maxmem", "kernel", "uses_default_kernel", "kernelopts", "uses_default_kernelopts",
|
||||
"mac", "services", "include_in_backups", "debug", "default_user", "qrexec_installed", "drive" )
|
||||
"mac", "services", "include_in_backups", "debug",
|
||||
"default_user", "qrexec_timeout", "qrexec_installed", "drive" )
|
||||
|
||||
for attribute in common_attr_list:
|
||||
kwargs[attribute] = element.get(attribute)
|
||||
|
@ -84,6 +84,9 @@ def do_list(vm):
|
||||
if hasattr(vm, 'qrexec_installed'):
|
||||
print fmt.format("qrexec_installed", str(vm.qrexec_installed))
|
||||
|
||||
if hasattr(vm, 'qrexec_timeout'):
|
||||
print fmt.format("qrexec timeout", str(vm.qrexec_timeout))
|
||||
|
||||
if hasattr(vm, 'drive'):
|
||||
print fmt.format("drive", str(vm.drive))
|
||||
|
||||
@ -333,6 +336,14 @@ def set_qrexec_installed(vms, vm, args):
|
||||
vm.qrexec_installed = bool(eval(args[0].capitalize()))
|
||||
return True
|
||||
|
||||
def set_qrexec_timeout(vms, vm, args):
|
||||
if len (args) != 1:
|
||||
print >> sys.stderr, "Missing timeout value (seconds)!"
|
||||
return False
|
||||
|
||||
vm.qrexec_timeout = int(args[0])
|
||||
return True
|
||||
|
||||
def set_timezone(vms, vm, args):
|
||||
if len (args) != 1:
|
||||
print >> sys.stderr, "Missing value ('localtime' or timeoffset in seconds)!"
|
||||
@ -362,6 +373,7 @@ properties = {
|
||||
"debug": set_debug,
|
||||
"default_user": set_default_user,
|
||||
"qrexec_installed": set_qrexec_installed,
|
||||
"qrexec_timeout": set_qrexec_timeout,
|
||||
"timezone": set_timezone,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user