All of lore.kernel.org
 help / color / mirror / Atom feed
* Where to read the WWID of a multipath device
@ 2019-03-20 10:28 Sahid Orentino Ferdjaoui
  2019-03-21  7:57 ` Russell Weber
  0 siblings, 1 reply; 3+ messages in thread
From: Sahid Orentino Ferdjaoui @ 2019-03-20 10:28 UTC (permalink / raw)
  To: dm-devel

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Where to read the WWID of a multipath device
  2019-03-20 10:28 Where to read the WWID of a multipath device Sahid Orentino Ferdjaoui
@ 2019-03-21  7:57 ` Russell Weber
  2019-03-21  9:06   ` Sahid Orentino Ferdjaoui
  0 siblings, 1 reply; 3+ messages in thread
From: Russell Weber @ 2019-03-21  7:57 UTC (permalink / raw)
  To: Sahid Orentino Ferdjaoui; +Cc: dm-devel


[-- Attachment #1.1: Type: text/plain, Size: 2241 bytes --]

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?

On Wed, Mar 20, 2019 at 4:28 AM Sahid Orentino Ferdjaoui <
sahid.ferdjaoui@canonical.com> wrote:

> 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.
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
>

[-- Attachment #1.2: Type: text/html, Size: 3030 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Where to read the WWID of a multipath device
  2019-03-21  7:57 ` Russell Weber
@ 2019-03-21  9:06   ` Sahid Orentino Ferdjaoui
  0 siblings, 0 replies; 3+ messages in thread
From: Sahid Orentino Ferdjaoui @ 2019-03-21  9:06 UTC (permalink / raw)
  To: Russell Weber; +Cc: dm-devel

On Thu, Mar 21, 2019 at 01:57:39AM -0600, Russell Weber wrote:
> 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'.

> 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/

I would like avoid such parsing if possible.

> 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?

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.

> On Wed, Mar 20, 2019 at 4:28 AM Sahid Orentino Ferdjaoui <
> sahid.ferdjaoui@canonical.com> wrote:
> 
> > 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.
> >
> > --
> > dm-devel mailing list
> > dm-devel@redhat.com
> > https://www.redhat.com/mailman/listinfo/dm-devel
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-21  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 10:28 Where to read the WWID of a multipath device Sahid Orentino Ferdjaoui
2019-03-21  7:57 ` Russell Weber
2019-03-21  9:06   ` Sahid Orentino Ferdjaoui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.