Skip to content

Instantly share code, notes, and snippets.

@otherwiseguy
Last active April 27, 2017 19:38
Show Gist options
  • Save otherwiseguy/17749ba7d749cc088afb44a5371737bf to your computer and use it in GitHub Desktop.
Save otherwiseguy/17749ba7d749cc088afb44a5371737bf to your computer and use it in GitHub Desktop.
diff --git a/neutron/agent/common/ovs_lib.py b/neutron/agent/common/ovs_lib.py
index f96e31c..aee88d6 100644
--- a/neutron/agent/common/ovs_lib.py
+++ b/neutron/agent/common/ovs_lib.py
@@ -87,12 +87,13 @@ def _ovsdb_retry(fn):
class VifPort(object):
- def __init__(self, port_name, ofport, vif_id, vif_mac, switch):
+ def __init__(self, port_name, ofport, vif_id, vif_mac, switch, other=None):
self.port_name = port_name
self.ofport = ofport
self.vif_id = vif_id
self.vif_mac = vif_mac
self.switch = switch
+ self.other_config = other or {}
def __str__(self):
return ("iface-id=%s, vif_mac=%s, port_name=%s, ofport=%s, "
@@ -458,7 +459,8 @@ class OVSBridge(BaseOVS):
def get_vif_ports(self, ofport_filter=None):
edge_ports = []
port_info = self.get_ports_attributes(
- 'Interface', columns=['name', 'external_ids', 'ofport'],
+ 'Interface', columns=['name', 'external_ids', 'ofport',
+ 'other_config'],
if_exists=True)
for port in port_info:
name = port['name']
@@ -468,7 +470,8 @@ class OVSBridge(BaseOVS):
continue
if "iface-id" in external_ids and "attached-mac" in external_ids:
p = VifPort(name, ofport, external_ids["iface-id"],
- external_ids["attached-mac"], self)
+ external_ids["attached-mac"], self,
+ port['other_config'])
edge_ports.append(p)
return edge_ports
diff --git a/neutron/cmd/ovs_cleanup.py b/neutron/cmd/ovs_cleanup.py
index 34c1887..2ca11fe 100644
--- a/neutron/cmd/ovs_cleanup.py
+++ b/neutron/cmd/ovs_cleanup.py
@@ -49,7 +49,8 @@ def collect_neutron_ports(bridges):
ports = []
for bridge in bridges:
ovs = ovs_lib.OVSBridge(bridge)
- ports += [port.port_name for port in ovs.get_vif_ports()]
+ ports += [port.port_name for port in ovs.get_vif_ports()
+ if not port.other_config.has_key('skip_cleanup')]
return ports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment