Bug 1245013
| Summary: | libvirt should ensure serial number is unique among domain's disks | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Pei Zhang <pzhang> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| Status: | CLOSED WONTFIX | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.2 | CC: | berrange, dyuan, hhan, lmen, mzhan, pkrempa, rbalakri, xuzhang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.3.2-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-06-24 15:32:59 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: | |||
Fixed upstream:
commit 34315608a8c2acd0fb6b5de1b682365de1f6290e
Author: Peter Krempa <pkrempa>
Date: Tue Sep 29 18:33:40 2015 +0200
conf: Reuse virDomainDefCheckDuplicateDiskWWN to check disk serial too
Rename the function to virDomainDefCheckDuplicateDiskInfo and make it
check disk serials too.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1245013
commit 199d17de325b67c86cd65a31fe0e7e58fd158e37
Author: Peter Krempa <pkrempa>
Date: Tue Sep 29 18:13:06 2015 +0200
qemu: Perform the disk WWN check only on fresh starts
Since we'd disallow migration of a guest that would have possibly
invalid config but still be able to work, relax the WWN check to be
performed only on new starts of the VM.
The problem of cold-plug disks' duplicate WWN and serial is fixed. But the hot-plug disks' need to be done. Check in cold-plug: # virsh attach-disk n1 /tmp/sdb.img sdb --serial aaaabbbbccccdddd --wwn 0x5000c50015ea71aa --config Disk attached successfully # virsh attach-disk n1 /tmp/sdc.img sdc --serial aaaabbbbccccdddd --wwn 0x5000c50015ea71aa --config error: Failed to attach disk error: unsupported configuration: Domain already has a disk with wwn '0x5000c50015ea71aa' # virsh attach-disk n1 /tmp/sdc.img sdc --serial aaaabbbbccccdddd --config Disk attached successfully # virsh start n1 error: Failed to start domain n1 error: unsupported configuration: Disks 'sdb' and 'sdc' have identical serial # virsh destroy n1 Domain n1 destroyed Do hot-plug: # virsh start n2 Domain n1 started # virsh attach-disk n2 /tmp/sdb.img sdb --serial aaaabbbbccccdddd Disk attached successfully # virsh attach-disk n2 /tmp/sdc.img sdc --serial aaaabbbbccccdddd Disk attached successfully Check serial in guest: # lsblk --nodeps -o name,model,serial,wwn NAME MODEL SERIAL WWN sda QEMU HARDDISK aaaabbbbccccdddd sdb QEMU HARDDISK aaaabbbbccccdddd Test it on upstream version libvirt-v1.3.1-rc1-2-g46c551f (In reply to Han Han from comment #4) > The problem of cold-plug disks' duplicate WWN and serial is fixed. > But the hot-plug disks' need to be done. > Fixed with upstream commit: commit 4f1324aa48d834f419584b3bffebf763eb778572 Author: Peter Krempa <pkrempa> Date: Thu Feb 4 13:39:15 2016 +0100 qemu: hotplug: Check duplicate disk serial/wwn on hotplug too We do the check on VM start, but the user could still hotplug a disk with a conflicting serial or WWN. Reuse the checker function to fix the issue. v1.3.1-147-g4f1324a Thanks for pointing out this case. the bug is verified. version: qemu-kvm-rhev-2.3.0-31.el7_2.7.x86_64 libvirt-1.3.2-1.el7.x86_64 step: 1)check cold-plug: #virsh attach-disk men /var/lib/libvirt/images/m2.qcow2 sdb --serial aaaabbbbccccdddd --wwn 0x5000c50015ea71aa --config Disk attached successfully #virsh attach-disk men /var/lib/libvirt/images/m1.qcow2 sdc --serial aaaabbbbccccdddd --wwn 0x5000c50015ea71aa --config error: Failed to attach disk error: unsupported configuration: Domain already has a disk with wwn '0x5000c50015ea71aa' #virsh attach-disk men /var/lib/libvirt/images/m1.qcow2 sdc --serial aaaabbbbccccdddd --config Disk attached successfully # virsh start men error: Failed to start domain men error: unsupported configuration: Disks 'sdb' and 'sdc' have identical serial 2)check hot-plug: #virsh attach-disk men /var/lib/libvirt/images/m1.qcow2 sdb --serial aaaabbbbccccdddd Disk attached successfully #virsh attach-disk men /var/lib/libvirt/images/m2.qcow2 sdc --serial aaaabbbbccccdddd error: Failed to attach disk error: unsupported configuration: Disks 'sdb' and 'sdc' have identical serial This change is bogus, because it breaks a valid use cases. People want to be able to have multiple disks with the same serial in order to setup things like multi-path. We should revert all these patches. Instead the higher level app (virt-manager, openstack, etc) should decide whether its appropriate to have duplicate serial or not, potentially getting the user to confirm See this bug where the users complained about this regression in behaviour https://bugzilla.redhat.com/show_bug.cgi?id=1349895 I agree. I've reverted the code and I'll close this bug.
commit 5da28cc3069b573f54f0bcaf8eb75476bcfdc6e9
Author: Peter Krempa <pkrempa>
Date: Fri Jun 24 17:01:27 2016 +0200
conf: Allow disks with identical WWN or serial
Disallowing them broke a use case of testing multipath configurations
for storage. Originally this was added as it was impossible to
use certain /dev/disk-by... links but the disks worked properly.
|
Description of problem: It looks like serial number also has impact on guest naming disks in /dev/disk/by-id/ if we only pass serial number without wwn . Version-Release number of selected component (if applicable): libvirt-1.2.17-2.el7.x86_64 qemu-kvm-rhev-2.3.0-10.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. try to start a guest like following three disks has same "serial" and one of them has "wwn" : #virsh dumpxml testvm ...... <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/qcow2.img'/> <backingStore/> <target dev='sde' bus='scsi'/> <serial>aaaabbbbccccdddd</serial> <alias name='scsi0-0-0-4'/> <address type='drive' controller='0' bus='0' target='0' unit='4'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/qcow2-2.img'/> <backingStore/> <target dev='sdf' bus='scsi'/> <serial>aaaabbbbccccdddd</serial> <alias name='scsi0-0-0-5'/> <address type='drive' controller='0' bus='0' target='0' unit='5'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/raw.img'/> <backingStore/> <target dev='sdm' bus='scsi'/> <serial>aaaabbbbccccdddd</serial> <wwn>0x5000c50015ea71aa</wwn> <alias name='scsi0-0-0-6'/> <address type='drive' controller='0' bus='0' target='0' unit='6'/> </disk> ...... 2.start the guest and login guest to check : # lsblk --nodeps -o name,model,serial,wwn NAME MODEL SERIAL WWN sda QEMU HARDDISK aaaabbbbccccdddd sdb QEMU HARDDISK aaaabbbbccccdddd sdc QEMU HARDDISK 5000c50015ea71aa 0x5000c50015ea71aa sr0 QEMU DVD-ROM QM00001 vda check in /dev/disk/by-id/ directory , sdb is missing . # ls /dev/disk/by-id/* -al lrwxrwxrwx. 1 root root 9 Jul 15 17:13 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_aaaabbbbccccdddd -> ../../sda lrwxrwxrwx. 1 root root 9 Jul 15 17:37 /dev/disk/by-id/scsi-35000c50015ea71aa -> ../../sdc lrwxrwxrwx. 1 root root 9 Jul 15 17:37 /dev/disk/by-id/wwn-0x5000c50015ea71aa -> ../../sdc Actual results: As step 2 , disk which has same serial number with wwn will miss in /dev/disk/by-id/ directory in guest . Expected results: The serial number also need to be unique to ensure disks has correct name in guest . Additional info: