Bug 1583623 - Attach scsi controller with 'driver' configured to VM will raise confusing error info
Summary: Attach scsi controller with 'driver' configured to VM will raise confusing er...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.6
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: jiyan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-29 11:42 UTC by jiyan
Modified: 2018-10-30 09:57 UTC (History)
7 users (show)

Fixed In Version: libvirt-4.5.0-1.el7
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2018-10-30 09:55:31 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3113 None None None 2018-10-30 09:57:51 UTC

Description jiyan 2018-05-29 11:42:24 UTC
Description of problem:
Attach scsi controller with 'driver' configured to VM will raise confusing error info

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.12.0-2.el7.x86_64
libvirt-4.3.0-1.el7.x86_64
kernel-3.10.0-893.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a running VM without defining scsi controller and the following 2 XML files describing different scsi controllers
# virsh domstate test1
running

# virsh dumpxml test1 |grep "scsi"
No output

# virsh dumpxml test1 |grep "iothreads"
<iothreads>1</iothreads>

# cat controller.xml
<controller type='scsi' index='0' model='virtio-scsi'>
<alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
</controller>

# cat controller-io.xml
<controller type='scsi' index='0' model='virtio-scsi'>
<driver iothread='1'/>
<alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
</controller>

3. Attach controller-io.xml to VM
[root@hp-dl385g7-05 test1]error: Failed to attach device from controller-io.xml
error: unsupported configuration: IOThreads only available for virtio pci and virtio ccw controllers

# virsh attach-device test1 controller-io.xml --config
error: Failed to attach device from controller-io.xml
error: unsupported configuration: IOThreads only available for virtio pci and virtio ccw controllers

4. Attach controller.xml to VM
# virsh attach-device test1 controller.xml
Device attached successfully

# virsh attach-device test1 controller.xml --config
Device attached successfully

# virsh dumpxml test1 |grep "<controller" -A10
    <controller type='scsi' index='0' model='virtio-scsi'>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>

# virsh dumpxml test1 --inactive |grep "<controller" -A10
    <controller type='scsi' index='0' model='virtio-scsi'>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>

Actual results:
As step-3 shows

Expected results:
If libvirt does not supported attaching scsi controller with driver configured, should give proper error info. [Additional info shows 'IOThreads' is available for 'scsi' controller]. Otherwise, since scsi controller can be attached directly, scsi controller with driver configured should be aupported, too.

Additional info:
Prepare a VM with the following configuration and start VM
# virsh domstate test1
shut off

# virsh dumpxml test1 |grep "<controller type='scsi'"  -A4
    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver iothread='1'/>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>

# virsh dumpxml test1 |grep "iothreads"
  <iothreads>1</iothreads>

# virsh start test1
Domain test1 started

# ps -ef |grep test1 |sed 's/-device/\n-device/g'
-device virtio-scsi-pci,iothread=iothread1,id=ua-933bddac-e36c-4841-a196-b2054268a308,bus=pci.2,addr=0x0

Comment 2 John Ferlan 2018-06-07 00:24:49 UTC
Posted a couple of patches upstream to handle this issue:

https://www.redhat.com/archives/libvir-list/2018-June/msg00510.html

The first one clarifies an error message when the controller->index was already found.  The second one allows no <addresss> to be provided in the attaching XML.

Comment 3 John Ferlan 2018-06-11 22:58:06 UTC
Patches were pushed upstream with a minor adjustment to split things up a bit more:

$ git show 
commit 4e3a9daa6668051f1d8669e989ae7594c4e22619 
Author: John Ferlan <jferlan@redhat.com>
Date:   Wed Jun 6 20:21:26 2018 -0400

    qemu: Allow no address to be defined for virtio-scsi iothread attach
    
...
    
    When attaching a virtio-scsi with IOThreads for the config of a
    live domain, allow the <address> to not be defined thus allowing
    post parse processing to fill in the address. This allows parsing
    of an individual device to succeed for attach config.
    
    Signed-off-by: John Ferlan <jferlan@redhat.com>
    Reviewed-by: Ján Tomko <jtomko@redhat.com>

...

$ git describe 4e3a9daa6668051f1d8669e989ae7594c4e22619
v4.4.0-198-g4e3a9daa66
$

Comment 6 jiyan 2018-07-04 02:05:09 UTC
Version:
kernel-3.10.0-918.el7.x86_64
qemu-kvm-rhev-2.12.0-6.el7.x86_64
libvirt-4.5.0-1.el7.x86_64

S1: Cold-plug/Hot-plug/Cold-unplug/Hot-unplug SCSI controller without driver
# virsh domstate b1
running

# virsh dumpxml b1 |grep "iothread"
  <iothreads>1</iothreads>
  <iothreadids>
    <iothread id='1'/>
  </iothreadids>

# cat controller-nodriver.xml 
<controller type='scsi' index='0' model='virtio-scsi'>
<alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
</controller>

# virsh attach-device b1 controller-nodriver.xml --config
Device attached successfully

# virsh dumpxml b1 --inactive|grep "<controller type='scsi'" -A3
    <controller type='scsi' index='0' model='virtio-scsi'>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>

# virsh attach-device b1 controller-nodriver.xml 
Device attached successfully

# virsh dumpxml b1 |grep "<controller type='scsi'" -A3
    <controller type='scsi' index='0' model='virtio-scsi'>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>

# virsh detach-device-alias b1 ua-933bddac-e36c-4841-a196-b2054268a308 --config
Device detach request sent successfully

