fix wrong network label

This commit is contained in:
ssamson-tis 2017-08-17 17:35:23 +02:00
parent 2853903232
commit 5e20cfffcc

View File

@ -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'],