Better handle retcodes in migrate update
This commit is contained in:
parent
68c7481aa2
commit
dc560c1dcb
|
@ -569,16 +569,21 @@ def update_vm_sriov_nics(zkhandler, dom_uuid, source_node, target_node):
|
||||||
if is_used == 'True':
|
if is_used == 'True':
|
||||||
used_by_name = searchClusterByUUID(zkhandler, zkhandler.read(('node.sriov.vf', target_node, 'sriov_vf.used_by', network['source'])))
|
used_by_name = searchClusterByUUID(zkhandler, zkhandler.read(('node.sriov.vf', target_node, 'sriov_vf.used_by', network['source'])))
|
||||||
if retcode:
|
if retcode:
|
||||||
retcode = False
|
retcode_this = False
|
||||||
retmsg = 'Attempting to use SR-IOV network "{}" which is already used by VM "{}"'.format(network['source'], used_by_name)
|
retmsg = 'Attempting to use SR-IOV network "{}" which is already used by VM "{}"'.format(network['source'], used_by_name)
|
||||||
|
else:
|
||||||
|
retcode_this = True
|
||||||
|
|
||||||
# We must update the "used" section
|
# We must update the "used" section
|
||||||
if retcode:
|
if retcode_this:
|
||||||
# This conditional ensure that if we failed the is_used check, we don't try to overwrite the information of a VF that belongs to another VM
|
# This conditional ensure that if we failed the is_used check, we don't try to overwrite the information of a VF that belongs to another VM
|
||||||
set_sriov_vf_vm(zkhandler, dom_uuid, target_node, network['source'], network['mac'], network['type'])
|
set_sriov_vf_vm(zkhandler, dom_uuid, target_node, network['source'], network['mac'], network['type'])
|
||||||
# ... but we still want to free the old node in an case
|
# ... but we still want to free the old node in an case
|
||||||
unset_sriov_vf_vm(zkhandler, source_node, network['source'])
|
unset_sriov_vf_vm(zkhandler, source_node, network['source'])
|
||||||
|
|
||||||
|
if not retcode_this:
|
||||||
|
retcode = retcode_this
|
||||||
|
|
||||||
return retcode, retmsg
|
return retcode, retmsg
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue