From 430049e0a44f254688ef86b48be91b3b89091eb7 Mon Sep 17 00:00:00 2001 From: Lucas Borges Date: Wed, 5 Apr 2023 13:05:43 -0300 Subject: [PATCH] Fix hw_settle and disk update during upgrade This update addresses an issue with the hw_settle and disk update during an upgrade. Previously, the hw_settle parameter was only being updated for controllers, this fix extends the update to all hosts. This change the prefix on wwn-* paths. The default for ISCSI devices is 3, for virtualized envs like QEMU might not start with 3. Test plan: PASS: Upgrade Standard 2+2+2 with multipath (QEMU) closes-bug: 2015374 Signed-off-by: Lucas Borges Change-Id: I51bf78d7add37de7120adeb61c2e922b4a7a23fd --- .../09-adjust-debian-multipath-disks-support.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/controllerconfig/controllerconfig/upgrade-scripts/09-adjust-debian-multipath-disks-support.py b/controllerconfig/controllerconfig/upgrade-scripts/09-adjust-debian-multipath-disks-support.py index d17e87b0a4..a7d75edbe7 100755 --- a/controllerconfig/controllerconfig/upgrade-scripts/09-adjust-debian-multipath-disks-support.py +++ b/controllerconfig/controllerconfig/upgrade-scripts/09-adjust-debian-multipath-disks-support.py @@ -51,6 +51,7 @@ def main(): do_update_i_idisks(conn) do_update_partitions(conn) do_update_i_pv(conn) + do_update_hw_settle(conn) except Exception as e: LOG.exception("Error: {}".format(e)) res = 1 @@ -134,7 +135,7 @@ def do_update_i_host(conn): for i_host in i_hosts: query = ( "UPDATE i_host SET boot_device='/dev/mapper/mpatha', " - "rootfs_device='/dev/mapper/mpatha', hw_settle='30' " + "rootfs_device='/dev/mapper/mpatha' " "WHERE id={};".format( i_host["id"] ) @@ -188,6 +189,12 @@ def do_update_query(conn, query): conn.commit() +def do_update_hw_settle(conn): + query = "UPDATE i_host SET hw_settle='30'; " + LOG.info("Update hw_settle query= {}".format(query)) + do_update_query(conn, query) + + def is_multipath(): disk_operator = disk.DiskOperator() system_disk = disk_operator.idisk_get()[0] @@ -205,7 +212,9 @@ def transform_device_node_path(path): def transform_device_path(path): - regex = r"(\/dev\/disk\/by-id\/)dm-uuid-mpath-3(.*)" + # This regex is used to support QEMU virtualization devices, + # while all other real iSCSI devices start with 0 + regex = r"(\/dev\/disk\/by-id\/)dm-uuid-mpath-[0-9](.*)" result = re.match(regex, path) if result: return "{}wwn-0x{}".format(result[1], result[2]) @@ -213,7 +222,9 @@ def transform_device_path(path): def transform_part_device_path(path): - regex = r"(\/dev\/disk\/by-id\/)dm-uuid-(.*)-mpath-3(.*)" + # This regex is used to support QEMU virtualization devices, + # while all other real iSCSI devices start with 0 + regex = r"(\/dev\/disk\/by-id\/)dm-uuid-(.*)-mpath-[0-9](.*)" result = re.match(regex, path) if result: return "{}wwn-0x{}-{}".format(result[1], result[3], result[2])