浏览代码

OSP-290: Delete security_groups from port if security-group-sync is disabled

Currently security-group for endpoint is a hidden field on CLI, it
only affects test-path, and that's why we did not notice the issue.

Change-Id: I7e06fd0954eb2029859561567fe2b6593625dbb2
changes/62/690762/2
Weifan Fu 7 个月前
父节点
当前提交
c79bdcc3de
共有 2 个文件被更改,包括 15 次插入0 次删除
  1. +6
    -0
      networking_bigswitch/plugins/bigswitch/plugin.py
  2. +9
    -0
      networking_bigswitch/plugins/bigswitch/servermanager.py

+ 6
- 0
networking_bigswitch/plugins/bigswitch/plugin.py 查看文件

@@ -300,7 +300,13 @@ class NeutronRestProxyV2Base(db_base_plugin_v2.NeutronDbPluginV2,
'id': port.get('device_id'),
'mac': port.get('mac_address'),
}

if not cfg.CONF.RESTPROXY.sync_security_groups:
if 'security_groups' in mapped_port:
del mapped_port['security_groups']

ports.append(mapped_port)

flips_n_ports['ports'] = ports

if flips_n_ports:


+ 9
- 0
networking_bigswitch/plugins/bigswitch/servermanager.py 查看文件

@@ -1014,6 +1014,13 @@ class ServerPool(object):

def rest_create_port(self, tenant_id, net_id, port):
resource = ATTACHMENT_PATH % (tenant_id, net_id, port["id"])

# security-group info might be useful for some higher level
# operations, so we modify the json right before sending
if not cfg.CONF.RESTPROXY.sync_security_groups:
if 'security_groups' in port:
del port['security_groups']

data = {"port": port}
device_id = port.get("device_id")
if not port["mac_address"] or not device_id:
@@ -1024,7 +1031,9 @@ class ServerPool(object):
return
data["attachment"] = {"id": device_id,
"mac": port["mac_address"]}

errstr = _("Unable to create remote port: %s")

self.rest_action('PUT', resource, data, errstr)

def rest_delete_port(self, tenant_id, network_id, port_id):


正在加载...
取消
保存