Bug 831099

Summary: add the ability to set a wwn for SCSI disks
Product: Red Hat Enterprise Linux 6 Reporter: Paolo Bonzini <pbonzini>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: acathrow, dallan, dyasny, dyuan, mzhan, pbonzini, rwu, weizhan, whuang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-0rc1.el6 Doc Type: Enhancement
Doc Text:
Feature: Libvirt introduced new XML to set WWN for IDE and SCSI disk. Reason: WWNs provide stable device paths that are the same for IDE and SCSI disks. Result (if any): Besides a serial number, one can also set WWN for IDE and SCSI disk.
Story Points: ---
Clone Of:
: 831102 (view as bug list) Environment:
Last Closed: 2013-02-21 07:17:03 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: 831102    
Bug Blocks:    

Description Paolo Bonzini 2012-06-12 07:55:22 UTC
Description of problem:
In addition to a serial number, upstream QEMU allows to set a disk's WWN.  The feature is enabled for IDE disks in 1.1, and will be added to SCSI disks as well in 1.2.  We would like to backport this to RHEL6, but we need libvirt support.

The <disk> element should grow a <wwn> sub-element whose contents must be composed of 16 hexadecimal digits.

Comment 1 Paolo Bonzini 2012-06-12 07:57:14 UTC
The WWN can be examined in the guest with "sudo sg_inq -p 0x83 /dev/sda", and should also be visible in /dev/disk/by-id.

For example with a <wwn>5000c50015ea71ad</wwn> element sg_vpd will show something like:

  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 a <serial> and <wwn> element together should also be tested.

Comment 7 Osier Yang 2012-08-30 04:43:00 UTC
Patch posted upstream:

https://www.redhat.com/archives/libvir-list/2012-August/msg01853.html

Comment 8 Osier Yang 2012-09-18 07:03:44 UTC
https://www.redhat.com/archives/libvir-list/2012-September/msg01220.html

Patches committed to upstream. Move to POST.

Comment 11 weizhang 2012-09-20 08:36:43 UTC
It depends on bug https://bugzilla.redhat.com/show_bug.cgi?id=831102
so we will wait for this qemu-kvm bug fixed.

Comment 12 weizhang 2012-11-26 06:38:08 UTC
Verify pass on
libvirt-0.10.2-9.el6.x86_64
qemu-kvm-0.12.1.2-2.334.el6.x86_64
kernel-2.6.32-329.el6.x86_64

Start guest with xml
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/scsi.img'/>
      <target dev='sda' bus='scsi'/>
      <serial>cdcdcd</serial>
      <wwn>5000c60016ea71ad</wwn>
    </disk>


Login to the guest and check
# 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: cdcdcd
  Designation descriptor number 2, descriptor length: 12
    designator_type: NAA,  code_set: Binary
    associated with the addressed logical unit
      NAA 5, IEEE Company_id: 0xc60
      Vendor Specific Identifier: 0x16ea71ad
      [0x5000c60016ea71ad]

So Verify pass

Comment 13 weizhang 2012-11-26 07:10:33 UTC
Also test with scsi-cd

    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/images/tt.img'/>
      <target dev='sdc' bus='scsi'/>
      <readonly/>
      <serial>aababab</serial>
      <wwn>5001c60016ea71ad</wwn>
    </disk>

Login to the guest and check
# sg_inq -p 0x83 /dev/sr0 
VPD INQUIRY: Device Identification page
  Designation descriptor number 1, descriptor length: 11
    designator_type: vendor specific [0x0],  code_set: ASCII
    associated with the addressed logical unit
      vendor specific: aababab
  Designation descriptor number 2, descriptor length: 12
    designator_type: NAA,  code_set: Binary
    associated with the addressed logical unit
      NAA 5, IEEE Company_id: 0x1c60
      Vendor Specific Identifier: 0x16ea71ad
      [0x5001c60016ea71ad]

so also verify pass for scsi-cd

Comment 14 errata-xmlrpc 2013-02-21 07:17:03 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/RHSA-2013-0276.html