Make purge supports dvr router's interface
In DVR mode, port's 'device_owner' is 'network:router_interface_distributed' if one router attachs some subnets. This patch makes 'purge' command support clean router's dvr interface. Closes-bug: #1580432 Change-Id: I2d45e297ac11305ae7b065fd5450580f0c2aefed
This commit is contained in:
parent
32f4433e1e
commit
ea0dfb12a8
@ -49,7 +49,9 @@ class Purge(neutronV20.NeutronCommand):
|
||||
def _delete_resource(self, neutron_client, resource_type, resource):
|
||||
resource_id = resource['id']
|
||||
if resource_type == 'port':
|
||||
if resource.get('device_owner', '') == 'network:router_interface':
|
||||
router_interface_owners = ['network:router_interface',
|
||||
'network:router_interface_distributed']
|
||||
if resource.get('device_owner', '') in router_interface_owners:
|
||||
body = {'port_id': resource_id}
|
||||
neutron_client.remove_interface_router(resource['device_id'],
|
||||
body)
|
||||
|
@ -116,6 +116,8 @@ class PurgeNeutronClientCLITest(base.ClientTestBase):
|
||||
def _verify_deletion(self, resources, resource_type):
|
||||
purged = True
|
||||
no_purge_purged = True
|
||||
router_interface_owners = ['network:router_interface',
|
||||
'network:router_interface_distributed']
|
||||
for row in resources:
|
||||
if resource_type == 'port' and row.get('id', None):
|
||||
port = self.parser.listing(self.neutron('port-show',
|
||||
@ -123,7 +125,7 @@ class PurgeNeutronClientCLITest(base.ClientTestBase):
|
||||
port_dict = {}
|
||||
for row in port:
|
||||
port_dict[row['Field']] = row['Value']
|
||||
if port_dict['device_owner'] == 'network:router_interface':
|
||||
if port_dict['device_owner'] in router_interface_owners:
|
||||
if port_dict['tenant_id'] == 'purge-tenant':
|
||||
purged = False
|
||||
elif port_dict['tenant_id'] == 'no-purge-tenant':
|
||||
|
Loading…
Reference in New Issue
Block a user