Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wwn versus VPD unit serial number #154

Open
dfsmith opened this issue Oct 18, 2019 · 0 comments
Open

wwn versus VPD unit serial number #154

dfsmith opened this issue Oct 18, 2019 · 0 comments

Comments

@dfsmith
Copy link

dfsmith commented Oct 18, 2019

Hi All,

In the tcm.py module, the various dump() functions return the VPD unit serial with the label "wwn"; which does not match the various /dev/disk/by-id/wwn-* entries set up by udev.

Udev can be coerced to making scsi_serial-* entries with an additional rules file, but...

  1. Is there a reason that the VPD unit serial number is reported as the WWN in dump() (and hence targetcli)? (See also tcm.py:132: _get_wwn().)

  2. Is there another way (without the sysfs hide-and-seek game) to match an rtslib backstore to a device in /dev/*/by-id ?

Thanks.

Notes:

If you know the vendor id that tcmu-runner assigns, and don't mind truncating the UUID serial number, you can, by eye, match the VPD unit serial number to the WWN. But it would be hard to codify this relationship in a robust way.

Not related to rtslib, but the tcmu-runner method of reading the WWN component appears very fragile: copying (unchecked) from the 28th byte of /sys/.../wwn/vpd_unit_serial. Yikes!
tcmu-runner/configfs.c:202: ret = asprintf(&ret_buf, "%s", &buf[28]);

A useful command (as used by udev) is, with example output from a tcmu-runner-backed drive:

# /lib/udev/scsi_id -x -g /dev/sdf
ID_SCSI=1
ID_VENDOR=LIO-ORG
ID_VENDOR_ENC=LIO-ORG\x20
ID_MODEL=TCMU_device
ID_MODEL_ENC=TCMU\x20device\x20\x20\x20\x20\x20
ID_REVISION=0002
ID_TYPE=disk
ID_SERIAL=36001405634963c741fd47c3a17f772d2
ID_SERIAL_SHORT=6001405634963c741fd47c3a17f772d2
ID_WWN=0x6001405634963c74
ID_WWN_VENDOR_EXTENSION=0x1fd47c3a17f772d2
ID_WWN_WITH_EXTENSION=0x6001405634963c741fd47c3a17f772d2
ID_SCSI_SERIAL=634963c7-41fd-47c3-a17f-772d2d704c7b

Note the relationship between ID_SCSI_SERIAL from VPD 0x83, and the ID_WWN*.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant