Bug 1464975 - can not hotplug a disk with the same WWN which already used in the guest
can not hotplug a disk with the same WWN which already used in the guest
Status: VERIFIED
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.4
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Peter Krempa
Meina Li
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-26 06:36 EDT by lijuan men
Modified: 2017-10-26 21:55 EDT (History)
4 users (show)

See Also:
Fixed In Version: libvirt-3.7.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description lijuan men 2017-06-26 06:36:56 EDT
Description of problem:
as discussed in bug 1208009,guest should allow 2 disks with the same wwn. Now,can not hotplug a disk with the same WWN which already used in the guest

Version-Release number of selected component (if applicable):
libvirt-3.2.0-14.el7.x86_64
qemu-kvm-rhev-2.9.0-14.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

1)start a guest with 2 disks which have the same WWN

start a guest with :
<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/RHEL-7.4-x86_64-latest.qcow2'/>
      <target dev='hda' bus='ide'/>
      <wwn>0x5000c50015ea71aa</wwn>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/a.qcow2'/>
      <target dev='sda' bus='scsi'/>
      <wwn>0x5000c50015ea71aa</wwn>
    </disk>

[root@lmen1 ~]# virsh destroy test;virsh start test
Domain test destroyed

Domain test started

in the guest,
#lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0  100M  0 disk 
sdb             8:16   0   10G  0 disk 
├─sdb1          8:17   0    1G  0 part /boot
└─sdb2          8:18   0    9G  0 part 
  ├─rhel-root 253:0    0    8G  0 lvm  /
  └─rhel-swap 253:1    0    1G  0 lvm  [SWAP]

It is expected 

2)attach a disk with the same WWN

start a guest with xml:
 <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/RHEL-7.4-x86_64-latest.qcow2'/>
      <target dev='hda' bus='ide'/>
      <wwn>0x5000c50015ea71aa</wwn>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

attach a disk with the xml:
[root@lmen1 ~]# cat disk.xml 
 <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/a.qcow2'/>
      <target dev='sda' bus='scsi'/>
      <wwn>0x5000c50015ea71aa</wwn>
    </disk>


[root@lmen1 ~]# virsh attach-device test disk.xml 
error: Failed to attach device from disk.xml
error: unsupported configuration: Domain already has a disk with wwn '0x5000c50015ea71aa'

Actual results:
failed to hotplug

Expected results:
hotplug successfully

Additional info:
Comment 1 Peter Krempa 2017-06-26 06:52:22 EDT
Fixed upstream:

commit d65781bf061fb6369494b381c908ec2e08b05769
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Fri Jun 23 14:11:25 2017 +0200

    tests: hotplug: Test disks with duplicate WWNs

commit b910fa8b76d9b4f5fc06dc1eccd5ca6ea80b94ad
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Wed Jun 21 11:44:59 2017 +0200

    Revert "qemu: Check duplicate WWNs also for hotplugged disks"
    
    Similarly to commit 5da28cc3069b573f54f0bcaf8eb75476bcfdc6e9 this check
    actually does not make sense since duplicate WWNs are used e.g. when
    multipathing disks.
    
    This reverts commit 780fe4e4baf7e2f10f65ba1a34f9274fc547cad2.
Comment 3 Meina Li 2017-10-26 03:31:18 EDT
Test env components:
kernel-3.10.0-748.el7.x86_64
libvirt-3.8.0-1.el7.x86_64
qemu-kvm-rhev-2.10.0-2.el7.x86_64

Steps to verify:

1. Start a guest with 2 disks which have the same WWN.

1)start a guest with :
 <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/test.qcow2'/>
      <target dev='hda' bus='ide'/>      
      <wwn>0x5000c50015ea71aa</wwn>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/test.raw'/>
      <target dev='sda' bus='scsi'/>
      <readonly/>
      <shareable/>
      <wwn>0x5000c50015ea71aa</wwn>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

2)In the guest, check the disk:
# lsblk
NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda             8:0    0   1G  0 disk 
sdb             8:16   0   1G  0 disk 
vda           252:0    0  10G  0 disk 
├─vda1        252:1    0   1G  0 part /boot
└─vda2        252:2    0   9G  0 part 
  ├─rhel-root 253:0    0   8G  0 lvm  /
  └─rhel-swap 253:1    0   1G  0 lvm  [SWAP]

2. Attach a scsi disk with the same WWN.

1)start a guest with:
 <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/test.qcow2'/>
      <target dev='hda' bus='ide'/>
      <wwn>0x5000c50015ea71aa</wwn>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

2) attach a disk with the follow xml:

# cat disk.xml
 <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/test.raw'/>
      <target dev='sda' bus='scsi'/>
      <readonly/>
      <shareable/>
      <wwn>0x5000c50015ea71aa</wwn>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

# virsh attach-device lmn disk.xml 
Device attached successfully

3)In the guest, check the disk:
# lsblk
NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda             8:0    0   1G  0 disk 
sdb             8:16   0   1G  0 disk 
vda           252:0    0  10G  0 disk 
├─vda1        252:1    0   1G  0 part /boot
└─vda2        252:2    0   9G  0 part 
  ├─rhel-root 253:0    0   8G  0 lvm  /
  └─rhel-swap 253:1    0   1G  0 lvm  [SWAP]

4)detach the disk:
virsh detach-device lmn disk.xml 
Device detached successfully

The results are as expected.

In addition, the documentation says: If present, this element specifies the WWN (World Wide Name) of a virtual hard disk or CD-ROM drive. It must be composed of 16 hexadecimal digits and must be unique (at least among disks of a single domain). 
And this is inconsistent with the bug,so how can we deal with it or file a new bug?
Comment 4 Peter Krempa 2017-10-26 04:32:53 EDT
I've fixed the docs upstream:

commit 8587bb4549635397dc912b26906cdbe124a073db
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Thu Oct 26 10:28:12 2017 +0200

    docs: Drop mention that WWN for disks must be unique
    
    For multipath disks it might be useful to have the same WWN for multiple
    disks. It's the users choice to do so. Since we dropped the check that
    disallows using duplicate WWNs drop the docs as well.
Comment 5 Meina Li 2017-10-26 21:55:10 EDT
The docs result is as expected.
Move this Bug to verified.

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