NSX|V3: pass 'nsx-logical-switch-id' as part of the port details
At the moment the Neutron network UUID is the same as the NSX logical switch ID. This has a number of problems: 1. When we create a network we have two back end calls 2. We do not have a upgrade path from MH -> V3 We can only change the way in which we work when we have the code in Nova changed so that the VC driver attaches to the correct switch. At the moment that only works if the network UUID is the same as the NSX one. This patch will enable us to do that. Change-Id: Iea09105912f2a8d8766f02e71b45163e233a0eac
This commit is contained in:
parent
e0dd32af0c
commit
2f86e5be08
@ -134,12 +134,6 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
|
||||
nsx_client._set_default_api_cluster(self._api_cluster)
|
||||
|
||||
self.cfg_group = 'nsx_v3' # group name for nsx_v3 section in nsx.ini
|
||||
self.base_binding_dict = {
|
||||
pbin.VIF_TYPE: pbin.VIF_TYPE_OVS,
|
||||
pbin.VIF_DETAILS: {
|
||||
# TODO(rkukura): Replace with new VIF security details
|
||||
pbin.CAP_PORT_FILTER:
|
||||
'security-group' in self.supported_extension_aliases}}
|
||||
self.tier0_groups_dict = {}
|
||||
self._setup_dhcp()
|
||||
self._start_rpc_notifiers()
|
||||
@ -176,6 +170,23 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
|
||||
raise nsx_exc.NsxPluginException(msg)
|
||||
self._unsubscribe_callback_events()
|
||||
|
||||
def _extend_port_dict_binding(self, port_res, port_db):
|
||||
port_res[pbin.VIF_TYPE] = pbin.VIF_TYPE_OVS
|
||||
port_res[pbin.VNIC_TYPE] = pbin.VNIC_NORMAL
|
||||
port_res[pbin.VIF_DETAILS] = {
|
||||
# TODO(rkukura): Replace with new VIF security details
|
||||
pbin.CAP_PORT_FILTER:
|
||||
'security-group' in self.supported_extension_aliases,
|
||||
# TODO(garyk): at the moment the neutron network UUID
|
||||
# is the same as the NSX logical switch ID. When nova
|
||||
# supports the code below we can switch to pass the NSX
|
||||
# logical switch ID
|
||||
'nsx-logical-switch-id': port_res['network_id']}
|
||||
|
||||
# Register the hook to extend the port data
|
||||
db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs(
|
||||
attributes.PORTS, ['_extend_port_dict_binding'])
|
||||
|
||||
def _unsubscribe_callback_events(self):
|
||||
# l3_db explicitly subscribes to the port delete callback. This
|
||||
# callback is unsubscribed here since l3 APIs are handled by
|
||||
@ -827,11 +838,6 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
|
||||
self._process_port_create_extra_dhcp_opts(
|
||||
context, port_data, dhcp_opts)
|
||||
|
||||
# For some reason the port bindings DB mixin does not handle
|
||||
# the VNIC_TYPE attribute, which is required by nova for
|
||||
# setting up VIFs.
|
||||
port_data[pbin.VNIC_TYPE] = pbin.VNIC_NORMAL
|
||||
|
||||
sgids = self._get_security_groups_on_port(context, port)
|
||||
self._process_port_create_security_group(
|
||||
context, port_data, sgids)
|
||||
@ -1686,10 +1692,6 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
|
||||
super(NsxV3Plugin, self).disassociate_floatingips(
|
||||
context, port_id, do_notify=False)
|
||||
|
||||
def extend_port_dict_binding(self, port_res, port_db):
|
||||
super(NsxV3Plugin, self).extend_port_dict_binding(port_res, port_db)
|
||||
port_res[pbin.VNIC_TYPE] = pbin.VNIC_NORMAL
|
||||
|
||||
def create_security_group(self, context, security_group, default_sg=False):
|
||||
secgroup = security_group['security_group']
|
||||
secgroup['id'] = uuidutils.generate_uuid()
|
||||
|
Loading…
x
Reference in New Issue
Block a user