From 5e20cfffcc9e717ca98899526bb344dd0842461a Mon Sep 17 00:00:00 2001 From: ssamson-tis Date: Thu, 17 Aug 2017 17:35:23 +0200 Subject: [PATCH] fix wrong network label --- libtisbackup/copy_vm_xcp.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libtisbackup/copy_vm_xcp.py b/libtisbackup/copy_vm_xcp.py index 3f96b91..93bdd45 100755 --- a/libtisbackup/copy_vm_xcp.py +++ b/libtisbackup/copy_vm_xcp.py @@ -92,6 +92,13 @@ class copy_vm_xcp(backup_generic): except IndexError,error: result = (1,"error get VM opaqueref %s"%(error)) return result + + # get vm backup network opaqueRef + try: + networkRef = session.xenapi.network.get_by_name_label(self.network_name)[0] + except IndexError, error: + result = (1, "error get VM network opaqueref %s" % (error)) + return result if str2bool(self.halt_vm): status_vm = session.xenapi.VM.get_power_state(vm) @@ -185,7 +192,6 @@ class copy_vm_xcp(backup_generic): for i in vifDestroy: vifRecord = session.xenapi.VIF.get_record(i) session.xenapi.VIF.destroy(i) - networkRef = session.xenapi.network.get_by_name_label(self.network_name)[0] data = {'MAC': vifRecord['MAC'], 'MAC_autogenerated': False, 'MTU': vifRecord['MTU'],