Internal VMs (hidden in qubes-manager, menus etc) - used for DispVM template (#155)
This commit is contained in:
parent
fa703c536f
commit
398734dad2
@ -181,6 +181,7 @@ class QubesVm(object):
|
|||||||
firewall_conf = None,
|
firewall_conf = None,
|
||||||
volatile_img = None,
|
volatile_img = None,
|
||||||
pcidevs = None,
|
pcidevs = None,
|
||||||
|
internal = False,
|
||||||
vcpus = None):
|
vcpus = None):
|
||||||
|
|
||||||
|
|
||||||
@ -262,6 +263,9 @@ class QubesVm(object):
|
|||||||
else:
|
else:
|
||||||
self.vcpus = vcpus
|
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:
|
if not dry_run and xend_session.session is not None:
|
||||||
self.refresh_xend_session()
|
self.refresh_xend_session()
|
||||||
|
|
||||||
@ -928,6 +932,7 @@ class QubesVm(object):
|
|||||||
attrs["memory"] = str(self.memory)
|
attrs["memory"] = str(self.memory)
|
||||||
attrs["pcidevs"] = str(self.pcidevs)
|
attrs["pcidevs"] = str(self.pcidevs)
|
||||||
attrs["vcpus"] = str(self.vcpus)
|
attrs["vcpus"] = str(self.vcpus)
|
||||||
|
attrs["internal"] = str(self.internal)
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
def create_xml_element(self):
|
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)
|
print "--> Creating icon symlink: {0} -> {1}".format(self.icon_path, self.label.icon_path)
|
||||||
os.symlink (self.label.icon_path, self.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):
|
def remove_from_disk(self):
|
||||||
if dry_run:
|
if dry_run:
|
||||||
@ -1883,7 +1889,7 @@ class QubesVmCollection(dict):
|
|||||||
kwargs = {}
|
kwargs = {}
|
||||||
common_attr_list = ("qid", "name", "dir_path", "conf_file",
|
common_attr_list = ("qid", "name", "dir_path", "conf_file",
|
||||||
"private_img", "root_img", "template_qid",
|
"private_img", "root_img", "template_qid",
|
||||||
"installed_by_rpm", "updateable",
|
"installed_by_rpm", "updateable", "internal"
|
||||||
"uses_default_netvm", "label", "memory", "vcpus", "pcidevs")
|
"uses_default_netvm", "label", "memory", "vcpus", "pcidevs")
|
||||||
|
|
||||||
for attribute in common_attr_list:
|
for attribute in common_attr_list:
|
||||||
@ -1896,6 +1902,9 @@ class QubesVmCollection(dict):
|
|||||||
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
|
||||||
|
|
||||||
|
if "internal" in kwargs:
|
||||||
|
kwargs["internal"] = True if kwargs["internal"] == "True" else False
|
||||||
|
|
||||||
if "template_qid" in kwargs:
|
if "template_qid" in kwargs:
|
||||||
if kwargs["template_qid"] == "none" or kwargs["template_qid"] is None:
|
if kwargs["template_qid"] == "none" or kwargs["template_qid"] is None:
|
||||||
kwargs.pop("template_qid")
|
kwargs.pop("template_qid")
|
||||||
|
@ -63,6 +63,8 @@ def main():
|
|||||||
help="Initial memory size (in MB)")
|
help="Initial memory size (in MB)")
|
||||||
parser.add_option ("-c", "--vcpus", dest="vcpus", default=None,
|
parser.add_option ("-c", "--vcpus", dest="vcpus", default=None,
|
||||||
help="VCPUs count")
|
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)
|
parser.add_option ("-q", "--quiet", action="store_false", dest="verbose", default=True)
|
||||||
(options, args) = parser.parse_args ()
|
(options, args) = parser.parse_args ()
|
||||||
@ -134,6 +136,9 @@ def main():
|
|||||||
else:
|
else:
|
||||||
vm = qvm_collection.add_new_appvm(vmname, template_vm, label = label, updateable = options.standalone)
|
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:
|
if options.mem is not None:
|
||||||
vm.memory = options.mem
|
vm.memory = options.mem
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ DVMTMPLDIR="/var/lib/qubes/appvms/$DVMTMPL"
|
|||||||
if ! [ -d "$DVMTMPLDIR" ] ; then
|
if ! [ -d "$DVMTMPLDIR" ] ; then
|
||||||
# unfortunately, currently there are reliability issues with save of a domain
|
# unfortunately, currently there are reliability issues with save of a domain
|
||||||
# with multiple CPUs
|
# 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
|
fi
|
||||||
if ! /usr/lib/qubes/qubes_prepare_saved_domain.sh \
|
if ! /usr/lib/qubes/qubes_prepare_saved_domain.sh \
|
||||||
"$DVMTMPL" "/var/lib/qubes/appvms/$DVMTMPL/dvm-savefile" $SCRIPTNAME ; then
|
"$DVMTMPL" "/var/lib/qubes/appvms/$DVMTMPL/dvm-savefile" $SCRIPTNAME ; then
|
||||||
|
Loading…
Reference in New Issue
Block a user