dom0/QubesVm: add include_in_backups property
This commit is contained in:
parent
7d07bc718b
commit
f6c222d957
@ -231,6 +231,7 @@ class QubesVm(object):
|
|||||||
kernelopts = "",
|
kernelopts = "",
|
||||||
uses_default_kernelopts = True,
|
uses_default_kernelopts = True,
|
||||||
mac = None,
|
mac = None,
|
||||||
|
include_in_backups = True,
|
||||||
services = None):
|
services = None):
|
||||||
|
|
||||||
|
|
||||||
@ -264,6 +265,8 @@ class QubesVm(object):
|
|||||||
self.config_file_template = config_template_pv
|
self.config_file_template = config_template_pv
|
||||||
|
|
||||||
self.updateable = updateable
|
self.updateable = updateable
|
||||||
|
self.include_in_backups = include_in_backups
|
||||||
|
|
||||||
self._label = label if label is not None else QubesVmLabels["red"]
|
self._label = label if label is not None else QubesVmLabels["red"]
|
||||||
if self.dir_path is not None:
|
if self.dir_path is not None:
|
||||||
self.icon_path = self.dir_path + "/icon.png"
|
self.icon_path = self.dir_path + "/icon.png"
|
||||||
@ -1439,7 +1442,7 @@ class QubesVm(object):
|
|||||||
for prop in ['memory', 'maxmem', 'pcidevs', 'vcpus', 'internal',\
|
for prop in ['memory', 'maxmem', 'pcidevs', 'vcpus', 'internal',\
|
||||||
'uses_default_kernel', 'kernel', 'uses_default_kernelopts',\
|
'uses_default_kernel', 'kernel', 'uses_default_kernelopts',\
|
||||||
'kernelopts', 'services', 'updateable', 'installed_by_rpm',\
|
'kernelopts', 'services', 'updateable', 'installed_by_rpm',\
|
||||||
'uses_default_netvm' ]:
|
'uses_default_netvm', 'include_in_backups' ]:
|
||||||
if hasattr(self, prop):
|
if hasattr(self, prop):
|
||||||
attrs[prop] = str(self.__getattribute__(prop))
|
attrs[prop] = str(self.__getattribute__(prop))
|
||||||
if self._mac is not None:
|
if self._mac is not None:
|
||||||
@ -2624,7 +2627,7 @@ class QubesVmCollection(dict):
|
|||||||
"installed_by_rpm", "updateable", "internal",
|
"installed_by_rpm", "updateable", "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" )
|
"mac", "services", "include_in_backups" )
|
||||||
|
|
||||||
for attribute in common_attr_list:
|
for attribute in common_attr_list:
|
||||||
kwargs[attribute] = element.get(attribute)
|
kwargs[attribute] = element.get(attribute)
|
||||||
@ -2635,6 +2638,9 @@ class QubesVmCollection(dict):
|
|||||||
if "updateable" in kwargs:
|
if "updateable" in kwargs:
|
||||||
kwargs["updateable"] = True if kwargs["updateable"] == "True" else False
|
kwargs["updateable"] = True if kwargs["updateable"] == "True" else False
|
||||||
|
|
||||||
|
if "include_in_backups" in kwargs:
|
||||||
|
kwargs["include_in_backups"] = True if kwargs["include_in_backups"] == "True" else False
|
||||||
|
|
||||||
if "installed_by_rpm" in kwargs:
|
if "installed_by_rpm" in kwargs:
|
||||||
kwargs["installed_by_rpm"] = True if kwargs["installed_by_rpm"] == "True" else False
|
kwargs["installed_by_rpm"] = True if kwargs["installed_by_rpm"] == "True" else False
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ def do_list(vm):
|
|||||||
print fmt.format ("netvm", vm.netvm.name)
|
print fmt.format ("netvm", vm.netvm.name)
|
||||||
print fmt.format ("updateable?", vm.is_updateable())
|
print fmt.format ("updateable?", vm.is_updateable())
|
||||||
print fmt.format ("installed by RPM?", vm.installed_by_rpm)
|
print fmt.format ("installed by RPM?", vm.installed_by_rpm)
|
||||||
|
print fmt.format ("include in backups", vm.include_in_backups)
|
||||||
print fmt.format ("dir", vm.dir_path)
|
print fmt.format ("dir", vm.dir_path)
|
||||||
print fmt.format ("config", vm.conf_file)
|
print fmt.format ("config", vm.conf_file)
|
||||||
print fmt.format ("pcidevs", vm.pcidevs)
|
print fmt.format ("pcidevs", vm.pcidevs)
|
||||||
@ -326,7 +327,16 @@ def set_drive(vms, vm, args):
|
|||||||
vm.drive = args[0]
|
vm.drive = args[0]
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def set_include_in_backups(vms, vm, args):
|
||||||
|
if len (args) != 1:
|
||||||
|
print >> sys.stderr, "Missing value (True/False)!"
|
||||||
|
return False
|
||||||
|
|
||||||
|
vm.include_in_backups = bool(eval(args[0].capitalize()))
|
||||||
|
return True
|
||||||
|
|
||||||
properties = {
|
properties = {
|
||||||
|
"include_in_backups": set_include_in_backups,
|
||||||
"updateable": set_updateable,
|
"updateable": set_updateable,
|
||||||
"nonupdateable": set_nonupdateable,
|
"nonupdateable": set_nonupdateable,
|
||||||
"pcidevs": set_pcidevs,
|
"pcidevs": set_pcidevs,
|
||||||
|
Loading…
Reference in New Issue
Block a user