Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:chajain:branches:Cloud:Openstack:Master
openstack-tempest
0003-Add-NetworkSubnetPools-to-tempest-cleanup....
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-Add-NetworkSubnetPools-to-tempest-cleanup.patch of Package openstack-tempest
From 765a021ccebac5071acda6060ef1d49b149b4fbc Mon Sep 17 00:00:00 2001 From: Martin Kopec <mkopec@redhat.com> Date: Mon, 18 Feb 2019 12:34:52 +0000 Subject: [PATCH 3/3] Add NetworkSubnetPools to tempest cleanup The review adds support for NetworkSubnetPools service, so if there are leftover subnet pools, tempest cleanup is able to detect them and remove eventually. Change-Id: Ieecde490d5eb20e1a894a7bdf3bcf0e7a54c08e2 Related-Bug: #1812660 --- tempest/cmd/cleanup_service.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py index baff4e034..ed172d2b0 100644 --- a/tempest/cmd/cleanup_service.py +++ b/tempest/cmd/cleanup_service.py @@ -362,6 +362,7 @@ class BaseNetworkService(BaseService): self.metering_label_rules_client = manager.metering_label_rules_client self.security_groups_client = manager.security_groups_client self.routers_client = manager.routers_client + self.subnetpools_client = manager.subnetpools_client def _filter_by_conf_networks(self, item_list): if not item_list or not all(('network_id' in i for i in item_list)): @@ -673,6 +674,41 @@ class NetworkSubnetService(BaseNetworkService): self.data['subnets'][subnet['id']] = subnet['name'] +class NetworkSubnetPoolsService(BaseNetworkService): + + def list(self): + client = self.subnetpools_client + pools = client.list_subnetpools(**self.tenant_filter)['subnetpools'] + if not self.is_save_state: + # recreate list removing saved subnet pools + pools = [pool for pool in pools if pool['id'] + not in self.saved_state_json['subnetpools'].keys()] + if self.is_preserve: + pools = [pool for pool in pools if pool['project_id'] + not in CONF_PROJECTS] + LOG.debug("List count, %s Subnet Pools", len(pools)) + return pools + + def delete(self): + client = self.subnetpools_client + pools = self.list() + for pool in pools: + try: + client.delete_subnetpool(pool['id']) + except Exception: + LOG.exception("Delete Subnet Pool exception.") + + def dry_run(self): + pools = self.list() + self.data['subnetpools'] = pools + + def save_state(self): + pools = self.list() + self.data['subnetpools'] = {} + for pool in pools: + self.data['subnetpools'][pool['id']] = pool['name'] + + # begin global services class FlavorService(BaseService): def __init__(self, manager, **kwargs): @@ -931,6 +967,7 @@ def get_project_cleanup_services(): project_services.append(NetworkSubnetService) project_services.append(NetworkService) project_services.append(NetworkSecGroupService) + project_services.append(NetworkSubnetPoolsService) if IS_CINDER: project_services.append(SnapshotService) project_services.append(VolumeService) -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor