From 3bd3ebeadbef322db0e2851a375ee8949d6b769e Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Tue, 3 Nov 2026 16:51:59 +0100 Subject: [PATCH 1/3] Install recaptured images of LVM installed nodes to disk image2disk.py puts the volumes of a node it installs into the volume group localstorage. Capturing such a node and installing the profile to disk again failed with 'No mapping defined to create volume group localstorage': volumes named localstorage-root were taken for volumes of an extra volume group that needs volumegroupmap.yml. Treat volumes of a volume group named like the target one as main volume group volumes, and split device mapper names into volume group and logical volume names correctly, including hyphens that device mapper doubles inside either name. --- .../profiles/default/scripts/image2disk.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py b/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py index a0e22247..abf3a86d 100644 --- a/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py +++ b/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py @@ -20,6 +20,12 @@ bootuuid = None vgname = 'localstorage' oldvgname = None +def split_mapper_name(devname): + # device mapper joins VG and LV name with a hyphen and doubles hyphens + # inside either name + names = re.split(r'(? Date: Tue, 3 Nov 2026 17:17:31 +0100 Subject: [PATCH 2/3] Check for the localstorage volume group first The guess for volume groups named by the OS installer (_) matched any device mapper name with an underscore followed later by a hyphen. A localstorage volume for a mount point with a hyphen, such as localstorage-_srv_my--data, was taken for one and got a broken volume group name. Recognize volumes of the target volume group before trying that guess. --- .../el9-diskless/profiles/default/scripts/image2disk.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py b/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py index abf3a86d..eaeeffaa 100644 --- a/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py +++ b/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py @@ -409,13 +409,17 @@ def install_to_disk(imgpath): if fs['device'].startswith('/dev/mapper'): odevname = fs['device'].rsplit('/', 1)[-1] + if split_mapper_name(odevname)[0] == vgname: + # already in the volume group the install creates, as when + # recapturing a node that was installed this way + pass # if node has - then /dev/mapper will double up the hypen - if '_' in odevname and '-' in odevname.split('_', 1)[-1]: + elif '_' in odevname and '-' in odevname.split('_', 1)[-1]: oldvgname = odevname.rsplit('-', 1)[0].replace('--', '-') osname = oldvgname.split('_')[0] nodename = socket.gethostname().split('.')[0] vgname = '{}_{}'.format(osname, nodename) - elif '-' in odevname and split_mapper_name(odevname)[0] != vgname: # unique one + elif '-' in odevname: # unique one vgmap[odevname] = split_mapper_name(odevname)[0] lvmvols[odevname] = fs From 244f75b0b2237415500b5b3974c8e0b0981e6485 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Tue, 3 Nov 2026 22:03:31 +0100 Subject: [PATCH 3/3] Pass maxsplit to re.split as a keyword ruff B034 flags the positional maxsplit argument. --- .../el9-diskless/profiles/default/scripts/image2disk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py b/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py index eaeeffaa..2ddb7c73 100644 --- a/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py +++ b/confluent_osdeploy/el9-diskless/profiles/default/scripts/image2disk.py @@ -23,7 +23,7 @@ oldvgname = None def split_mapper_name(devname): # device mapper joins VG and LV name with a hyphen and doubles hyphens # inside either name - names = re.split(r'(?