dom0/core: save real netvm of DispVM

Netvm of DispVM is based on DispVM-template settings. So save the real one
instead of assuming default netvm.
This commit is contained in:
Marek Marczykowski 2013-01-16 23:49:24 +01:00
parent 917ccc2a4b
commit 73a540e5e5
2 changed files with 4 additions and 3 deletions

View File

@ -2230,6 +2230,7 @@ class QubesDisposableVm(QubesVm):
attrs["template_qid"] = str(self.template.qid)
attrs["label"] = self.label.name
attrs["firewall_conf"] = self.relative_path(self.firewall_conf)
attrs["netvm_qid"] = str(self.netvm.qid) if self.netvm is not None else "none"
return attrs
def verify_files(self):
@ -2601,11 +2602,11 @@ class QubesVmCollection(dict):
return vm
def add_new_disposablevm(self, name, template, dispid,
label = None):
label = None, netvm = None):
qid = self.get_new_unused_qid()
vm = QubesDisposableVm (qid=qid, name=name, template=template,
netvm = self.get_default_netvm(),
netvm = netvm,
label=label, dispid=dispid)
if not self.verify_new_vm (vm):

View File

@ -88,7 +88,7 @@ class QfileDaemonDvm:
qvm_collection.unlock_db()
return None
dispid=int(disp_name[4:])
dispvm=qvm_collection.add_new_disposablevm(disp_name, vm_disptempl.template, label=label, dispid=dispid)
dispvm=qvm_collection.add_new_disposablevm(disp_name, vm_disptempl.template, label=label, dispid=dispid, netvm=vm_disptempl.netvm)
# By default inherit firewall rules from calling VM
if os.path.exists(vm.firewall_conf):
disp_firewall_conf = '/var/run/qubes/%s-firewall.xml' % disp_name