[pve-devel] [PATCH storage] fix #2460: use dm-uuid-mpath- as fallback for multipath

Mira Limbeck m.limbeck at proxmox.com
Tue Jul 7 16:14:54 CEST 2020


With Debian Buster it looks like the 'scsi-' method is no longer
reliable. In addition to that, which is also used for non-multipath
systems, add the 'dm-uuid-mpath-' method as fallback. This is also used
by openstack (see os-brick
https://github.com/openstack/os-brick/blob/39b201160bbff39117fca46b2709ff3f74c53d80/os_brick/initiator/linuxscsi.py#L400)

Also sort the output of readdir so 'scsi-' is always after
'dm-uuid-mpath-' so the output of pvesm list does not change for systems
that worked before.

Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
 PVE/Storage/ISCSIPlugin.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/ISCSIPlugin.pm b/PVE/Storage/ISCSIPlugin.pm
index d5cb733..f2694ba 100644
--- a/PVE/Storage/ISCSIPlugin.pm
+++ b/PVE/Storage/ISCSIPlugin.pm
@@ -151,11 +151,11 @@ sub load_stable_scsi_paths {
     my $stabledir = "/dev/disk/by-id";
 
     if (my $dh = IO::Dir->new($stabledir)) {
-       while (defined(my $tmp = $dh->read)) {
+	foreach my $tmp (sort $dh->read) {
            # exclude filenames with part in name (same disk but partitions)
            # use only filenames with scsi(with multipath i have the same device
 	   # with dm-uuid-mpath , dm-name and scsi in name)
-           if($tmp !~ m/-part\d+$/ && $tmp =~ m/^scsi-/) {
+           if($tmp !~ m/-part\d+$/ && ($tmp =~ m/^scsi-/ || $tmp =~ m/^dm-uuid-mpath-/)) {
                  my $path = "$stabledir/$tmp";
                  my $bdevdest = readlink($path);
 		 if ($bdevdest && $bdevdest =~ m|^../../([^/]+)|) {
-- 
2.20.1






More information about the pve-devel mailing list