# virsh detach-device-alias b1 ua-933bddac-e36c-4841-a196-b2054268a308 
Device detach request sent successfully

# virsh dumpxml b1 --inactive|grep "<controller type='scsi'" -A3
No output

# virsh dumpxml b1 |grep "<controller type='scsi'" -A3
No output

S2: Cold-plug/Hot-plug/Cold-unplug/Hot-unplug SCSI controller with driver
# virsh domstate b1
running

# virsh dumpxml b1 |grep "iothread"
  <iothreads>1</iothreads>
  <iothreadids>
    <iothread id='1'/>
  </iothreadids>

# cat controller-driver.xml 
<controller type='scsi' index='0' model='virtio-scsi'>
<driver iothread='1'/>
<alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
</controller>

# virsh attach-device b1 controller-driver.xml 
Device attached successfully

# virsh dumpxml b1 |grep "<controller type='scsi'" -A4
    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver iothread='1'/>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>

# virsh attach-device b1 controller-driver.xml --config
Device attached successfully

# virsh dumpxml b1 --inactive|grep "<controller type='scsi'" -A4
    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver iothread='1'/>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>

# virsh detach-device-alias b1 ua-933bddac-e36c-4841-a196-b2054268a308
Device detach request sent successfully

# virsh detach-device-alias b1 ua-933bddac-e36c-4841-a196-b2054268a308 --config
Device detach request sent successfully

# virsh dumpxml b1 |grep "<controller type='scsi'" -A4
No output

# virsh dumpxml b1 --inactive|grep "<controller type='scsi'" -A4
No output

S3: Cold-plug/Hot-plug/Cold-unplug/Hot-unplug 2 SCSI controllers with driver
# virsh domstate b1
running

# virsh dumpxml b1 |grep "iothread"
  <iothreads>1</iothreads>
  <iothreadids>
    <iothread id='1'/>
  </iothreadids>

# cat controller-driver.xml 
<controller type='scsi' index='0' model='virtio-scsi'>
<driver iothread='1'/>
<alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
</controller>

# cat controller-driver-1.xml 
<controller type='scsi' index='1' model='virtio-scsi'>
<driver iothread='1'/>
<alias name='ua-933bddac-e36c-4841-a196-b2054268a309'/>
</controller>

# virsh attach-device b1 controller-driver.xml 
Device attached successfully

# virsh attach-device b1 controller-driver-1.xml 
Device attached successfully

# virsh dumpxml b1 |grep "<controller type='scsi'" -A4
    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver iothread='1'/>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>
    <controller type='scsi' index='1' model='virtio-scsi'>
      <driver iothread='1'/>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a309'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </controller>

# virsh attach-device b1 controller-driver.xml --config
Device attached successfully

# virsh attach-device b1 controller-driver-1.xml --config
Device attached successfully

# virsh dumpxml b1 --inactive|grep "<controller type='scsi'" -A4
    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver iothread='1'/>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>
    <controller type='scsi' index='1' model='virtio-scsi'>
      <driver iothread='1'/>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a309'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </controller>

# virsh detach-device-alias b1 ua-933bddac-e36c-4841-a196-b2054268a308
Device detach request sent successfully

# virsh detach-device-alias b1 ua-933bddac-e36c-4841-a196-b2054268a308 --config
Device detach request sent successfully

# virsh detach-device-alias b1 ua-933bddac-e36c-4841-a196-b2054268a309
Device detach request sent successfully

# virsh detach-device-alias b1 ua-933bddac-e36c-4841-a196-b2054268a309 --config
Device detach request sent successfully

# virsh dumpxml b1 --inactive|grep "<controller type='scsi'" -A4
No output

# virsh dumpxml b1 |grep "<controller type='scsi'" -A4
No output

S4: Cold-plug/Hot-plug/Cold-unplug/Hot-unplug 2 SCSI controllers with driver in same index
# virsh domstate b1
running

# cat controller-driver.xml 
<controller type='scsi' index='0' model='virtio-scsi'>
<driver iothread='1'/>
<alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
</controller>

# cat controller-driver-1.xml 
<controller type='scsi' index='0' model='virtio-scsi'>
<driver iothread='1'/>
<alias name='ua-933bddac-e36c-4841-a196-b2054268a309'/>
</controller>

# virsh attach-device b1 controller-driver.xml 
Device attached successfully

# virsh attach-device b1 controller-driver-1.xml 
error: Failed to attach device from controller-driver-1.xml
error: operation failed: target scsi:0 already exists

S5: Cold-plug/Hot-plug/Cold-unplug/Hot-unplug 2 SCSI controllers with driver in same address
# virsh domstate b1
running

# cat controller-driver.xml 
    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver iothread='1'/>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a308'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>

# cat controller-driver-1.xml 
    <controller type='scsi' index='1' model='virtio-scsi'>
      <driver iothread='1'/>
      <alias name='ua-933bddac-e36c-4841-a196-b2054268a309'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>

# virsh attach-device b1 controller-driver.xml 
Device attached successfully

# virsh attach-device b1 controller-driver-1.xml 
error: Failed to attach device from controller-driver-1.xml
error: XML error: Attempted double use of PCI Address 0000:00:08.0

All the test results are as expected, move this bug to be verified.

Comment 8 errata-xmlrpc 2018-10-30 09:55:31 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://access.redhat.com/errata/RHSA-2018:3113


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