NSX|V: Fix portgroup provider network validation
In case the physical network is not assigned, the db query should be skipped or else it fails and raise. Change-Id: Ief5af76f47e6b037e5fdda707f7fa75f73b0653f
This commit is contained in:
parent
dcc896fc66
commit
f1010b01ef
|
@ -816,14 +816,15 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||
physical_network, network['name'])):
|
||||
err_msg = _("Portgroup name must match network name")
|
||||
|
||||
# make sure no other neutron network is using it
|
||||
bindings = (
|
||||
nsxv_db.get_network_bindings_by_physical_net_and_type(
|
||||
context.elevated().session, physical_network,
|
||||
network_type))
|
||||
if bindings:
|
||||
err_msg = (_('protgroup %s is already used by '
|
||||
'another network') % physical_network)
|
||||
if not err_msg:
|
||||
# make sure no other neutron network is using it
|
||||
bindings = (
|
||||
nsxv_db.get_network_bindings_by_physical_net_and_type(
|
||||
context.elevated().session, physical_network,
|
||||
network_type))
|
||||
if bindings:
|
||||
err_msg = (_('protgroup %s is already used by '
|
||||
'another network') % physical_network)
|
||||
else:
|
||||
err_msg = (_("%(net_type_param)s %(net_type_value)s not "
|
||||
"supported") %
|
||||
|
|
Loading…
Reference in New Issue