Skip to content

Commit

Permalink
DAOS-15774 test: fix nvme/enospace.py container destroy
Browse files Browse the repository at this point in the history
Test-tag: NvmeEnospace
Skip-unit-tests: true
Skip-fault-injection-test: true

Track containers created with start_ior_load and delete them explicitly.

Required-githooks: true

Signed-off-by: Dalton Bohning <[email protected]>
  • Loading branch information
daltonbohning committed Apr 30, 2024
1 parent 6a4c96a commit 9036dc1
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/tests/ftest/nvme/enospace.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'''
(C) Copyright 2020-2023 Intel Corporation.
(C) Copyright 2020-2024 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
'''
Expand All @@ -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
Expand Down Expand Up @@ -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."""
Expand All @@ -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):
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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)])
Expand Down Expand Up @@ -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())

Expand All @@ -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:
Expand Down

0 comments on commit 9036dc1

Please sign in to comment.