Bug 1179684 - Sub-element of driver "queues , cmd_per_lun, max_sectors " for controller cannot be set at the same time
Summary: Sub-element of driver "queues , cmd_per_lun, max_sectors " for controller can...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-07 10:33 UTC by Pei Zhang
Modified: 2015-11-19 06:07 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:07:10 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Pei Zhang 2015-01-07 10:33:52 UTC
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 .

Comment 1 Michal Privoznik 2015-01-09 15:17:59 UTC
I've just pushed the patch upstream:

commit 97fac17c77d9bdfacafff1c5c39b2df3c1530614
Author:     Luyao Huang <lhuang@redhat.com>
AuthorDate: Wed Jan 7 18:39:37 2015 +0800
Commit:     Michal Privoznik <mprivozn@redhat.com>
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@redhat.com>

v1.2.11-123-g97fac17

Comment 3 Hu Jianwei 2015-05-18 11:42:00 UTC
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'>

Comment 5 errata-xmlrpc 2015-11-19 06:07:10 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.

https://rhn.redhat.com/errata/RHBA-2015-2202.html


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