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
..
2023-09-15 20:31:12 +00:00
2024-09-16 20:47:48 +00:00
2017-04-05 13:11:22 +10:00
2017-01-31 14:14:19 +11:00
2024-07-05 09:53:29 +12:00
2023-11-25 20:23:31 +00:00
2023-03-21 13:07:02 +00:00
2017-05-19 12:43:36 -07:00
2024-07-05 09:53:29 +12:00
2019-12-18 11:42:02 -05:00
2024-07-05 09:53:29 +12:00
2021-07-05 11:45:02 +10:00
2017-05-19 12:43:36 -07:00
2025-04-25 07:33:57 -07:00
2017-02-02 20:36:23 +11:00
2024-12-05 08:31:50 -08:00
2017-02-02 11:20:00 +11:00
2022-11-02 14:21:16 +00:00
2024-09-16 20:47:48 +00:00
2017-03-14 14:49:49 +11:00
2018-02-23 10:04:40 +11:00
2021-07-05 11:45:02 +10:00
2018-11-28 11:04:50 +11:00