diff --git a/dom0/qvm-tools/qvm-add-appvm b/dom0/qvm-tools/qvm-add-appvm index 82f58249..7916e67a 100755 --- a/dom0/qvm-tools/qvm-add-appvm +++ b/dom0/qvm-tools/qvm-add-appvm @@ -68,7 +68,7 @@ def main(): exit(1) - vm = qvm_collection.add_new_appvm(vmname, template, + vm = qvm_collection.add_new_vm("QubesAppVm", name=vmname, template=template, conf_file=options.conf_file, dir_path=options.dir_path) diff --git a/dom0/qvm-tools/qvm-add-template b/dom0/qvm-tools/qvm-add-template index 5a407803..903cbe35 100755 --- a/dom0/qvm-tools/qvm-add-template +++ b/dom0/qvm-tools/qvm-add-template @@ -63,7 +63,7 @@ def main(): print >> sys.stderr, "ERROR: A VM with the name '{0}' already exists in the system.".format(vmname) exit(1) - vm = qvm_collection.add_new_templatevm(vmname, + vm = qvm_collection.add_new_vm("QubesTemplateVm", name=vmname, conf_file=options.conf_file, dir_path=options.dir_path, installed_by_rpm=options.installed_by_rpm) diff --git a/dom0/qvm-tools/qvm-clone b/dom0/qvm-tools/qvm-clone index 02d24fe9..c99f3062 100755 --- a/dom0/qvm-tools/qvm-clone +++ b/dom0/qvm-tools/qvm-clone @@ -64,20 +64,14 @@ def main(): print >> sys.stderr, "ERROR: A VM with the name '{0}' already exists in the system.".format(dstname) exit(1) - dst_vm = None - if isinstance(src_vm, QubesTemplateVm): - dst_vm = qvm_collection.add_new_templatevm(name=dstname, - dir_path=options.dir_path, installed_by_rpm=False) - elif isinstance(src_vm, QubesAppVm): - dst_vm = qvm_collection.add_new_appvm(name=dstname, template=src_vm.template, - label=src_vm.label, - dir_path=options.dir_path) - elif isinstance(src_vm, QubesHVm): - dst_vm = qvm_collection.add_new_hvm(name=dstname, label=src_vm.label) - else: + if src_vm.is_disposablevm(): print >> sys.stderr, "ERROR: Clone not supported for this type of VM" exit(1) + dst_vm = qvm_collection.add_new_vm(src_vm.__class__.__name__, + name=dstname, template=src_vm.template, + dir_path=options.dir_path, installed_by_rpm=False) + try: dst_vm.clone_attrs(src_vm) dst_vm.clone_disk_files (src_vm=src_vm, verbose=options.verbose) diff --git a/dom0/qvm-tools/qvm-create b/dom0/qvm-tools/qvm-create index 42bf67e3..a9d9c1ce 100755 --- a/dom0/qvm-tools/qvm-create +++ b/dom0/qvm-tools/qvm-create @@ -134,15 +134,17 @@ def main(): new_vm_template = template vm = None + if options.netvm: + vmtype = "QubesNetVm" + elif options.proxyvm: + vmtype = "QubesProxyVm" + elif options.hvm: + vmtype = "QubesHVm" + else: + vmtype = "QubesAppVm" + try: - if options.netvm: - vm = qvm_collection.add_new_netvm(vmname, new_vm_template, label = label) - elif options.proxyvm: - vm = qvm_collection.add_new_proxyvm(vmname, new_vm_template, label = label) - elif options.hvm: - vm = qvm_collection.add_new_hvm(vmname, label = label) - else: - vm = qvm_collection.add_new_appvm(vmname, new_vm_template, label = label) + vm = qvm_collection.add_new_vm(vmtype, name=vmname, template=new_vm_template, label = label) except QubesException as err: print >> sys.stderr, "ERROR: {0}".format(err) exit (1)