Revert "After tempest network resource do not be cleared"

This reverts commit 264a6029db.
We use pre-provisioned OpenStack projects (accounts, users and networks)
to run multi-tenancy tests against the DHSS=True drivers. When using
the NeutronNetworkPlugin (or its derivatives),
share servers are not expected to be deleted by the tests. This
assumption breaks the cleanup committed in 264a6029db.

We ought to clean up share servers that get created as part of test runs
because we clean up all the shares. The default option to teardown
"unused" share servers [1] currently takes care of freeing up
share servers after the tests have run.

If network resources pertain to pre-provisioned
projects, no cleanup should be done by manila's tempest tests; since
they are meant to be administered by the test runner (human/automation).

[1] https://docs.openstack.org/manila/latest/configuration/shared-file-systems/config-options.html 

Related-Bug: #1755467
Change-Id: I004d88e4e2ccf5a0e1dbaaedc7195f5a8e427559
This commit is contained in:
Goutham Pacha Ravi 2018-06-14 21:34:09 +00:00
parent 3a9792faab
commit d1f6a062b6
1 changed files with 0 additions and 76 deletions

View File

@ -26,7 +26,6 @@ from tempest.common import credentials_factory as common_creds
from tempest import config
from tempest.lib.common import dynamic_creds
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions
from tempest import test
@ -127,9 +126,6 @@ class BaseSharesTest(test.BaseTestCase):
# Will be cleaned up in resource_cleanup
class_resources = []
# Will be cleaned up in clear_net_resources
class_net_resources = []
# Will be cleaned up in tearDown method
method_resources = []
@ -314,14 +310,12 @@ class BaseSharesTest(test.BaseTestCase):
super(BaseSharesTest, self).setUp()
self.addCleanup(self.clear_isolated_creds)
self.addCleanup(self.clear_resources)
self.addCleanup(self.clear_net_resources)
verify_test_has_appropriate_tags(self)
@classmethod
def resource_cleanup(cls):
cls.clear_resources(cls.class_resources)
cls.clear_isolated_creds(cls.class_isolated_creds)
cls.clear_net_resources(cls.class_net_resources)
super(BaseSharesTest, cls).resource_cleanup()
@classmethod
@ -399,24 +393,6 @@ class BaseSharesTest(test.BaseTestCase):
network, subnet, router = net_data
net_id = network["id"]
subnet_id = subnet["id"]
network_res = {
"type": "network",
"resource": network,
"client": ic,
}
subnet_res = {
"type": "subnet",
"resource": subnet,
"client": ic,
}
router_res = {
"type": "router",
"resource": router,
"client": ic,
}
cls.class_net_resources.insert(0, network_res)
cls.class_net_resources.insert(0, subnet_res)
cls.class_net_resources.insert(0, router_res)
# Try get suitable share-network
share_networks = sc.list_share_networks_with_detail()
@ -445,58 +421,6 @@ class BaseSharesTest(test.BaseTestCase):
return share_network_id
@classmethod
def clear_net_resources(cls, resources=None):
if resources is None:
resources = cls.class_net_resources
for res in resources:
if "deleted" not in res.keys():
res["deleted"] = False
if not (res["deleted"]):
if res["type"] is "router":
cls.clear_router(res['client'], res['resource'])
elif res["type"] is "subnet":
cls.clear_subnet(res['client'], res['resource'])
elif res["type"] is "network":
cls.clear_network(res['client'], res['resource'])
else:
LOG.warning("Provided unsupported resource type for "
"cleanup '%s'. Skipping." % res["type"])
res["deleted"] = True
@classmethod
def clear_router(cls, ic, router):
body = ic.ports_admin_client.list_ports(device_id=router['id'])
interfaces = body['ports']
for i in interfaces:
test_utils.call_and_ignore_notfound_exc(
ic.routers_admin_client.remove_router_interface, router['id'],
subnet_id=i['fixed_ips'][0]['subnet_id'])
try:
ic.routers_admin_client.delete_router(router['id'])
except exceptions.NotFound:
LOG.warning('router with name: %s not found for delete' %
router['name'])
@classmethod
def clear_subnet(cls, ic, subnet):
client = ic.subnets_admin_client
try:
client.delete_subnet(subnet['id'])
except exceptions.NotFound:
LOG.warning('subnet with name: %s not found for delete' %
subnet['name'])
@classmethod
def clear_network(cls, ic, network):
net_client = ic.networks_admin_client
try:
net_client.delete_network(network['id'])
except exceptions.NotFound:
LOG.warning('network with name: %s not found for delete' %
network['name'])
@classmethod
def _create_share(cls, share_protocol=None, size=None, name=None,
snapshot_id=None, description=None, metadata=None,