From dbf8c11ad66d1442bcfb2e41b3d7c35e9e0eb258 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Tue, 13 Sep 2011 15:12:52 +0200 Subject: [PATCH] dom0/qvm-backup-restore: Distinguish ProxyVM from NetVM (#345) --- dom0/qvm-tools/qvm-backup-restore | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/dom0/qvm-tools/qvm-backup-restore b/dom0/qvm-tools/qvm-backup-restore index 969651e6..29061dcd 100755 --- a/dom0/qvm-tools/qvm-backup-restore +++ b/dom0/qvm-tools/qvm-backup-restore @@ -57,7 +57,8 @@ fields = { + ('}' if vm.is_netvm() else '')"}, "type": {"func": "'Tpl' if vm.is_template() else \ - (' Net' if vm.is_netvm() else 'App')"}, + ('Proxy' if vm.is_proxyvm() else \ + (' Net' if vm.is_netvm() else 'App'))"}, "updbl" : {"func": "'Yes' if vm.is_updateable() else ''"}, @@ -325,7 +326,7 @@ def main(): # ... then NetVMs... for vm in [ vm for vm in vms_to_restore if vm.is_netvm()]: - print "-> Restoring NetVM {0}...".format(vm.name) + print "-> Restoring {0} {1}...".format(vm.type, vm.name) retcode = subprocess.call (["mkdir", "-p", vm.dir_path]) if retcode != 0: print ("*** Cannot create directory: {0}?!".format(dest_dir)) @@ -348,11 +349,18 @@ def main(): updateable = vm.updateable try: - vm = host_collection.add_new_netvm(vm.name, template_vm, - conf_file=vm.conf_file, - dir_path=vm.dir_path, - updateable=updateable, - label=vm.label) + if vm.type == "NetVM": + vm = host_collection.add_new_netvm(vm.name, template_vm, + conf_file=vm.conf_file, + dir_path=vm.dir_path, + updateable=updateable, + label=vm.label) + elif vm.type == "ProxyVM": + vm = host_collection.add_new_proxyvm(vm.name, template_vm, + conf_file=vm.conf_file, + dir_path=vm.dir_path, + updateable=updateable, + label=vm.label) except Exception as err: print "ERROR: {0}".format(err) print "*** Skiping VM: {0}".format(vm.name) @@ -360,7 +368,7 @@ def main(): host_collection.pop(vm.qid) continue - if not uses_default_netvm: + if vm.is_proxyvm() and not uses_default_netvm: vm.uses_default_netvm = False vm.netvm_vm = netvm_vm