From 7074eee6a06c569f40f9f8d1b72eea5de17bd5a1 Mon Sep 17 00:00:00 2001 From: Daniel Caires Date: Wed, 6 Dec 2023 13:44:26 -0300 Subject: [PATCH] Implment controller storage config Implementation of the function that configures the OSDs in controller-0 and controller-1 Test Plan: PASS - OSDs are configured in both controllers in the STANDARD installation. Story: 2005051 Task: 49185 Change-Id: If0c5ef02da705165bc01f7db2236e8bf727eefb8 Signed-off-by: Daniel Caires --- virtualbox/pybox/install_vbox.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/virtualbox/pybox/install_vbox.py b/virtualbox/pybox/install_vbox.py index 4ce8432..b10e130 100755 --- a/virtualbox/pybox/install_vbox.py +++ b/virtualbox/pybox/install_vbox.py @@ -1706,14 +1706,30 @@ def stage_setup_controller_storage(ssh_client): """Provision controller storage""" try: - # Add controller storage setup here LOG.info("#### Provision controller storage") - commands = [ - 'echo "TODO";', - ] - run_ssh_cmd_list(ssh_client, - commands, - timeout=HostTimeout.NORMAL_OP) + controllers = list(get_hostnames(personalities= + ['controller']).values()) + osd = "/dev/sdb" + for controller in controllers: + + commands = [ + f'DISKS=$(system host-disk-list {controller});' + f'TIERS=$(system storage-tier-list ceph_cluster);' + f"""UUID=$(echo "$DISKS" | grep "{osd}" | awk '{{print $2}}')""" + r"TIER_UUID=$(echo $TIERS | grep storage | awk '{print $2}');" + f'system host-stor-add {controller} $UUID --tier-uuid $TIER_UUID' + f'while true; do ' + f' system host-stor-list {controller} | grep {osd} | grep configuring; ' + f"if [ $? -ne 0 ]; " + f"then break; " + f"fi; " + f"sleep 1; " + f"done", + f"system host-stor-list {controller}" + ] + run_ssh_cmd_list(ssh_client, + commands, + timeout=HostTimeout.NORMAL_OP) except: LOG.error("Failed stage: %s", STG_SETUP_CTRL_STORAGE) raise