NSX|TV: validate plugin is available
When admin creates plugin mapping validate that it is available. Change-Id: If41dc891e8f9a484b85d00d9fff2f7fa3a6f376c
This commit is contained in:
parent
2859a235e6
commit
b336b8cc03
@ -115,6 +115,10 @@ class ProjectPluginIllegalId(nexception.Conflict):
|
||||
message = _("Project ID %(project_id)s is illegal.")
|
||||
|
||||
|
||||
class ProjectPluginNotAvailable(nexception.NotAuthorized):
|
||||
message = _("Plugin %(plugin)s is not available.")
|
||||
|
||||
|
||||
class ProjectPluginMapPluginBase(object):
|
||||
|
||||
@abc.abstractmethod
|
||||
|
@ -756,6 +756,10 @@ class NsxTVDPlugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
||||
if not uuidutils.is_uuid_like(data['project']):
|
||||
raise projectpluginmap.ProjectPluginIllegalId(
|
||||
project_id=data['project'])
|
||||
# 4. Check that plugin is available
|
||||
if data['plugin'] not in self.plugins:
|
||||
raise projectpluginmap.ProjectPluginNotAvailable(
|
||||
plugin=data['plugin'])
|
||||
|
||||
# Add the entry to the DB and return it
|
||||
LOG.info("Adding mapping between project %(project)s and plugin "
|
||||
|
Loading…
Reference in New Issue
Block a user