NSX|V - fix exclude list error handling
The correct exception that should be expected is RequestBad Also - the order of the logs was changed to provide more information in case of exception. Change-Id: I5f4968e6ad769de5e297c39f8af643a930eda0fa
This commit is contained in:
parent
75735f559d
commit
c214e3d757
@ -1263,15 +1263,17 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
vm_moref = self._dvs.get_vm_moref(device_id)
|
vm_moref = self._dvs.get_vm_moref(device_id)
|
||||||
if vm_moref is not None:
|
if vm_moref is not None:
|
||||||
try:
|
try:
|
||||||
self.nsx_v.vcns.add_vm_to_exclude_list(vm_moref)
|
|
||||||
LOG.info(_LI("Add VM %(dev)s to exclude list on "
|
LOG.info(_LI("Add VM %(dev)s to exclude list on "
|
||||||
"behalf of port %(port)s: added to "
|
"behalf of port %(port)s: added to "
|
||||||
"list"),
|
"list"),
|
||||||
{"dev": device_id, "port": port_id})
|
{"dev": device_id, "port": port_id})
|
||||||
except n_exc.BadRequest:
|
self.nsx_v.vcns.add_vm_to_exclude_list(vm_moref)
|
||||||
|
except vsh_exc.RequestBad as e:
|
||||||
LOG.error(_LE("Failed to add vm %(device)s "
|
LOG.error(_LE("Failed to add vm %(device)s "
|
||||||
"moref %(moref)s to exclusion list"),
|
"moref %(moref)s to exclude list: "
|
||||||
{'device': device_id, 'moref': vm_moref})
|
"%(err)s"),
|
||||||
|
{'device': device_id, 'moref': vm_moref,
|
||||||
|
'err': e})
|
||||||
else:
|
else:
|
||||||
LOG.info(_LI("Add VM %(dev)s to exclude list on behalf of "
|
LOG.info(_LI("Add VM %(dev)s to exclude list on behalf of "
|
||||||
"port %(port)s: already in list"),
|
"port %(port)s: already in list"),
|
||||||
@ -1289,15 +1291,17 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
vm_moref = self._dvs.get_vm_moref(device_id)
|
vm_moref = self._dvs.get_vm_moref(device_id)
|
||||||
if vm_moref is not None:
|
if vm_moref is not None:
|
||||||
try:
|
try:
|
||||||
self.nsx_v.vcns.delete_vm_from_exclude_list(vm_moref)
|
|
||||||
LOG.info(_LI("Remove VM %(dev)s from exclude list on "
|
LOG.info(_LI("Remove VM %(dev)s from exclude list on "
|
||||||
"behalf of port %(port)s: removed from "
|
"behalf of port %(port)s: removed from "
|
||||||
"list"),
|
"list"),
|
||||||
{"dev": device_id, "port": port_id})
|
{"dev": device_id, "port": port_id})
|
||||||
except n_exc.BadRequest:
|
self.nsx_v.vcns.delete_vm_from_exclude_list(vm_moref)
|
||||||
|
except vsh_exc.RequestBad as e:
|
||||||
LOG.error(_LE("Failed to delete vm %(device)s "
|
LOG.error(_LE("Failed to delete vm %(device)s "
|
||||||
"moref %(moref)s from exclusion list"),
|
"moref %(moref)s from exclude list: "
|
||||||
{'device': device_id, 'moref': vm_moref})
|
"%(err)s"),
|
||||||
|
{'device': device_id, 'moref': vm_moref,
|
||||||
|
'err': e})
|
||||||
else:
|
else:
|
||||||
LOG.info(_LI("Remove VM %(dev)s from exclude list on behalf "
|
LOG.info(_LI("Remove VM %(dev)s from exclude list on behalf "
|
||||||
"of port %(port)s: other ports still in list"),
|
"of port %(port)s: other ports still in list"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user