Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1179684

Summary: Sub-element of driver "queues , cmd_per_lun, max_sectors " for controller cannot be set at the same time
Product: Red Hat Enterprise Linux 7 Reporter: Pei Zhang <pzhang>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, lhuang, mprivozn, mzhan, rbalakri, xuzhang
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.13-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 06:07:10 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:

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>
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

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