diff --git a/dom0/qvm-core/qubes.py b/dom0/qvm-core/qubes.py index bdd3551c..6adf817e 100755 --- a/dom0/qvm-core/qubes.py +++ b/dom0/qvm-core/qubes.py @@ -231,6 +231,7 @@ class QubesVm(object): kernelopts = "", uses_default_kernelopts = True, mac = None, + include_in_backups = True, services = None): @@ -264,6 +265,8 @@ class QubesVm(object): self.config_file_template = config_template_pv self.updateable = updateable + self.include_in_backups = include_in_backups + self._label = label if label is not None else QubesVmLabels["red"] if self.dir_path is not None: self.icon_path = self.dir_path + "/icon.png" @@ -1439,7 +1442,7 @@ class QubesVm(object): for prop in ['memory', 'maxmem', 'pcidevs', 'vcpus', 'internal',\ 'uses_default_kernel', 'kernel', 'uses_default_kernelopts',\ 'kernelopts', 'services', 'updateable', 'installed_by_rpm',\ - 'uses_default_netvm' ]: + 'uses_default_netvm', 'include_in_backups' ]: if hasattr(self, prop): attrs[prop] = str(self.__getattribute__(prop)) if self._mac is not None: @@ -2624,7 +2627,7 @@ class QubesVmCollection(dict): "installed_by_rpm", "updateable", "internal", "uses_default_netvm", "label", "memory", "vcpus", "pcidevs", "maxmem", "kernel", "uses_default_kernel", "kernelopts", "uses_default_kernelopts", - "mac", "services" ) + "mac", "services", "include_in_backups" ) for attribute in common_attr_list: kwargs[attribute] = element.get(attribute) @@ -2635,6 +2638,9 @@ class QubesVmCollection(dict): if "updateable" in kwargs: 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: kwargs["installed_by_rpm"] = True if kwargs["installed_by_rpm"] == "True" else False diff --git a/dom0/qvm-tools/qvm-prefs b/dom0/qvm-tools/qvm-prefs index 0b31053c..5692bb07 100755 --- a/dom0/qvm-tools/qvm-prefs +++ b/dom0/qvm-tools/qvm-prefs @@ -43,6 +43,7 @@ def do_list(vm): print fmt.format ("netvm", vm.netvm.name) print fmt.format ("updateable?", vm.is_updateable()) 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 ("config", vm.conf_file) print fmt.format ("pcidevs", vm.pcidevs) @@ -326,7 +327,16 @@ def set_drive(vms, vm, args): vm.drive = args[0] 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 = { + "include_in_backups": set_include_in_backups, "updateable": set_updateable, "nonupdateable": set_nonupdateable, "pcidevs": set_pcidevs,