[NSX-v]: Update existing vague exceptions
Use NsxResourceNotFound exception to detail the resource name and resource ID not found on backend. Change-Id: Ib7749380672e54f452b5721da2dd2d92feceb618 Depends-On: Ibba7b4997b89ecabfe5fba162f7b60c3c9a889c8
This commit is contained in:
parent
eda75ec535
commit
511295b8c6
@ -169,4 +169,4 @@ class SecurityGroupMaximumCapacityReached(NsxPluginException):
|
|||||||
|
|
||||||
|
|
||||||
class NsxResourceNotFound(n_exc.NotFound):
|
class NsxResourceNotFound(n_exc.NotFound):
|
||||||
message = _("%(res_name)s %(res_id)s not found on the backend")
|
message = _("%(res_name)s %(res_id)s not found on the backend.")
|
||||||
|
@ -2154,28 +2154,33 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
def _validate_config(self):
|
def _validate_config(self):
|
||||||
if (cfg.CONF.nsxv.dvs_id and
|
if (cfg.CONF.nsxv.dvs_id and
|
||||||
not self.nsx_v.vcns.validate_dvs(cfg.CONF.nsxv.dvs_id)):
|
not self.nsx_v.vcns.validate_dvs(cfg.CONF.nsxv.dvs_id)):
|
||||||
error = _("Configured dvs_id not found")
|
raise nsx_exc.NsxResourceNotFound(
|
||||||
raise nsx_exc.NsxPluginException(err_msg=error)
|
res_name='dvs_id',
|
||||||
|
res_id=cfg.CONF.nsxv.dvs_id)
|
||||||
|
|
||||||
if not self.nsx_v.vcns.validate_datacenter_moid(
|
if not self.nsx_v.vcns.validate_datacenter_moid(
|
||||||
cfg.CONF.nsxv.datacenter_moid):
|
cfg.CONF.nsxv.datacenter_moid):
|
||||||
error = _("Configured datacenter_moid not found")
|
raise nsx_exc.NsxResourceNotFound(
|
||||||
raise nsx_exc.NsxPluginException(err_msg=error)
|
res_name='datacenter_moid',
|
||||||
|
res_id=cfg.CONF.nsxv.datacenter_moid)
|
||||||
|
|
||||||
if not self.nsx_v.vcns.validate_network(
|
if not self.nsx_v.vcns.validate_network(
|
||||||
cfg.CONF.nsxv.external_network):
|
cfg.CONF.nsxv.external_network):
|
||||||
error = _("Configured external_network not found")
|
raise nsx_exc.NsxResourceNotFound(
|
||||||
raise nsx_exc.NsxPluginException(err_msg=error)
|
res_name='external_network',
|
||||||
|
res_id=cfg.CONF.nsxv.external_network)
|
||||||
|
|
||||||
if not self.nsx_v.vcns.validate_vdn_scope(cfg.CONF.nsxv.vdn_scope_id):
|
if not self.nsx_v.vcns.validate_vdn_scope(cfg.CONF.nsxv.vdn_scope_id):
|
||||||
error = _("Configured vdn_scope_id not found")
|
raise nsx_exc.NsxResourceNotFound(
|
||||||
raise nsx_exc.NsxPluginException(err_msg=error)
|
res_name='vdn_scope_id',
|
||||||
|
res_id=cfg.CONF.nsxv.vdn_scope_id)
|
||||||
|
|
||||||
if (cfg.CONF.nsxv.mgt_net_moid
|
if (cfg.CONF.nsxv.mgt_net_moid
|
||||||
and not self.nsx_v.vcns.validate_network(
|
and not self.nsx_v.vcns.validate_network(
|
||||||
cfg.CONF.nsxv.mgt_net_moid)):
|
cfg.CONF.nsxv.mgt_net_moid)):
|
||||||
error = _("Configured mgt_net_moid not found")
|
raise nsx_exc.NsxResourceNotFound(
|
||||||
raise nsx_exc.NsxPluginException(err_msg=error)
|
res_name='mgt_net_moid',
|
||||||
|
res_id=cfg.CONF.nsxv.mgt_net_moid)
|
||||||
|
|
||||||
ver = self.nsx_v.vcns.get_version()
|
ver = self.nsx_v.vcns.get_version()
|
||||||
if version.LooseVersion(ver) < version.LooseVersion('6.2.0'):
|
if version.LooseVersion(ver) < version.LooseVersion('6.2.0'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user