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 1380309 - libvirt: SCSI: hostdev / controller host-plug related fixes
Summary: libvirt: SCSI: hostdev / controller host-plug related fixes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1377212
Blocks: 1343302
TreeView+ depends on / blocked
 
Reported: 2016-09-29 09:22 UTC by Marcel Kolaja
Modified: 2016-11-09 17:17 UTC (History)
9 users (show)

Fixed In Version: libvirt-1.2.17-13.el7_2.6
Doc Type: Bug Fix
Doc Text:
Previously, hot plugging a SCSI device to a guest with no usable SCSI controller failed. This update ensures that the automatic addition of the SCSI controller is performed in the correct order, and the SCSI hot plug now works properly in the described circumstances.
Clone Of: 1377212
Environment:
Last Closed: 2016-11-09 17:17:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2688 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2016-11-09 22:10:33 UTC

Description Marcel Kolaja 2016-09-29 09:22:05 UTC
This bug has been copied from bug #1377212 and has been proposed
to be backported to 7.2 z-stream (EUS).

Comment 5 yisun 2016-10-09 07:42:58 UTC
Verified on libvirt-1.2.17-13.el7_2.6.x86_64 and PASSED

===================== prepare following script, and having a powered on vm named "vm1" ======================
# cat test.sh
#!/bin/bash

# Purpose: Attach two SCSI disks to a SCSI controller '2'.  The smaller
# controller indices '1' and '0' should be automatically created.

set -x
image_dir="/var/lib/libvirt/images"
vm_name="vm1"
disk_scsi_index="2"

# Create three raw disk images
function create_disk() {
    for i in {b..c}; 
        do 
            qemu-img create -f raw $image_dir/$i.raw 512M; 
        done
}

# This is incrementing the 'unit' (a "2-digit unit number on a bus")
# attribute, for the 'address' sub-element, which describes where the
# device is placed on the virtual bus presented to the guest.
# http://libvirt.org/formatdomain.html#elementsAddress

virsh dumpxml $vm_name | grep scsi

j=1

# Construct a guest XML by attaching two SCSI disks onto the *second* controller
# (and manually increment the 'unit' number)

function attach_device() {
    for i in {b..c}; do
        j=$(expr $j + 1)
        cat << EOF > disk-$i.xml
<disk type='file' device='disk'>
  <source file='$image_dir/$i.raw'/>
  <target dev='sd$i' bus='scsi'/>
  <address type='drive' controller='$disk_scsi_index' model='virtio-scsi' bus='0' target='0' unit='$j'/>
</disk>
EOF

        # Attach the device; it takes effect on next boot
        virsh attach-device $vm_name disk-$i.xml  --live
	virsh dumpxml $vm_name | grep scsi
    done
}

create_disk
attach_device


======================= disk_scsi_index="2" in script ========================

# sh test.sh 
+ image_dir=/var/lib/libvirt/images
+ vm_name=vm1
+ disk_scsi_index=2
+ virsh dumpxml vm1
+ grep scsi
+ j=1
+ create_disk
+ for i in '{b..c}'
+ qemu-img create -f raw /var/lib/libvirt/images/b.raw 512M
Formatting '/var/lib/libvirt/images/b.raw', fmt=raw size=536870912
+ for i in '{b..c}'
+ qemu-img create -f raw /var/lib/libvirt/images/c.raw 512M
Formatting '/var/lib/libvirt/images/c.raw', fmt=raw size=536870912
+ attach_device
+ for i in '{b..c}'
++ expr 1 + 1
+ j=2
+ cat
+ virsh attach-device vm1 disk-b.xml --live
Device attached successfully

+ virsh dumpxml vm1
+ grep scsi
      <target dev='sdb' bus='scsi'/>
      <alias name='scsi2-0-0-2'/>
    <controller type='scsi' index='0'>
      <alias name='scsi0'/>
    <controller type='scsi' index='1'>
      <alias name='scsi1'/>
    <controller type='scsi' index='2'>
      <alias name='scsi2'/>
