diff --git a/dom0/qvm-core/qubes.py b/dom0/qvm-core/qubes.py index 76f7ee74..76eb4a4b 100755 --- a/dom0/qvm-core/qubes.py +++ b/dom0/qvm-core/qubes.py @@ -181,6 +181,7 @@ class QubesVm(object): firewall_conf = None, volatile_img = None, pcidevs = None, + internal = False, vcpus = None): @@ -262,6 +263,9 @@ class QubesVm(object): else: self.vcpus = vcpus + # Internal VM (not shown in qubes-manager, doesn't create appmenus entries + self.internal = internal + if not dry_run and xend_session.session is not None: self.refresh_xend_session() @@ -928,6 +932,7 @@ class QubesVm(object): attrs["memory"] = str(self.memory) attrs["pcidevs"] = str(self.pcidevs) attrs["vcpus"] = str(self.vcpus) + attrs["internal"] = str(self.internal) return attrs def create_xml_element(self): @@ -1567,7 +1572,8 @@ class QubesAppVm(QubesVm): print "--> Creating icon symlink: {0} -> {1}".format(self.icon_path, self.label.icon_path) os.symlink (self.label.icon_path, self.icon_path) - self.create_appmenus (verbose) + if not self.internal: + self.create_appmenus (verbose) def remove_from_disk(self): if dry_run: @@ -1883,7 +1889,7 @@ class QubesVmCollection(dict): kwargs = {} common_attr_list = ("qid", "name", "dir_path", "conf_file", "private_img", "root_img", "template_qid", - "installed_by_rpm", "updateable", + "installed_by_rpm", "updateable", "internal" "uses_default_netvm", "label", "memory", "vcpus", "pcidevs") for attribute in common_attr_list: @@ -1896,6 +1902,9 @@ class QubesVmCollection(dict): if "installed_by_rpm" in kwargs: kwargs["installed_by_rpm"] = True if kwargs["installed_by_rpm"] == "True" else False + if "internal" in kwargs: + kwargs["internal"] = True if kwargs["internal"] == "True" else False + if "template_qid" in kwargs: if kwargs["template_qid"] == "none" or kwargs["template_qid"] is None: kwargs.pop("template_qid") diff --git a/dom0/qvm-tools/qvm-create b/dom0/qvm-tools/qvm-create index c4c80b97..c0f3f478 100755 --- a/dom0/qvm-tools/qvm-create +++ b/dom0/qvm-tools/qvm-create @@ -63,6 +63,8 @@ def main(): help="Initial memory size (in MB)") parser.add_option ("-c", "--vcpus", dest="vcpus", default=None, help="VCPUs count") + parser.add_option ("-i", "--internal", action="store_true", dest="internal", default=False, + help="Create VM for internal use only (hidden in qubes-manager, no appmenus)") parser.add_option ("-q", "--quiet", action="store_false", dest="verbose", default=True) (options, args) = parser.parse_args () @@ -134,6 +136,9 @@ def main(): else: vm = qvm_collection.add_new_appvm(vmname, template_vm, label = label, updateable = options.standalone) + if options.internal: + vm.internal = True + if options.mem is not None: vm.memory = options.mem diff --git a/dom0/restore/qvm-create-default-dvm b/dom0/restore/qvm-create-default-dvm index c854c837..04ed97e1 100755 --- a/dom0/restore/qvm-create-default-dvm +++ b/dom0/restore/qvm-create-default-dvm @@ -32,7 +32,7 @@ DVMTMPLDIR="/var/lib/qubes/appvms/$DVMTMPL" if ! [ -d "$DVMTMPLDIR" ] ; then # unfortunately, currently there are reliability issues with save of a domain # with multiple CPUs - if ! qvm-create --vcpus=1 -t "$TEMPLATENAME" -l gray "$DVMTMPL" ; then exit 1 ; fi + if ! qvm-create --vcpus=1 --internal -t "$TEMPLATENAME" -l gray "$DVMTMPL" ; then exit 1 ; fi fi if ! /usr/lib/qubes/qubes_prepare_saved_domain.sh \ "$DVMTMPL" "/var/lib/qubes/appvms/$DVMTMPL/dvm-savefile" $SCRIPTNAME ; then