Merge "[Admin-Util] fix plugin object in nsxv dhcp-binding util"

This commit is contained in:
Jenkins 2016-07-08 08:23:45 +00:00 committed by Gerrit Code Review
commit b571db235f
3 changed files with 14 additions and 15 deletions

View File

@ -19,11 +19,9 @@ import pprint
from vmware_nsx.shell.admin.plugins.common import constants from vmware_nsx.shell.admin.plugins.common import constants
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils import vmware_nsx.shell.admin.plugins.common.utils as admin_utils
import vmware_nsx.shell.admin.plugins.nsxv.resources.utils as utils import vmware_nsx.shell.admin.plugins.nsxv.resources.utils as utils
import vmware_nsx.shell.resources as shell import vmware_nsx.shell.resources as shell
from neutron.callbacks import registry from neutron.callbacks import registry
from neutron.db import db_base_plugin_v2
from vmware_nsx._i18n import _LE, _LI from vmware_nsx._i18n import _LE, _LI
from vmware_nsx.db import nsxv_db from vmware_nsx.db import nsxv_db
@ -105,9 +103,9 @@ def nsx_update_dhcp_edge_binding(resource, event, trigger, **kwargs):
LOG.error(_LE("Need to specify edge-id parameter")) LOG.error(_LE("Need to specify edge-id parameter"))
return return
LOG.info(_LI("Updating NSXv Edge: %s"), edge_id) LOG.info(_LI("Updating NSXv Edge: %s"), edge_id)
# Need to create a NeutronDbPlugin object; so that we are able to # Need to create a plugin object; so that we are able to
# do neutron list-ports. # do neutron list-ports.
plugin = db_base_plugin_v2.NeutronDbPluginV2() plugin = utils.NsxVPluginWrapper()
nsxv_manager = vcns_driver.VcnsDriver( nsxv_manager = vcns_driver.VcnsDriver(
edge_utils.NsxVCallbacks(plugin)) edge_utils.NsxVCallbacks(plugin))
edge_manager = edge_utils.EdgeManager(nsxv_manager, plugin) edge_manager = edge_utils.EdgeManager(nsxv_manager, plugin)

View File

@ -24,7 +24,6 @@ from neutron.db import securitygroups_db
from vmware_nsx.db import db as nsx_db from vmware_nsx.db import db as nsx_db
from vmware_nsx.db import nsx_models from vmware_nsx.db import nsx_models
from vmware_nsx.db import nsxv_models from vmware_nsx.db import nsxv_models
from vmware_nsx import plugin
from vmware_nsx.shell.admin.plugins.common import constants from vmware_nsx.shell.admin.plugins.common import constants
from vmware_nsx.shell.admin.plugins.common import formatters from vmware_nsx.shell.admin.plugins.common import formatters
from vmware_nsx.shell.admin.plugins.common import utils as admin_utils from vmware_nsx.shell.admin.plugins.common import utils as admin_utils
@ -35,14 +34,6 @@ from vmware_nsx.shell import resources as nsxadmin
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
class NsxVPluginWrapper(plugin.NsxVPlugin):
def _start_rpc_listeners(self):
pass
def _validate_config(self):
pass
class NeutronSecurityGroupDB(utils.NeutronDbClient, class NeutronSecurityGroupDB(utils.NeutronDbClient,
securitygroups_db.SecurityGroupDbMixin): securitygroups_db.SecurityGroupDbMixin):
def __init__(self): def __init__(self):
@ -135,7 +126,7 @@ class NsxFirewallAPI(object):
neutron_sg = NeutronSecurityGroupDB() neutron_sg = NeutronSecurityGroupDB()
nsxv_firewall = NsxFirewallAPI() nsxv_firewall = NsxFirewallAPI()
plugin = NsxVPluginWrapper() plugin = utils.NsxVPluginWrapper()
def _log_info(resource, data, attrs=['name', 'id']): def _log_info(resource, data, attrs=['name', 'id']):
@ -253,7 +244,7 @@ def fix_security_groups(resource, event, trigger, **kwargs):
context_ = context.get_admin_context() context_ = context.get_admin_context()
sgs_with_missing_section = _find_missing_sections() sgs_with_missing_section = _find_missing_sections()
sgs_with_missing_nsx_group = _find_missing_security_groups() sgs_with_missing_nsx_group = _find_missing_security_groups()
plugin = NsxVPluginWrapper() plugin = utils.NsxVPluginWrapper()
# If only the fw section is missing then create it. # If only the fw section is missing then create it.
for sg_id in (set(sgs_with_missing_section.keys()) - for sg_id in (set(sgs_with_missing_section.keys()) -
set(sgs_with_missing_nsx_group.keys())): set(sgs_with_missing_nsx_group.keys())):

View File

@ -17,6 +17,8 @@ from oslo_config import cfg
from neutron import context as neutron_context from neutron import context as neutron_context
from neutron.db import common_db_mixin as common_db from neutron.db import common_db_mixin as common_db
from vmware_nsx import plugin
from vmware_nsx.plugins.nsx_v.vshield import vcns from vmware_nsx.plugins.nsx_v.vshield import vcns
@ -33,3 +35,11 @@ class NeutronDbClient(common_db.CommonDbMixin):
def __init__(self): def __init__(self):
super(NeutronDbClient, self) super(NeutronDbClient, self)
self.context = neutron_context.get_admin_context() self.context = neutron_context.get_admin_context()
class NsxVPluginWrapper(plugin.NsxVPlugin):
def _start_rpc_listeners(self):
pass
def _validate_config(self):
pass