Update VM adding code for new API
No longer separate functions for each VM type.
This commit is contained in:
parent
c11c42e2f7
commit
4a7f3caee9
@ -145,8 +145,9 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
|||||||
vmtype = "HVM"
|
vmtype = "HVM"
|
||||||
|
|
||||||
|
|
||||||
|
vmclass = "Qubes" + vmtype.replace("VM", "Vm")
|
||||||
thread_monitor = ThreadMonitor()
|
thread_monitor = ThreadMonitor()
|
||||||
thread = threading.Thread (target=self.do_create_vm, args=(createvm_method, vmname, label, template_vm, standalone, allow_networking, thread_monitor))
|
thread = threading.Thread (target=self.do_create_vm, args=(vmclass, vmname, label, template_vm, standalone, allow_networking, thread_monitor))
|
||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
@ -170,21 +171,17 @@ class NewVmDlg (QDialog, Ui_NewVMDlg):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def do_create_vm (self, createvm_method, vmname, label, template_vm, standalone, allow_networking, thread_monitor):
|
def do_create_vm (self, vmclass, vmname, label, template_vm, standalone, allow_networking, thread_monitor):
|
||||||
vm = None
|
vm = None
|
||||||
try:
|
try:
|
||||||
self.qvm_collection.lock_db_for_writing()
|
self.qvm_collection.lock_db_for_writing()
|
||||||
self.qvm_collection.load()
|
self.qvm_collection.load()
|
||||||
|
|
||||||
if template_vm is not None:
|
|
||||||
if not standalone:
|
if not standalone:
|
||||||
vm = createvm_method(vmname, template_vm, label = label)
|
vm = self.qvm_collection.add_new_vm(vmclass, name=vmname, template=template_vm, label=label)
|
||||||
else:
|
else:
|
||||||
vm = createvm_method(vmname, None, label = label)
|
vm = self.qvm_collection.add_new_vm(vmclass, name=vmname, template=None, label=label)
|
||||||
vm.create_on_disk(verbose=False, source_template = template_vm)
|
vm.create_on_disk(verbose=False, source_template = template_vm)
|
||||||
else:
|
|
||||||
vm = createvm_method(vmname, label = label)
|
|
||||||
vm.create_on_disk(verbose=False)
|
|
||||||
|
|
||||||
if allow_networking == False:
|
if allow_networking == False:
|
||||||
vm.uses_default_netvm = False
|
vm.uses_default_netvm = False
|
||||||
|
Loading…
Reference in New Issue
Block a user