dom0/core: add 'debug' VM property (#537)
This commit is contained in:
parent
073cce723f
commit
e73b13c68d
@ -248,6 +248,7 @@ class QubesVm(object):
|
||||
"mac": { "attr": "_mac", "default": None },
|
||||
"include_in_backups": { "default": True },
|
||||
"services": { "default": {}, "eval": "eval(str(value))" },
|
||||
"debug": { "default": False },
|
||||
##### 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 ' + \
|
||||
@ -264,7 +265,7 @@ class QubesVm(object):
|
||||
for prop in ['qid', 'name', 'dir_path', 'memory', 'maxmem', 'pcidevs', 'vcpus', 'internal',\
|
||||
'uses_default_kernel', 'kernel', 'uses_default_kernelopts',\
|
||||
'kernelopts', 'services', 'installed_by_rpm',\
|
||||
'uses_default_netvm', 'include_in_backups' ]:
|
||||
'uses_default_netvm', 'include_in_backups', 'debug' ]:
|
||||
attrs[prop]['save'] = 'str(self.%s)' % prop
|
||||
# Simple paths
|
||||
for prop in ['conf_file', 'root_img', 'volatile_img', 'private_img']:
|
||||
@ -891,6 +892,9 @@ class QubesVm(object):
|
||||
args['otherdevs'] = "'script:file:{dir}/modules.img,xvdd,{mode}',".format(dir=self.kernels_dir, mode=modulesmode)
|
||||
if hasattr(self, 'kernelopts'):
|
||||
args['kernelopts'] = self.kernelopts
|
||||
if self.debug:
|
||||
print >> sys.stderr, "--> Debug mode: adding 'earlyprintk=xen' to kernel opts"
|
||||
args['kernelopts'] += ' earlyprintk=xen'
|
||||
|
||||
return args
|
||||
|
||||
@ -1324,7 +1328,10 @@ class QubesVm(object):
|
||||
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)])
|
||||
guid_cmd = [qubes_guid_path, "-d", str(xid), "-c", self.label.color, "-i", self.label.icon, "-l", str(self.label.index)]
|
||||
if self.debug:
|
||||
guid_cmd += ['-v', '-v']
|
||||
retcode = subprocess.call (guid_cmd)
|
||||
if (retcode != 0) :
|
||||
raise QubesException("Cannot start qubes_guid!")
|
||||
|
||||
@ -2487,7 +2494,7 @@ 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" )
|
||||
"mac", "services", "include_in_backups", "debug" )
|
||||
|
||||
for attribute in common_attr_list:
|
||||
kwargs[attribute] = element.get(attribute)
|
||||
@ -2545,6 +2552,9 @@ class QubesVmCollection(dict):
|
||||
kwargs.pop("kernelopts")
|
||||
kwargs["uses_default_kernelopts"] = True
|
||||
|
||||
if "debug" in kwargs:
|
||||
kwargs["debug"] = True if kwargs["debug"] == "True" else False
|
||||
|
||||
return kwargs
|
||||
|
||||
def set_netvm_dependency(self, element):
|
||||
|
@ -73,6 +73,8 @@ def do_list(vm):
|
||||
print fmt.format ("kernelopts", "%s (default)" % vm.kernelopts)
|
||||
else:
|
||||
print fmt.format ("kernelopts", vm.kernelopts)
|
||||
if hasattr(vm, 'debug'):
|
||||
print fmt.format("debug", "on" if vm.debug else "off")
|
||||
|
||||
def set_label(vms, vm, args):
|
||||
if len (args) != 1:
|
||||
@ -269,6 +271,19 @@ def set_name(vms, vm, args):
|
||||
return True
|
||||
|
||||
|
||||
def set_debug(vms, vm, args):
|
||||
if len (args) != 1:
|
||||
print >> sys.stderr, "Missing value (True/False or on/off)!"
|
||||
return False
|
||||
|
||||
if args[0].lower() == "on":
|
||||
vm.debug = True
|
||||
elif args[0].lower() == "off":
|
||||
vm.debug = False
|
||||
else:
|
||||
vm.debug = bool(eval(args[0].capitalize()))
|
||||
return True
|
||||
|
||||
properties = {
|
||||
"include_in_backups": set_include_in_backups,
|
||||
"pcidevs": set_pcidevs,
|
||||
@ -282,6 +297,7 @@ properties = {
|
||||
"kernelopts": set_kernelopts,
|
||||
"name": set_name,
|
||||
"mac": set_mac,
|
||||
"debug": set_debug,
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user