diff --git a/src/tests/ftest/nvme/enospace.py b/src/tests/ftest/nvme/enospace.py index 179f84f43c1e..e1f27e7734fa 100644 --- a/src/tests/ftest/nvme/enospace.py +++ b/src/tests/ftest/nvme/enospace.py @@ -1,5 +1,5 @@ ''' - (C) Copyright 2020-2023 Intel Corporation. + (C) Copyright 2020-2024 Intel Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent ''' @@ -9,7 +9,6 @@ from apricot import skipForTicket from avocado.core.exceptions import TestFail -from daos_utils import DaosCommand from exception_utils import CommandFailure from general_utils import get_display_size, get_errors_count from ior_utils import IorCommand, IorMetrics @@ -39,7 +38,8 @@ def __init__(self, *args, **kwargs): self.pool_usage_min = [] self.test_result = [] - self.daos_cmd = None + + self._created_containers = [] def setUp(self): """Initial setup.""" @@ -51,8 +51,6 @@ def setUp(self): self.pool_usage_min.append(float( self.params.get(elt.casefold(), "/run/pool/usage_min/*", 0))) - # initialize daos command - self.daos_cmd = DaosCommand(self.bin) self.create_pool_max_size() def get_pool_space_metrics(self, pool_uuid): @@ -205,16 +203,18 @@ def verify_enospace_log(self, log_file): def delete_all_containers(self): """Delete all the containers.""" - # List all the container - kwargs = {"pool": self.pool.uuid} - data = self.daos_cmd.container_list(**kwargs) + # Delete tracked containers + for cont in self._created_containers: + cont.destroy() + + # Delete containers from pool list + daos_cmd = self.get_daos_command() + data = daos_cmd.container_list(pool=self.pool.identifier) containers = [uuid_label["uuid"] for uuid_label in data["response"]] # Destroy all the containers for _cont in containers: - kwargs["cont"] = _cont - kwargs["force"] = True - self.daos_cmd.container_destroy(**kwargs) + daos_cmd.container_destroy(pool=self.pool.identifier, cont=_cont, force=True) def verify_background_job(self): """Function to verify that no background jobs have failed during the test.""" @@ -249,6 +249,7 @@ def ior_bg_thread(self, event): # create container container = self.get_container(self.pool) + self._created_containers.append(container) job_manager.job.dfs_cont.update(container.uuid) env = ior_bg_cmd.get_default_env(str(job_manager)) @@ -292,11 +293,13 @@ def run_enospace_foreground(self, log_file): # start to fill up. self.log.info('--Filling 75% of the current SCM free space--') self.start_ior_load(storage='SCM', operation="Auto_Write", percent=75) + self._created_containers.append(self.nvme_local_cont) self.log.info(self.pool.pool_percentage_used()) # Fill 50% of current SCM free space. Aggregation is Enabled so NVMe space will # continue to fill up. self.start_ior_load(storage='SCM', operation="Auto_Write", percent=50) + self._created_containers.append(self.nvme_local_cont) self.log.info(self.pool.pool_percentage_used()) # Fill 60% of current SCM free space. This time, NVMe will be Full so data will @@ -306,6 +309,7 @@ def run_enospace_foreground(self, log_file): try: self.start_ior_load( storage='SCM', operation="Auto_Write", percent=60, log_file=log_file) + self._created_containers.append(self.nvme_local_cont) except TestFail: self.log.info('Test is expected to fail because of DER_NOSPACE') else: @@ -499,6 +503,7 @@ def test_performance_storage_full(self): self.log.info(self.pool.pool_percentage_used()) # Write First self.start_ior_load(storage='SCM', operation="Auto_Write", percent=1) + self._created_containers.append(self.nvme_local_cont) # Read the baseline data set self.start_ior_load(storage='SCM', operation='Auto_Read', percent=1) max_mib_baseline = float(self.ior_matrix[0][int(IorMetrics.MAX_MIB)]) @@ -550,6 +555,7 @@ def test_enospace_no_aggregation(self): self.log.info("-------enospc_no_aggregation Loop--------- %d", _loop) # Fill 75% of SCM pool self.start_ior_load(storage='SCM', operation="Auto_Write", percent=40) + self._created_containers.append(self.nvme_local_cont) self.log.info(self.pool.pool_percentage_used()) @@ -558,6 +564,7 @@ def test_enospace_no_aggregation(self): # Fill 10% more to SCM ,which should Fail because no SCM space self.start_ior_load( storage='SCM', operation="Auto_Write", percent=40, log_file=log_file) + self._created_containers.append(self.nvme_local_cont) except TestFail: self.log.info('Expected to fail because of DER_NOSPACE') else: