Set netvm reference only after NetVMs/ProxyVMs load - ProxyVM

This commit is contained in:
Marek Marczykowski 2011-03-11 02:00:42 +01:00
parent a3d8778841
commit 5c2e676fa1

View File

@ -1783,7 +1783,7 @@ class QubesVmCollection(dict):
attr_list = ("qid", "name", "dir_path", "conf_file",
"appvms_conf_file", "private_img", "root_img",
"installed_by_rpm", "updateable",
"uses_default_netvm", "netvm_qid")
"uses_default_netvm")
for attribute in attr_list:
kwargs[attribute] = element.get(attribute)
@ -1793,26 +1793,6 @@ class QubesVmCollection(dict):
if kwargs["updateable"] is not None:
kwargs["updateable"] = True if kwargs["updateable"] == "True" else False
if "uses_default_netvm" not in kwargs:
kwargs["uses_default_netvm"] = True
else:
kwargs["uses_default_netvm"] = True if kwargs["uses_default_netvm"] == "True" else False
if kwargs["uses_default_netvm"] is True:
netvm_vm = self.get_default_netvm_vm()
kwargs.pop("netvm_qid")
else:
if kwargs["netvm_qid"] == "none" or kwargs["netvm_qid"] is None:
netvm_vm = None
kwargs.pop("netvm_qid")
else:
netvm_qid = int(kwargs.pop("netvm_qid"))
if netvm_qid not in self:
netvm_vm = None
else:
netvm_vm = self[netvm_qid]
kwargs["netvm_vm"] = netvm_vm
vm = QubesTemplateVm(**kwargs)
self[vm.qid] = vm
@ -1878,18 +1858,6 @@ class QubesVmCollection(dict):
kwargs["template_vm"] = template_vm
kwargs["netid"] = int(kwargs["netid"])
if kwargs["netvm_qid"] == "none" or kwargs["netvm_qid"] is None:
netvm_vm = None
kwargs.pop("netvm_qid")
else:
netvm_qid = int(kwargs.pop("netvm_qid"))
if netvm_qid not in self:
netvm_vm = None
else:
netvm_vm = self[netvm_qid]
kwargs["netvm_vm"] = netvm_vm
vm = QubesProxyVm(**kwargs)
self[vm.qid] = vm