core: fix un-setting global VMs (default netvm, clockvm etc)
This commit is contained in:
parent
3914835ceb
commit
b8b2733114
@ -354,6 +354,9 @@ class QubesVmCollection(dict):
|
|||||||
netvm = self.get_default_fw_netvm())
|
netvm = self.get_default_fw_netvm())
|
||||||
|
|
||||||
def set_default_template(self, vm):
|
def set_default_template(self, vm):
|
||||||
|
if vm is None:
|
||||||
|
self.default_template_qid = None
|
||||||
|
else:
|
||||||
assert vm.is_template(), "VM {0} is not a TemplateVM!".format(vm.name)
|
assert vm.is_template(), "VM {0} is not a TemplateVM!".format(vm.name)
|
||||||
self.default_template_qid = vm.qid
|
self.default_template_qid = vm.qid
|
||||||
|
|
||||||
@ -364,6 +367,9 @@ class QubesVmCollection(dict):
|
|||||||
return self[self.default_template_qid]
|
return self[self.default_template_qid]
|
||||||
|
|
||||||
def set_default_netvm(self, vm):
|
def set_default_netvm(self, vm):
|
||||||
|
if vm is None:
|
||||||
|
self.default_netvm_qid = None
|
||||||
|
else:
|
||||||
assert vm.is_netvm(), "VM {0} does not provide network!".format(vm.name)
|
assert vm.is_netvm(), "VM {0} does not provide network!".format(vm.name)
|
||||||
self.default_netvm_qid = vm.qid
|
self.default_netvm_qid = vm.qid
|
||||||
|
|
||||||
@ -383,6 +389,9 @@ class QubesVmCollection(dict):
|
|||||||
return self.default_kernel
|
return self.default_kernel
|
||||||
|
|
||||||
def set_default_fw_netvm(self, vm):
|
def set_default_fw_netvm(self, vm):
|
||||||
|
if vm is None:
|
||||||
|
self.default_fw_netvm_qid = None
|
||||||
|
else:
|
||||||
assert vm.is_netvm(), "VM {0} does not provide network!".format(vm.name)
|
assert vm.is_netvm(), "VM {0} does not provide network!".format(vm.name)
|
||||||
self.default_fw_netvm_qid = vm.qid
|
self.default_fw_netvm_qid = vm.qid
|
||||||
|
|
||||||
@ -393,6 +402,9 @@ class QubesVmCollection(dict):
|
|||||||
return self[self.default_fw_netvm_qid]
|
return self[self.default_fw_netvm_qid]
|
||||||
|
|
||||||
def set_updatevm_vm(self, vm):
|
def set_updatevm_vm(self, vm):
|
||||||
|
if vm is None:
|
||||||
|
self.updatevm_qid = None
|
||||||
|
else:
|
||||||
self.updatevm_qid = vm.qid
|
self.updatevm_qid = vm.qid
|
||||||
|
|
||||||
def get_updatevm_vm(self):
|
def get_updatevm_vm(self):
|
||||||
@ -402,6 +414,9 @@ class QubesVmCollection(dict):
|
|||||||
return self[self.updatevm_qid]
|
return self[self.updatevm_qid]
|
||||||
|
|
||||||
def set_clockvm_vm(self, vm):
|
def set_clockvm_vm(self, vm):
|
||||||
|
if vm is None:
|
||||||
|
self.clockvm_qid = None
|
||||||
|
else:
|
||||||
self.clockvm_qid = vm.qid
|
self.clockvm_qid = vm.qid
|
||||||
|
|
||||||
def get_clockvm_vm(self):
|
def get_clockvm_vm(self):
|
||||||
|
@ -39,6 +39,13 @@ def handle_vm(vms, label, new_value = None):
|
|||||||
assert label in functions.keys()
|
assert label in functions.keys()
|
||||||
|
|
||||||
if new_value:
|
if new_value:
|
||||||
|
if new_value == "none":
|
||||||
|
try:
|
||||||
|
vms.__getattribute__(functions[label][1])(None)
|
||||||
|
except Exception as e:
|
||||||
|
print >> sys.stderr, "ERROR: {0}".format(str(e))
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
vm = vms.get_vm_by_name (new_value)
|
vm = vms.get_vm_by_name (new_value)
|
||||||
if vm is None:
|
if vm is None:
|
||||||
print >> sys.stderr, "A VM with the name '{0}' does not exist in the system.".format(new_value)
|
print >> sys.stderr, "A VM with the name '{0}' does not exist in the system.".format(new_value)
|
||||||
|
Loading…
Reference in New Issue
Block a user