Bug 831102

Summary: add the ability to set a wwn for SCSI disks
Product: Red Hat Enterprise Linux 6 Reporter: Paolo Bonzini <pbonzini>
Component: qemu-kvmAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: acathrow, areis, bsarathy, dyasny, juzhang, mazhang, minovotn, mkenneth, pbonzini, sluo, virt-maint, wdai
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.331.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 831099 Environment:
Last Closed: 2013-02-21 07:36:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 831099, 833566    

Description Paolo Bonzini 2012-06-12 08:00:03 UTC
Description of problem:
Allow to set a disk WWN.  This lets virtual disks have the same stable path as a physical disk.  "-device scsi-disk" (as well as scsi-hd and scsi-cd, but not scsi-block) will have a wwn property, that can be specified like wwn=0x5000c50015ea71ad.

When the wwn property is given, a new link will appear in /dev/disk/by-id.  In addition, "sg_inq -p 0x83 /dev/sda" (or sg_vpd) will show something like this:

  Designation descriptor number 1, descriptor length: 12
    designator_type: NAA,  code_set: Binary
    associated with the addressed logical unit
      NAA 5, IEEE Company_id: 0xc50
      Vendor Specific Identifier: 0x15ea71ad
      [0x5000c50015ea71ad]

Specifying serial and wwn properties together should also be tested.

Comment 2 RHEL Program Management 2012-07-10 08:13:57 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 3 RHEL Program Management 2012-07-11 01:44:51 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 8 Sibiao Luo 2012-10-10 06:18:06 UTC
Reproduce this issue on qemu-kvm-0.12.1.2-2.295.el6.x86_64 host.
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-325.el6.x86_64
qemu-kvm-0.12.1.2-2.295.el6.x86_64

Steps of reproduce:
1.# /usr/libexec/qemu-kvm -device scsi-cd,?
2.# /usr/libexec/qemu-kvm -device scsi-hd,?
3.# /usr/libexec/qemu-kvm -device scsi-disk,?

Result of reproduce:
There is no new element <wwn> property, QEMU did not allow to set new element <wwn> (just like setting serial number) for the virtual disk (scsi-disk, scsi-hd, and scsi-cd).

--------------------------------------------------------------------------------

I also tried this issue on qemu-kvm-0.12.1.2-2.320.el6.x86_64.
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-325.el6.x86_64
qemu-kvm-0.12.1.2-2.320.el6.x86_64

Steps:
- scenario 1: check QEMU support.
# /usr/libexec/qemu-kvm -device scsi-cd,?
# /usr/libexec/qemu-kvm -device scsi-hd,?
# /usr/libexec/qemu-kvm -device scsi-disk,?

- scenario 2: set <wwn> and serial for the scsi-hd/scsi-cd/scsi-disk.
1.boot guest with setting <wwn> to scsi-hd/scsi-cd/scsi-disk.
eg:...-drive file=/home/my-data-disk.qcow2,if=none,id=hd,format=qcow2,readonly=on,cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0 -device scsi-hd,bus=scsi0.0,wwn=0x5000c50015ea71ad,serial=ababab,drive=hd,id=sluo
2.check info qtree in QEMU monitor.
(qemu) info qtree
bus: main-system-bus
...
          dev: scsi-hd, id "sluo"
            dev-prop: drive = hd
            dev-prop: logical_block_size = 512
            dev-prop: physical_block_size = 512
            dev-prop: min_io_size = 0
            dev-prop: opt_io_size = 0
            dev-prop: bootindex = -1
            dev-prop: discard_granularity = 0
            dev-prop: ver = "0.12.1"
            dev-prop: serial = "ababab"
            dev-prop: wwn = 0x5000c50015ea71ad
            dev-prop: removable = off
            bus-prop: channel = 0
            bus-prop: scsi-id = 0
            bus-prop: lun = 0
...
3.check the device identification.
# ls -l /dev/disk/by-id/*
# sg_inq -p 0x83 /dev/sda (or sg_vpd)

Actual Result:
- scenario 1: 
There is a new element <wwn> property (just like setting serial number) for the virtual disk (scsi-disk, scsi-hd, and scsi-cd), like:
...
scsi-block.wwn=hex64
...

- scenario 2: 
after the step 3,
# ls -l /dev/disk/by-id/*
lrwxrwxrwx. 1 root root 10 Oct 10 12:03 /dev/disk/by-id/dm-name-VolGroup-lv_root -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Oct 10 12:03 /dev/disk/by-id/dm-name-VolGroup-lv_swap -> ../../dm-1
lrwxrwxrwx. 1 root root 10 Oct 10 12:03 /dev/disk/by-id/dm-uuid-LVM-HmPt8xgZkjMqw4gElRoMF639kEfXuu6v9fUwez0ZmWqIby59Qv8ESIXpCPFjN8EX -> ../../dm-1
lrwxrwxrwx. 1 root root 10 Oct 10 12:03 /dev/disk/by-id/dm-uuid-LVM-HmPt8xgZkjMqw4gElRoMF639kEfXuu6vwBADmP9G1GqMNIb7wL7hb3YIz4e3N5oa -> ../../dm-0
lrwxrwxrwx. 1 root root  9 Oct 10 12:03 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_ababab -> ../../sda
# sg_inq -p 0x83 /dev/sda
VPD INQUIRY: Device Identification page
  Designation descriptor number 1, descriptor length: 10
    designator_type: vendor specific [0x0],  code_set: ASCII
    associated with the addressed logical unit
      vendor specific: ababab

