diskimage-builder/diskimage_builder
mcreach ff5c11c095 Fix growvols multipath partition_delimiter detect
On nodes with Fiber Channel multipath, the growvols command is
failing sometimes with the following stack trace:

Traceback (most recent call last):
  File "/usr/local/sbin/growvols", line 650, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/sbin/growvols", line 541, in main
    partnum = find_next_partnum(devices, disk)
  File "/usr/local/sbin/growvols", line 341, in find_next_partnum
    max_partnum = max(max_partnum, int(dev_name[disk_name_length:]))
ValueError: invalid literal for int() with base 10: 'p1'

The error is related to the kernel naming scheme for disk partitions.
If the disk name is ending with a digit, the kernel adds "pX" (where
X is  the partition number) instead of just "X" when the disk name
ends with a letter.

Consulting the manual page multipath.conf(5), the partition_delimiter
is configurable. If partition_delimiter is <unset> (the default) a
delimiter 'p' is inserted only if the map name ends in a digit. If
however the user configured a partition_delimiter, it will always be
used.

To try to handle both cases, use a regular expression to catch only
the digits at the end of the string.

Authored-By: mcr.opensource@gmail.com
Co-Authored-By: hjensas@redhat.com
Closes-Bug: #2109988
Change-Id: Ifbd58000601b7fc5635dcc2c7a897462000319b0
2025-05-06 02:17:40 +02:00
..
2025-04-02 21:09:30 +00:00
2024-02-02 11:29:25 +09:00
2014-07-21 10:15:41 +02:00