Where to read the WWID of a multipath device
Hi,
The question is as indicated on title, what would be the best way to get the WWID of a multipath device, something which would work on any systems or storages.
My idea was to read /sys/block/dm-X/name but someone indicated to me that may not be correct in some situation, like it seems that /lib/udev/scsi_id would not be correct either.
To give a bit of context it's for an OpenStack library in Python.
Thanks,
s.
I would assume that most linux distributions at this point in time support getting the wwids through:
```cat /etc/multipath/wwids```` This can also be parsed out of multipath -ll ```
[USER ~]# multipath -ll
mpathak (26639613661623365) dm-3 FUSIONIO,ION LUN
size=2.7T features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw
|-+- policy='queue-length 0' prio=50 status=active | |- 7:0:0:1 sdb 8:16 active ready running | `- 8:0:0:1 sdc 8:32 active ready running
`-+- policy='queue-length 0' prio=1 status=enabled
|- 9:0:0:1 sdd 8:48 active ready running
`- 10:0:0:1 sde 8:64 active ready running
[USER ~]# cat /etc/multipath/wwids | grep -i 26639613661623365 /26639613661623365/
``` However, I'm curious as to why you would need the wwid as most higher level python management libraries I've worked with are much more concerned with the disk or partition GUID, LUN number, or some other ID for the disk. Example: ```
[USER by-uuid]# ls -al
total 0
drwxr-xr-x. 2 root root 120 Mar 20 14:58 . drwxr-xr-x. 5 root root 100 Mar 20 14:58 .. lrwxrwxrwx. 1 root root 10 Mar 21 00:04 5b1c21dc-6f65-4d88-99a0-b30f76d08931 -> ../../dm-2 lrwxrwxrwx. 1 root root 10 Mar 21 00:04 72e5d3ab-d4b2-4d0a-8b77-ba9dd718871c -> ../../sda1 lrwxrwxrwx. 1 root root 10 Mar 21 00:04 df4b2a63-4a56-4173-ba82-45f567d1b5bf -> ../../dm-0 lrwxrwxrwx. 1 root root 10 Mar 21 00:04 fa3c2abb-d8d2-4a99-84d2-09f8204e429e -> ../../dm-1 [USER by-uuid]# pwd/dev/disk/by-uuid
```
What do you need the WWID for as the multipath wwid may not be the best option for the application you are looking at?
Quoted 20 lines · Sahid Orentino Ferdjaoui
Hi,
The question is as indicated on title, what would be the best way to get the WWID of a multipath device, something which would work on any systems or storages.
My idea was to read
/sys/block/dm-X/namebut someone indicated to me that may not be correct in some situation, like it seems that/lib/udev/scsi_idwould not be correct either.To give a bit of context it's for an OpenStack library in Python.
Thanks,
s.--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Quoted 3 lines · Russell Weber
I would assume that most linux distributions at this point in time support getting the wwids through:
```cat /etc/multipath/wwids````
This path can be changed via multipath.conf I can't really use it. Also I just have a list of connected volumes ['sda', 'sdb'...] and the multipath device 'dm-0'.
Quoted 6 lines
This can also be parsed out of multipath -ll
```
[USER ~]# multipath -ll
mpathak (26639613661623365) dm-3 FUSIONIO,ION LUN
size=2.7T features='3queue_if_no_pathpg_init_retries50' hwhandler='1 alua' wp=rw
Quoted 8 lines
|-+- policy='queue-length 0' prio=50 status=active | |- 7:0:0:1 sdb 8:16 active ready running | `- 8:0:0:1 sdc 8:32 active ready running`-+- policy='queue-length 0' prio=1 status=enabled
|- 9:0:0:1 sdd 8:48 active ready running
`- 10:0:0:1 sde 8:64 active ready running
[USER ~]# cat/etc/multipath/wwids| grep -i 26639613661623365 /26639613661623365/
I would like avoid such parsing if possible.
Quoted 21 lines
However, I'm curious as to why you would need the wwid as most higher level python management libraries I've worked with are much more concerned with the disk or partition GUID, LUN number, or some other ID for the disk. Example:
``` [USER by-uuid]# ls -al total 0 drwxr-xr-x. 2 root root 120 Mar 20 14:58 . drwxr-xr-x. 5 root root 100 Mar 20 14:58 .. lrwxrwxrwx. 1 root root 10 Mar 21 00:04 5b1c21dc-6f65-4d88-99a0-b30f76d08931 -> ../../dm-2 lrwxrwxrwx. 1 root root 10 Mar 21 00:04 72e5d3ab-d4b2-4d0a-8b77-ba9dd718871c -> ../../sda1 lrwxrwxrwx. 1 root root 10 Mar 21 00:04 df4b2a63-4a56-4173-ba82-45f567d1b5bf -> ../../dm-0 lrwxrwxrwx. 1 root root 10 Mar 21 00:04 fa3c2abb-d8d2-4a99-84d2-09f8204e429e -> ../../dm-1 [USER by-uuid]# pwd /dev/disk/by-uuid ```
Quoted 2 lines
What do you need the WWID for as the multipath wwid may not be the best option for the application you are looking at?
Yes the WWN is probably used as metadata but the API is asking for it.
Usually we get the WWN from the sysfs entries in /dev/disk/by-id/scsi-* (context is iSCSI connected volumes). But algorithm has a bug if the multipath device is generated automatically and the devnames are not anymore in sysfs.
We are able to find the multipath device by looking at /sys/block/{devnames}/holders/dm-*
I don't say the algorithm if perfect, I can't really update everything. So the question is really related to how get the WWN from the multipath device name in a accurate way.
Quoted 23 lines
Quoted 20 lines · Sahid Orentino Ferdjaoui
Hi,
The question is as indicated on title, what would be the best way to get the WWID of a multipath device, something which would work on any systems or storages.
My idea was to read
/sys/block/dm-X/namebut someone indicated to me that may not be correct in some situation, like it seems that/lib/udev/scsi_idwould not be correct either.To give a bit of context it's for an OpenStack library in Python.
Thanks,
s.--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel