Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 609650 - Improve SCSI/ISCSI storage pools key and name field formats
Improve SCSI/ISCSI storage pools key and name field formats
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.0
All Linux
low Severity medium
: rc
: ---
Assigned To: Daniel Berrange
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-30 14:42 EDT by Daniel Berrange
Modified: 2011-12-06 05:46 EST (History)
12 users (show)

See Also:
Fixed In Version: libvirt-0.9.2-1.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-06 05:46:48 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-05 20:23:30 EST

  None (edit)
Description Daniel Berrange 2010-06-30 14:42:03 EDT
Description of problem:
Currently all the storage pools just set the 'key' to match the storage volume path. SCSI/ISCSI LUNs usually all have a unique SCSI LUN serial identifier. This should be used as the key for the storage volume in libvirt. This allows the admin to associate between volumes seen on the virt host and LUNs on the remote NAS which is the fundamental purpose of this 'key' field.

Furthermore the volume 'name' is currently directly mapped to the full SCSI host, bus, target, lun  quad. eg  "13.0.0.1". This is very bad because the 'host' component will usually change every time the HBA is activated - the value is assigned first-come, first served by the kernel. The 'name' should be stable across pool restarts, so

For iSCSI the LUN names should simply be  'lun-0', 'lun-1', etc, since the pool itself is logged into a specific 'host, bus, target' triple.

For SCSI, the LUN names should probably be 'lun-0-0-0' since the pool is associated with a top level 'host'


Version-Release number of selected component (if applicable):
libvirt-0.8.1

How reproducible:
Always

Steps to Reproduce:
1. Query an iSCSI volume key/name data & attempt to map to the NAS
2.
3.
  
Actual results:
# scsi_id --export --whitelisted /dev/disk/by-path/ip-XXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-1
ID_VENDOR=QNAP
ID_VENDOR_ENC=QNAP
ID_MODEL=iSCSI_Storage
ID_MODEL_ENC=iSCSI\x20Storage
ID_REVISION=3.1
ID_TYPE=disk
ID_SERIAL=36001405e61fd1a5d6f1dd4d66d9630d2
ID_SERIAL_SHORT=6001405e61fd1a5d6f1dd4d66d9630d2

# virsh vol-list qnaphome
Name                 Path                                    
-----------------------------------------
13.0.0.0             /dev/disk/by-path/ip-XXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-0
13.0.0.1             /dev/disk/by-path/ip-XXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-1
13.0.0.2             /dev/disk/by-path/ip-XXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-2
13.0.0.3             /dev/disk/by-path/ip-XXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-3

<volume>
  <name>13.0.0.1</name>
  <key>/dev/disk/by-path/ip-XXXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-1</key>
  <source>
  </source>
  <capacity>6442450944</capacity>
  <allocation>6442450944</allocation>
  <target>
    <path>/dev/disk/by-path/ip-XXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-1</path>
    <format type='dos'/>
    <permissions>
      <mode>0660</mode>
      <owner>0</owner>
      <group>6</group>
      <label>system_u:object_r:fixed_disk_device_t:s0</label>
    </permissions>
  </target>
</volume>


Expected results:
# scsi_id --export --whitelisted /dev/disk/by-path/ip-XXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-1
ID_VENDOR=QNAP
ID_VENDOR_ENC=QNAP
ID_MODEL=iSCSI_Storage
ID_MODEL_ENC=iSCSI\x20Storage
ID_REVISION=3.1
ID_TYPE=disk
ID_SERIAL=36001405e61fd1a5d6f1dd4d66d9630d2
ID_SERIAL_SHORT=6001405e61fd1a5d6f1dd4d66d9630d2

# virsh vol-list qnaphome
Name                 Path                                    
-----------------------------------------
lun-0             /dev/disk/by-path/ip-XXXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-0
lun-1             /dev/disk/by-path/ip-XXXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-1
lun-2             /dev/disk/by-path/ip-XXXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-2
lun-3             /dev/disk/by-path/ip-XXXX5:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-3

<volume>
  <name>lun-1</name>
  <key>360014057cd8bdfed45d6d42afdabbbdb</key>
  <source>
  </source>
  <capacity>6442450944</capacity>
  <allocation>6442450944</allocation>
  <target>
    <path>/dev/disk/by-path/ip-XXX:3260-iscsi-iqn.2004-04.com.qnap:ts-439proii:iscsi.XXX.bf6d84-lun-1</path>
    <format type='dos'/>
    <permissions>
      <mode>0660</mode>
      <owner>0</owner>
      <group>6</group>
      <label>system_u:object_r:fixed_disk_device_t:s0</label>
    </permissions>
  </target>
</volume>


Additional info:
Comment 1 Daniel Berrange 2010-11-12 11:30:20 EST
Fixed upstream as part of

http://www.redhat.com/archives/libvir-list/2010-November/msg00545.html

The 'ID_SERIAL' field from UDev's scsi_id is now used for the key, and the volume names follow   'unit:$bus:$target:$lun", eg  "unit:0:0:1"
Comment 4 Vivian Bian 2011-03-29 03:51:35 EDT
checked with 
libvirt-0.8.7-14.el6.x86_64
kernel-2.6.32-125.el6.x86_64
qemu-kvm-0.12.1.2-2.152.el6.x86_64

Failed to get the serial_ID 

# scsi_id --export --whitelisted ip-10.66.90.100:3260-iscsi-iqn.2001-05.com.equallogic:0-8a0906-2931f7d03-4232677795b4c286-dyuan-2-lun-0
ID_SCSI=1
ID_VENDOR=EQLOGIC
ID_VENDOR_ENC=EQLOGIC\x20
ID_MODEL=100E-00
ID_MODEL_ENC=100E-00\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_REVISION=3.3
ID_TYPE=disk
ID_SERIAL_RAW="36090a038d0f7312986c2b49577673242"
ID_SERIAL=36090a038d0f7312986c2b49577673242
ID_SERIAL_SHORT=6090a038d0f7312986c2b49577673242
ID_WWN=0x6090a038d0f73129
ID_WWN_VENDOR_EXTENSION=0x86c2b49577673242
ID_WWN_WITH_EXTENSION=0x6090a038d0f7312986c2b49577673242
ID_SCSI_SERIAL=6090A038D0F7312986C2B49577673242

# virsh vol-list --pool test-iscsi
Name                 Path                                    
-----------------------------------------
unit:0:0:0           /dev/disk/by-path/ip-10.66.90.100:3260-iscsi-iqn.2001-05.com.equallogic:0-8a0906-2931f7d03-4232677795b4c286-dyuan-2-lun-0


# virsh vol-dumpxml --pool test-iscsi unit:0:0:0
<volume>
  <name>unit:0:0:0</name>
  <key>/dev/disk/by-path/ip-10.66.90.100:3260-iscsi-iqn.2001-05.com.equallogic:0-8a0906-2931f7d03-4232677795b4c286-dyuan-2-lun-0</key>
  <source>
  </source>
  <capacity>32212254720</capacity>
  <allocation>32212254720</allocation>
  <target>
    <path>/dev/disk/by-path/ip-10.66.90.100:3260-iscsi-iqn.2001-05.com.equallogic:0-8a0906-2931f7d03-4232677795b4c286-dyuan-2-lun-0</path>
    <format type='gpt'/>
    <permissions>
      <mode>0660</mode>
      <owner>0</owner>
      <group>6</group>
      <label>system_u:object_r:fixed_disk_device_t:s0</label>
    </permissions>
  </target>
</volume>


The <key> section still get the same content with <path> section . So set bug status to ASSIGNED
Comment 6 Jiri Denemark 2011-04-01 04:40:05 EDT
It's not even upstream yet. While "[PATCH 10/11] Improve SCSI volume key and name generation" which went to libvirt-list fixed this BZ, it didn't make it to git repository as a whole. Only a small subset of the patch got actually committed as

commit 174d737d952ac13f7f34cc096023a204b5dcd6c6
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Fri Nov 12 15:49:40 2010 +0000

    Improve SCSI volume name generation
    
    The SCSI volumes currently get a name like '17:0:0:1' based
    on $host:$bus:$target:$lun. The names are intended to be unique
    per pool and stable across pool restarts. The inclusion of the
    $host component breaks this, because the $host number for iSCSI
    pools is dynamically allocated by the kernel at time of login.
    This changes the name to be 'unit:0:0:1', ie removes the leading
    host component. The 'unit:' prefix is just to ensure the volume
    name doesn't start with a number and make it clearer when seen
    out of context.

The following part of the original patch is missing there:

    The SCSI volumes also get a 'key' field based on the fully
    qualified volume path. All SCSI volumes have a unique serial
    available in hardware which can be obtained by sending a
    suitable SCSI command. Call out to udev's 'scsi_id' command
    to fetch this value.
Comment 9 Daniel Berrange 2011-06-21 05:08:13 EDT
The second part of this bug is now fixed upstream


commit fdcd06ef71ba19129b0cb8d282243b619113b31d
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Fri Nov 12 15:49:40 2010 +0000

    Improve SCSI volume key generation
    
    The SCSI volumes get a better 'key' field based on the fully
    qualified volume path. All SCSI volumes have a unique serial
    available in hardware which can be obtained by sending a
    suitable SCSI command. Call out to udev's 'scsi_id' command
    to fetch this value
    
    * src/storage/storage_backend_scsi.c: Improve volume key
      field value stability and uniqueness
Comment 10 Daniel Veillard 2011-06-22 06:54:14 EDT
This should be fixed by the libvirt-0.9.2-1.el6 rebase
Comment 13 zhanghaiyan 2011-06-29 04:20:40 EDT
Verified this bug pass with libvirt-0.9.2-1.el6.x86_64
- 2.6.32-156.el6.x86_64
- qemu-kvm-0.12.1.2-2.165.el6.x86_64
1. # cat pool.xml 
     <pool type='iscsi'>
       <name>test-iscsi</name>
       <source>
         <host name="10.66.90.100"/>
         <device path="iqn.2001-05.com.equallogic:0-8a0906-26f1f7d03-1c7267779594c286-dyuan-1"/>
       </source>
       <target>
         <path>/dev/disk/by-path</path>
       </target>
     </pool>
# virsh pool-define pool.xml 
Pool test-iscsi defined from pool.xml
# virsh pool-start test-iscsi
Pool test-iscsi started

2. # scsi_id --export --whitelisted /dev/disk/by-path/pci-0000\:00\:1f.2-scsi-0\:0\:0\:0
ID_SCSI=1
ID_VENDOR=ATA
ID_VENDOR_ENC=ATA\x20\x20\x20\x20\x20
ID_MODEL=Hitachi_HDT72105
ID_MODEL_ENC=Hitachi\x20HDT72105
ID_REVISION=ST3O
ID_TYPE=disk
ID_SERIAL_RAW="1ATA     Hitachi HDT721050SLA360                       STH3D7ME11971Y"
ID_SERIAL=1ATA_Hitachi_HDT721050SLA360_STH3D7ME11971Y
ID_SERIAL_SHORT=ATA_Hitachi_HDT721050SLA360_STH3D7ME11971Y
ID_SCSI_SERIAL=      STH3D7ME11971Y

3. # virsh vol-list --pool test-iscsi
Name                 Path                                    
-----------------------------------------
unit:0:0:0           /dev/disk/by-path/ip-10.66.90.100:3260-iscsi-iqn.2001-05.com.equallogic:0-8a0906-26f1f7d03-1c7267779594c286-dyuan-1-lun-0

4. # virsh vol-dumpxml --pool test-iscsi unit:0:0:0
<volume>
  <name>unit:0:0:0</name>
  <key>36090a038d0f7f12686c294957767721c</key>
  <source>
  </source>
  <capacity>32212254720</capacity>
  <allocation>32212254720</allocation>
  <target>
    <path>/dev/disk/by-path/ip-10.66.90.100:3260-iscsi-iqn.2001-05.com.equallogic:0-8a0906-26f1f7d03-1c7267779594c286-dyuan-1-lun-0</path>
    <format type='unknown'/>
    <permissions>
      <mode>0660</mode>
      <owner>0</owner>
      <group>6</group>
      <label>system_u:object_r:fixed_disk_device_t:s0</label>
    </permissions>
  </target>
</volume>

Conclusion: 1) volume name is changed to unit:*:*:* 2) key is changed to serial identifier
Comment 14 Rita Wu 2011-07-11 07:37:22 EDT
Set it as VERIFIED per comment 13
Comment 15 Luwen Su 2011-11-17 03:59:18 EST
For comment 13 , there is something need to be updated.

A.scsi_id need a specially path like step 2.
B.The path must be the virtual disk's if want to get the serial.

libvirt-0.9.4-23.el6.x86_64
kernel-2.6.32-220.el6.x86_64
qemu-kvm-0.12.1.2-2.209.el6.x86_64

1. # cat pool.xml 
<pool type='iscsi'>
    <name>test-iscsi</name>
    <source>
      <host name="10.66.1.105"/>
      <devicepath="iqn.2011-11-com.redhat.test"/>
    </source>
    <target>
         <path>/dev/disk/by-path</path>
    </target>
</pool>

2. # scsi_id --export --whitelisted --device=/dev/sdb1
ID_SCSI=1
ID_VENDOR=IET
ID_VENDOR_ENC=IET\x20\x20\x20\x20\x20
ID_MODEL=VIRTUAL-DISK
ID_MODEL_ENC=VIRTUAL-DISK
ID_REVISION=0001
ID_TYPE=disk
ID_SERIAL_RAW="1IET     00010001"
ID_SERIAL=1IET_00010001
ID_SERIAL_SHORT=IET_00010001
ID_SCSI_SERIAL=                              beaf11

3.#  virsh vol-list --pool test-iscsi
Name                 Path                                    
-----------------------------------------
unit:0:0:1           /dev/disk/by-path/ip-10.66.1.105:3260-iscsi-iqn.2011-11.com.redhat.test-lun-1


4.# virsh vol-dumpxml --pool test-iscsi unit:0:0:1
<volume>
  <name>unit:0:0:1</name>
  <key>1IET_00010001</key>
  <source>
  </source>
  <capacity>10485760000</capacity>
  <allocation>10485760000</allocation>
  <target>
    <path>/dev/disk/by-path/ip-10.66.1.105:3260-iscsi-iqn.2011-11.com.redhat.test-lun-1</path>
    <format type='lvm2'/>
    <permissions>
      <mode>0660</mode>
      <owner>0</owner>
      <group>6</group>
      <label>system_u:object_r:fixed_disk_device_t:s0</label>
    </permissions>
  </target>
</volume>
Comment 18 errata-xmlrpc 2011-12-06 05:46:48 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1513.html

Note You need to log in before you can comment on or make changes to this bug.