Expected Results:
- scenario 2:
after step 3,
1.When the wwn property is given, a new link should appear in /dev/disk/by-id, like: /dev/disk/by-id/wwn-0x5000c50015ea71ad -> ../../sda

2.when run "sg_inq -p 0x83 /dev/sda" (or sg_vpd) will show something like this:
VPD INQUIRY: Device Identification page
  Designation descriptor number 1, descriptor length: 10
    designator_type: vendor specific [0x0],  code_set: ASCII
    associated with the addressed logical unit
      vendor specific: ababab
      [0x5000c50015ea71ad]   <----should display the <wwn>

Base on above, this issue did not fix correctly, so re-assigned it. Please correct me if any mistake.

Best Regards.
sluo

Comment 9 Paolo Bonzini 2012-10-15 14:28:16 UTC
*** Bug 864845 has been marked as a duplicate of this bug. ***

Comment 11 mazhang 2012-11-13 02:12:54 UTC
Reproduced this bug on qemu-kvm-0.12.1.2-2.316.el6.x86_64.rpm

Reproduce Steps:
1: check QEMU support.
# /usr/libexec/qemu-kvm -device scsi-cd,?
[root@m1 qemu-kvm-316]# /usr/libexec/qemu-kvm -device scsi-cd,?
scsi-cd.drive=drive
scsi-cd.logical_block_size=uint16
scsi-cd.physical_block_size=uint16
scsi-cd.min_io_size=uint16
scsi-cd.opt_io_size=uint32
scsi-cd.bootindex=int32
scsi-cd.discard_granularity=uint32
scsi-cd.ver=string
scsi-cd.serial=string
scsi-cd.channel=uint32
scsi-cd.scsi-id=uint32
scsi-cd.lun=uint32
# /usr/libexec/qemu-kvm -device scsi-hd,?
# /usr/libexec/qemu-kvm -device scsi-disk,?
...

scsi-hd and scsi-disk no wwn property too.


Verified this bug on:qemu-kvm-0.12.1.2-2.334.el6.x86_64&2.6.32-335.el6.x86_64

refer to comment #8 steps:
1: check QEMU support.
# /usr/libexec/qemu-kvm -device scsi-cd,?
# /usr/libexec/qemu-kvm -device scsi-hd,?
# /usr/libexec/qemu-kvm -device scsi-disk,?

all above command got wwn property:
scsi-cd.ver=string
scsi-cd.serial=string
scsi-cd.wwn=hex64
scsi-cd.channel=uint32
...
scsi-hd.serial=string
scsi-hd.wwn=hex64
scsi-hd.removable=on/off
...
scsi-disk.serial=string
scsi-disk.wwn=hex64
scsi-disk.removable=on/off

2: check info qtree in QEMU monitor 
(qemu) info qtree
...
bus: scsi0.0
          type SCSI
          dev: scsi-cd, id "sluo"
            dev-prop: drive = hd
            dev-prop: logical_block_size = 512
            dev-prop: physical_block_size = 512
            dev-prop: min_io_size = 0
            dev-prop: opt_io_size = 0
            dev-prop: bootindex = -1
            dev-prop: discard_granularity = 0
            dev-prop: ver = "0.12.1"
            dev-prop: serial = "ababab"
            dev-prop: wwn = 0x5000c50015ea71ad
            bus-prop: channel = 0

3: check the device identification.
# ls -l /dev/disk/by-id/*
got like this:
/dev/disk/by-id/wwn-0x5000c50015ea71ad -> ../../sr0

so this bug was fixed.

Comment 12 mazhang 2012-11-16 03:36:11 UTC
add check the device identification qemu-kvm-0.12.1.2-2.334.el6.x86_64
boot guest with "-drive file=/root/image/storage_0.qcow2,if=none,id=hd,format=qcow2,readonly=on,cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0 -device scsi-hd,bus=scsi0.0,wwn=0x5000c50015ea71ad,serial=ababab,drive=hd,id=sluo"

check disk property.
#sg_inq -p 0x83 /dev/sdb


result:
[root@qemu-test ~]# sg_inq -p 0x83 /dev/sdb
VPD INQUIRY: Device Identification page
  Designation descriptor number 1, descriptor length: 10
    designator_type: vendor specific [0x0],  code_set: ASCII
    associated with the addressed logical unit
      vendor specific: ababab
  Designation descriptor number 2, descriptor length: 12
    designator_type: NAA,  code_set: Binary
    associated with the addressed logical unit
      NAA 5, IEEE Company_id: 0xc50
      Vendor Specific Identifier: 0x15ea71ad
      [0x5000c50015ea71ad]

message correct as comment #8

Comment 14 errata-xmlrpc 2013-02-21 07:36:53 UTC
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-2013-0527.html