Skip to content

Commit

Permalink
Storage client deployment automation (#9144)
Browse files Browse the repository at this point in the history
This pr contains the code changes for deployment of a provider cluster with ODF and native storage-client

Signed-off-by: Amrita Mahapatra <[email protected]>
  • Loading branch information
amr1ta authored Jun 11, 2024
1 parent 0cf9813 commit 4cd7593
Show file tree
Hide file tree
Showing 27 changed files with 1,402 additions and 41 deletions.
3 changes: 3 additions & 0 deletions conf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ higher priority).
* `hosted_odf_registry` - registry for hosted ODF
* `hosted_odf_version` - version of ODF to be deployed on hosted clusters
* `wait_timeout_for_healthy_osd_in_minutes` - timeout waiting for healthy OSDs before continuing upgrade (see https://bugzilla.redhat.com/show_bug.cgi?id=2276694 for more details)
* `odf_provider_mode_deployment` - True if you would like to enable provider mode deployment.
* `client_subcription_image` - ODF subscription image details for the storageclients.
* `channel_to_client_subscription` - Channel value for the odf subscription image for storageclients.

#### UPGRADE

Expand Down
2 changes: 1 addition & 1 deletion conf/deployment/vsphere/ai_1az_rhcos_vsan_3m_3w.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ ENV_DATA:
worker_num_cpus: '16'
master_memory: '16384'
compute_memory: '65536'
extra_disks: 2
extra_disks: 4
fio_storageutilization_min_mbps: 10.0
28 changes: 19 additions & 9 deletions ocs_ci/deployment/baremetal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ def destroy_cluster(self, log_level="DEBUG"):


@retry(exceptions.CommandFailed, tries=10, delay=30, backoff=1)
def clean_disk(worker):
def clean_disk(worker, namespace=constants.DEFAULT_NAMESPACE):
"""
Perform disk cleanup
Expand All @@ -1262,41 +1262,51 @@ def clean_disk(worker):
ocp_obj = ocp.OCP()
cmd = """lsblk --all --noheadings --output "KNAME,PKNAME,TYPE,MOUNTPOINT" --json"""
out = ocp_obj.exec_oc_debug_cmd(
node=worker.name, cmd_list=[cmd], namespace=constants.BM_DEBUG_NODE_NS
node=worker.name, cmd_list=[cmd], namespace=namespace
)
disk_to_ignore_cleanup_raw = json.loads(str(out))
disk_to_ignore_cleanup_json = disk_to_ignore_cleanup_raw["blockdevices"]
selected_disks_to_ignore_cleanup = []
for disk_to_ignore_cleanup in disk_to_ignore_cleanup_json:
if disk_to_ignore_cleanup["mountpoint"] == "/boot":
logger.info(
f"Ignorning disk {disk_to_ignore_cleanup['pkname']} for cleanup because it's a root disk "
)
selected_disk_to_ignore_cleanup = disk_to_ignore_cleanup["pkname"]
# Adding break when root disk is found
break
selected_disks_to_ignore_cleanup.append(
str(disk_to_ignore_cleanup["pkname"])
)
elif disk_to_ignore_cleanup["type"] == "rom":
logger.info(
f"Ignorning disk {disk_to_ignore_cleanup['kname']} for cleanup because it's a rom disk "
)
selected_disks_to_ignore_cleanup.append(
str(disk_to_ignore_cleanup["kname"])
)

out = ocp_obj.exec_oc_debug_cmd(
node=worker.name,
cmd_list=["lsblk -nd -e252,7 --output NAME --json"],
namespace=constants.BM_DEBUG_NODE_NS,
namespace=namespace,
)
lsblk_output = json.loads(str(out))
lsblk_devices = lsblk_output["blockdevices"]

for lsblk_device in lsblk_devices:
if lsblk_device["name"] == str(selected_disk_to_ignore_cleanup):
if lsblk_device["name"] in selected_disks_to_ignore_cleanup:
logger.info(f'the disk cleanup is ignored for, {lsblk_device["name"]}')
pass
else:
logger.info(f"Cleaning up {lsblk_device['name']}")
out = ocp_obj.exec_oc_debug_cmd(
node=worker.name,
cmd_list=[f"wipefs -a -f /dev/{lsblk_device['name']}"],
namespace=constants.BM_DEBUG_NODE_NS,
namespace=namespace,
)
logger.info(out)
out = ocp_obj.exec_oc_debug_cmd(
node=worker.name,
cmd_list=[f"sgdisk --zap-all /dev/{lsblk_device['name']}"],
namespace=constants.BM_DEBUG_NODE_NS,
namespace=namespace,
)
logger.info(out)

Expand Down
25 changes: 25 additions & 0 deletions ocs_ci/deployment/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
from ocs_ci.utility.ibmcloud import run_ibmcloud_cmd
from ocs_ci.deployment.cnv import CNVInstaller


logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -356,6 +357,11 @@ def do_deploy_ocs(self):
Deploy OCS/ODF and run verification as well
"""
if config.ENV_DATA.get("odf_provider_mode_deployment", False):
logger.warning(
"Skipping normal ODF deployment because ODF deployment in Provider mode will be performed"
)
return
if not config.ENV_DATA["skip_ocs_deployment"]:
for i in range(config.nclusters):
if config.multicluster and (i in get_all_acm_indexes()):
Expand Down Expand Up @@ -579,6 +585,24 @@ def do_deploy_fusion(self):
)
time.sleep(30)

def do_deploy_odf_provider_mode(self):
"""
Deploy ODF in provider mode and setup native client
"""
# deploy provider-client deployment
from ocs_ci.deployment.provider_client.storage_client_deployment import (
ODFAndNativeStorageClientDeploymentOnProvider,
)

storage_client_deployment_obj = ODFAndNativeStorageClientDeploymentOnProvider()

# Provider-client deployment if odf_provider_mode_deployment: True
if (
config.ENV_DATA.get("odf_provider_mode_deployment", False)
and not config.ENV_DATA["skip_ocs_deployment"]
):
storage_client_deployment_obj.provider_and_native_client_installation()

def deploy_cluster(self, log_cli_level="DEBUG"):
"""
We are handling both OCP and OCS deployment here based on flags
Expand Down Expand Up @@ -641,6 +665,7 @@ def deploy_cluster(self, log_cli_level="DEBUG"):
self.do_deploy_oadp()
self.do_deploy_rdr()
self.do_deploy_fusion()
self.do_deploy_odf_provider_mode()
if config.DEPLOYMENT.get("cnv_deployment"):
CNVInstaller().deploy_cnv()
if config.ENV_DATA.get("clusters"):
Expand Down
Loading

0 comments on commit 4cd7593

Please sign in to comment.