dom0/qvm-tools: adjust for new QubesVmCollection API
This commit is contained in:
parent
3da1795e72
commit
ae56b17a19
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user