Hide Forgot
description of problem: Optional sub-element driver of the scsi controller cannot be set at the same time ,libvirt just save the last one and remove others. Version-Release number of selected component (if applicable): libvirt-1.2.8-11.el7.x86_64 qemu-kvm-rhev-2.1.2-17.el7.x86_64 kernel-3.10.0-217.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.edit domain XML like following : <controller type='scsi' index='1' model='virtio-scsi'> <driver max_sectors='512'/> <driver cmd_per_lun='10'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </controller> 2.start domain . check domain XML. element max_sectors was removed. # virsh start r717 Domain r717 started # virsh dumpxml r717 | grep scsi -A 8 <controller type='scsi' index='1' model='virtio-scsi'> <driver cmd_per_lun='10'/> <=====just cmd_per_lun ,max_sectors was removed. <alias name='scsi1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </controller> 3.set three emlements at the same time .start the guest . <controller type='scsi' index='1' model='virtio-scsi'> <driver queues='3' cmd_per_lun='10' max_sectors='512'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </controller> 3.1 Dumpxml it has three elements. # virsh dumpxml r717 | grep scsi -A 8 <controller type='scsi' index='1' model='virtio-scsi'> <driver queues='3'/> <driver cmd_per_lun='10'/> <driver max_sectors='512'/> <alias name='scsi1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </controller> 3.2 Using virsh edit or dumpxml --inactive to check ,the last one was saved and others were removed. #virsh edit r717 #virsh dumpxml r717 --inactive | grep scsi -A 8 <controller type='scsi' index='1' model='virtio-scsi'> <driver max_sectors='512'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </controller> Actual results: As step2 and step 3.2 , those three sub-element cannot be set at the same time . Expected results: Those three sub-element can be set at the same time .
I've just pushed the patch upstream: commit 97fac17c77d9bdfacafff1c5c39b2df3c1530614 Author: Luyao Huang <lhuang> AuthorDate: Wed Jan 7 18:39:37 2015 +0800 Commit: Michal Privoznik <mprivozn> CommitDate: Fri Jan 9 16:01:55 2015 +0100 conf: Correctly format controller's driver https://bugzilla.redhat.com/show_bug.cgi?id=1179684 The way that we currently generate the <driver/> for <controller/> is just madness: <controller type='scsi' index='0' model='virtio-scsi'> <driver queues='12'/> <driver cmd_per_lun='123'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> It's obvious that we should be aiming at the following: <controller type='scsi' index='0' model='virtio-scsi'> <driver queues='12' cmd_per_lun='123'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> Signed-off-by: Luyao Huang <lhuang> v1.2.11-123-g97fac17
Verified as below: [root@localhost ~]# rpm -q libvirt libvirt-1.2.15-1.el7.x86_64 1. For a wrong/invalid multi-drvier line controller XML, add below device to domain, then save the XML [root@localhost ~]# cat scsi.xml <controller type='scsi' index='1' model='virtio-scsi'> <driver max_sectors='512'/> <driver queues='3'/> <driver cmd_per_lun='10'/> </controller> a. When meeting the error prompt, press "n", the <driver> is <optional> type, no <zeroOrMore> type [root@localhost ~]# virsh edit r71 error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng Extra element devices in interleave Element domain failed to validate content Failed. Try again? [y,n,i,f,?]: <==== press "n" b. When meeting the error prompt, press "i", due to virDomainControllerDefParseXML just save the elements of last <driver>, the virDomainControllerDefFormat will format the saved elements. [root@localhost ~]# virsh edit r71 error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng Extra element devices in interleave Element domain failed to validate content Failed. Try again? [y,n,i,f,?]: <==== press "i" Domain r71 XML configuration edited. [root@localhost ~]# virsh dumpxml r71 | grep "scsi" -A4 <controller type='scsi' index='1' model='virtio-scsi'> <driver cmd_per_lun='10'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </controller> <controller type='usb' index='0' model='ich9-ehci1'> 2. Using a vaild controller XML with single dirver line [root@localhost ~]# cat scsi1.xml <controller type='scsi' index='1' model='virtio-scsi'> <driver queues='3' cmd_per_lun='10' max_sectors='512'/> </controller> [root@localhost ~]# [root@localhost ~]# virsh edit r71 Domain r71 XML configuration edited. [root@localhost ~]# virsh dumpxml r71 | grep "scsi" -A4 <controller type='scsi' index='1' model='virtio-scsi'> <driver queues='3' cmd_per_lun='10' max_sectors='512'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </controller> <controller type='usb' index='0' model='ich9-ehci1'>
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. https://rhn.redhat.com/errata/RHBA-2015-2202.html