Skip to content

Changing pool name to default block pool from custom pools #12037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ocs_ci/helpers/performance_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,16 +658,17 @@ def get_pvc_provision_times(interface, pvc_name, start_time, time_type="all", op
if prov_logs:
for sublog in prov_logs:
for line in sublog:
logger.info(f"sublogg : {line}")
for i in range(0, len(pvc_name)):
name = pvc_name[i].name
pv_name = pvc_name[i].backed_pv
if op in ["all", "create"]:
if re.search(f"provision.*{name}.*started", line):
if re.search(f'Started.*PVC="[^"]*/{re.escape(name)}"', line):
if results[name]["create"]["start"] is None:
results[name]["create"]["start"] = (
extruct_timestamp_from_log(line)
)
if re.search(f"provision.*{name}.*succeeded", line):
if re.search(f'Succeeded.*{re.escape(name)}', line, re.IGNORECASE):
if results[name]["create"]["end"] is None:
results[name]["create"]["end"] = (
extruct_timestamp_from_log(line)
Expand All @@ -678,13 +679,13 @@ def get_pvc_provision_times(interface, pvc_name, start_time, time_type="all", op
)
)
if op in ["all", "delete"]:
if re.search(f'delete "{pv_name}": started', line):
if re.search(f'shouldDelete is true.*PV="{re.escape(pv_name)}"', line):
if results[name]["delete"]["start"] is None:
results[name]["delete"]["start"] = (
extruct_timestamp_from_log(line)
)
if (
re.search(f'delete "{pv_name}": succeeded', line)
re.search(f'deleted succeeded.*PV="{re.escape(pv_name)}"', line)
and (
version.get_semantic_ocs_version_from_config()
<= version.VERSION_4_13
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,60 +129,17 @@ def teardown(self):
Cleanup the test environment
"""
logger.info("Starting the test environment cleanup")
try:
logger.info(f"Deleting the test StorageClass : {self.sc_obj.name}")
self.sc_obj.delete()
logger.info("Wait until the SC is deleted.")
self.sc_obj.ocp.wait_for_delete(resource_name=self.sc_obj.name)
except Exception as ex:
logger.warning(f"Can not delete the test sc : {ex}")
# Delete the test project (namespace)
self.delete_test_project()

logger.info(f"Try to delete the Storage pool {self.pool_name}")
try:
self.delete_ceph_pool(self.pool_name)
except Exception:
pass
finally:
# Verify deletion by checking the backend CEPH pools using the toolbox
if self.interface == constants.CEPHBLOCKPOOL:
results = self.ceph_cluster.toolbox.exec_cmd_on_pod("ceph osd pool ls")
logger.debug(f"Existing pools are : {results}")
if self.pool_name in results.split():
logger.warning(
"The pool did not deleted by CSI, forcing delete it manually"
)
self.ceph_cluster.toolbox.exec_cmd_on_pod(
f"ceph osd pool delete {self.pool_name} {self.pool_name} "
"--yes-i-really-really-mean-it"
)
else:
logger.info(f"The pool {self.pool_name} was deleted successfully")

super(TestPVCClonePerformance, self).teardown()

def create_new_pool_and_sc(self, secret_factory):
self.pool_name = (
f"pas-test-pool-{Interfaces_info[self.interface]['name'].lower()}"
)
secret = secret_factory(interface=self.interface)
self.create_new_pool(self.pool_name)
# Creating new StorageClass (pool) for the test.
self.sc_obj = helpers.create_storage_class(
interface_type=self.interface,
interface_name=self.pool_name,
secret_name=secret.name,
sc_name=self.pool_name,
fs_name=self.pool_name,
)
logger.info(f"The new SC is : {self.sc_obj.name}")

def create_pvc_and_wait_for_bound(self):
logger.info("Creating PVC to be cloned")
try:
self.pvc_obj = helpers.create_pvc(
sc_name=self.sc_obj.name,
sc_name=Interfaces_info[self.interface]["sc"],
pvc_name="pvc-pas-test",
size=f"{self.pvc_size}Gi",
namespace=self.namespace,
Expand Down Expand Up @@ -343,17 +300,16 @@ def test_clone_create_delete_performance(
test_start_time = self.get_time()

# Create new pool and sc only for RBD, for CepgFS use thr default
self.sc_obj = ocs.OCS(
kind="StorageCluster",
metadata={
"namespace": self.namespace,
"name": Interfaces_info[self.interface]["sc"],
},
)
if self.interface == constants.CEPHBLOCKPOOL:
# Creating new pool to run the test on it
self.create_new_pool_and_sc(secret_factory)
self.pool_name = "ocs-storagecluster-cephblockpool"
else:
self.sc_obj = ocs.OCS(
kind="StorageCluster",
metadata={
"namespace": self.namespace,
"name": Interfaces_info[self.interface]["sc"],
},
)
self.pool_name = "ocs-storagecluster-cephfilesystem"
# Create a PVC
self.create_pvc_and_wait_for_bound()
Expand Down Expand Up @@ -464,17 +420,16 @@ def test_pvc_clone_performance_multiple_files(
test_start_time = self.get_time()

# Create new pool and sc only for RBD, for CepgFS use thr default
self.sc_obj = ocs.OCS(
kind="StorageCluster",
metadata={
"namespace": self.namespace,
"name": Interfaces_info[self.interface]["sc"],
},
)
if self.interface == constants.CEPHBLOCKPOOL:
# Creating new pool to run the test on it
self.create_new_pool_and_sc(secret_factory)
self.pool_name = "ocs-storagecluster-cephblockpool"
else:
self.sc_obj = ocs.OCS(
kind="StorageCluster",
metadata={
"namespace": self.namespace,
"name": Interfaces_info[self.interface]["sc"],
},
)
self.pool_name = "ocs-storagecluster-cephfilesystem"
# Create a PVC
self.create_pvc_and_wait_for_bound()
Expand Down
Loading