+ for i in '{b..c}'
++ expr 2 + 1
+ j=3
+ cat
+ virsh attach-device vm1 disk-c.xml --live
Device attached successfully

+ virsh dumpxml vm1
+ grep scsi
      <target dev='sdb' bus='scsi'/>
      <alias name='scsi2-0-0-2'/>
      <target dev='sdc' bus='scsi'/>
      <alias name='scsi2-0-0-3'/>
    <controller type='scsi' index='0'>
      <alias name='scsi0'/>
    <controller type='scsi' index='1'>
      <alias name='scsi1'/>
    <controller type='scsi' index='2'>
      <alias name='scsi2'/>


==============================   disk_scsi_index="10" in script    ===========
# sh test.sh 
+ image_dir=/var/lib/libvirt/images
+ vm_name=vm1
+ disk_scsi_index=10
+ virsh dumpxml vm1
+ grep scsi
+ j=1
+ create_disk
+ for i in '{b..c}'
+ qemu-img create -f raw /var/lib/libvirt/images/b.raw 512M
Formatting '/var/lib/libvirt/images/b.raw', fmt=raw size=536870912
+ for i in '{b..c}'
+ qemu-img create -f raw /var/lib/libvirt/images/c.raw 512M
Formatting '/var/lib/libvirt/images/c.raw', fmt=raw size=536870912
+ attach_device
+ for i in '{b..c}'
++ expr 1 + 1
+ j=2
+ cat
+ virsh attach-device vm1 disk-b.xml --live
Device attached successfully

+ virsh dumpxml vm1
+ grep scsi
      <target dev='sdb' bus='scsi'/>
      <alias name='scsi10-0-0-2'/>
    <controller type='scsi' index='0'>
      <alias name='scsi0'/>
    <controller type='scsi' index='1'>
      <alias name='scsi1'/>
    <controller type='scsi' index='2'>
      <alias name='scsi2'/>
    <controller type='scsi' index='3'>
      <alias name='scsi3'/>
    <controller type='scsi' index='4'>
      <alias name='scsi4'/>
    <controller type='scsi' index='5'>
      <alias name='scsi5'/>
    <controller type='scsi' index='6'>
      <alias name='scsi6'/>
    <controller type='scsi' index='7'>
      <alias name='scsi7'/>
    <controller type='scsi' index='8'>
      <alias name='scsi8'/>
    <controller type='scsi' index='9'>
      <alias name='scsi9'/>
    <controller type='scsi' index='10'>
      <alias name='scsi10'/>
+ for i in '{b..c}'
++ expr 2 + 1
+ j=3
+ cat
+ virsh attach-device vm1 disk-c.xml --live
Device attached successfully

+ virsh dumpxml vm1
+ grep scsi
      <target dev='sdb' bus='scsi'/>
      <alias name='scsi10-0-0-2'/>
      <target dev='sdc' bus='scsi'/>
      <alias name='scsi10-0-0-3'/>
    <controller type='scsi' index='0'>
      <alias name='scsi0'/>
    <controller type='scsi' index='1'>
      <alias name='scsi1'/>
    <controller type='scsi' index='2'>
      <alias name='scsi2'/>
    <controller type='scsi' index='3'>
      <alias name='scsi3'/>
    <controller type='scsi' index='4'>
      <alias name='scsi4'/>
    <controller type='scsi' index='5'>
      <alias name='scsi5'/>
    <controller type='scsi' index='6'>
      <alias name='scsi6'/>
    <controller type='scsi' index='7'>
      <alias name='scsi7'/>
    <controller type='scsi' index='8'>
      <alias name='scsi8'/>
    <controller type='scsi' index='9'>
      <alias name='scsi9'/>
    <controller type='scsi' index='10'>
      <alias name='scsi10'/>

Comment 7 errata-xmlrpc 2016-11-09 17:17:26 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-2016-2688.html


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