NSX|P: Remove illegal characters from segment name
Change-Id: I597f3410fb71d7421d25cc9f973afc1ca76104bc
This commit is contained in:
parent
813112839a
commit
123238d513
|
@ -13,6 +13,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
|
@ -596,8 +597,13 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
|
||||||
self.endpoints = [agents_db.AgentExtRpcCallback()]
|
self.endpoints = [agents_db.AgentExtRpcCallback()]
|
||||||
|
|
||||||
def _net_nsx_name(self, network):
|
def _net_nsx_name(self, network):
|
||||||
return utils.get_name_and_uuid(network['name'] or 'network',
|
name = utils.get_name_and_uuid(network.get('name') or 'network',
|
||||||
network['id'])
|
network['id'])
|
||||||
|
LOG.error("DEBUG ADIT orig name = %s", name)
|
||||||
|
# remove illegal characters in segment names: ;|=,~@'
|
||||||
|
name = re.sub("[;|=,~@\']", '', name)
|
||||||
|
LOG.error("DEBUG ADIT fixed name = %s", name)
|
||||||
|
return name
|
||||||
|
|
||||||
def _create_network_on_backend(self, context, net_data,
|
def _create_network_on_backend(self, context, net_data,
|
||||||
transparent_vlan, provider_data, az,
|
transparent_vlan, provider_data, az,
|
||||||
|
@ -919,9 +925,7 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
|
||||||
if (not extern_net and not is_nsx_net and
|
if (not extern_net and not is_nsx_net and
|
||||||
('name' in net_data or 'description' in net_data or
|
('name' in net_data or 'description' in net_data or
|
||||||
'admin_state_up' in net_data)):
|
'admin_state_up' in net_data)):
|
||||||
net_name = utils.get_name_and_uuid(
|
net_name = self._net_nsx_name(updated_net)
|
||||||
updated_net['name'] or 'network', network_id)
|
|
||||||
|
|
||||||
kwargs = {'name': net_name,
|
kwargs = {'name': net_name,
|
||||||
'description': updated_net.get('description', '')}
|
'description': updated_net.get('description', '')}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue