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