Bug 1325485 - [3.6 only] SCSI pass through [via hook] does not work
Summary: [3.6 only] SCSI pass through [via hook] does not work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: vdsm
Version: 3.6.4
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ovirt-3.6.6
: 3.6.6
Assignee: Martin Polednik
QA Contact: Nisim Simsolo
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-09 06:19 UTC by Roman Hodain
Modified: 2020-02-14 17:49 UTC (History)
17 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-30 09:16:18 UTC
oVirt Team: Virt
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Hook file example (2.58 KB, text/plain)
2016-05-16 11:44 UTC, Nisim Simsolo
no flags Details
hook example without sudo=True (2.26 KB, text/x-python)
2016-12-26 13:06 UTC, Nisim Simsolo
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 55957 0 ovirt-3.6 MERGED hostdev: ignore scsi devices when retrieving addresses 2020-04-22 02:06:52 UTC

Description Roman Hodain 2016-04-09 06:19:40 UTC
Description of problem:
SCSI passthrough does not work. Any VM with passthrough SCSI device will fail to start.

Version-Release number of selected component (if applicable):
RHEV 3.6.4

How reproducible:
100%

Steps to Reproduce:
1. Pass an SCSI device to the VM and try to start.

Actual results:
Thread-4102::ERROR::2016-04-09 02:03:01,722::vm::759::virt.vm::(_startUnderlyingVm) vmId=`a774093d-fb09-4fb7-aff3-989d7c3755c1`::The vm start process failed
Traceback (most recent call last):
  File "/usr/share/vdsm/virt/vm.py", line 703, in _startUnderlyingVm
    self._run()
  File "/usr/share/vdsm/virt/vm.py", line 1941, in _run
    self._connection.createXML(domxml, flags),
  File "/usr/lib/python2.7/site-packages/vdsm/libvirtconnection.py", line 124, in wrapper
    ret = f(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/vdsm/utils.py", line 1313, in wrapper
    return func(inst, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3611, in createXML
    if ret is None:raise libvirtError('virDomainCreateXML() failed', conn=self)
libvirtError: XML error: 'bus', 'target', and 'unit' must be specified for scsi hostdev source address


Expected results:
VM starts and the SCSI device is present to the guest.

Additional info:
Thread-4102::INFO::2016-04-09 02:03:01,720::vm::1932::virt.vm::(_run) vmId=`a774093d-fb09-4fb7-aff3-989d7c3755c1`::<?xml version="1.0" encoding="utf-8"?>
<domain type="kvm" xmlns:ovirt="http://ovirt.org/vm/tune/1.0">
        <name>test</name>
        <uuid>a774093d-fb09-4fb7-aff3-989d7c3755c1</uuid>
        <memory>3001344</memory>
        <currentMemory>3001344</currentMemory>
        <maxMemory slots="16">4294967296</maxMemory>
        <vcpu current="1">16</vcpu>
        <devices>
                <channel type="unix">
                        <target name="com.redhat.rhevm.vdsm" type="virtio"/>
                        <source mode="bind" path="/var/lib/libvirt/qemu/channels/a774093d-fb09-4fb7-aff3-989d7c3755c1.com.redhat.rhevm.vdsm"/>
                </channel>
                <channel type="unix">
                        <target name="org.qemu.guest_agent.0" type="virtio"/>
                        <source mode="bind" path="/var/lib/libvirt/qemu/channels/a774093d-fb09-4fb7-aff3-989d7c3755c1.org.qemu.guest_agent.0"/>
                </channel>
                <input bus="ps2" type="mouse"/>
                <hostdev managed="no" mode="subsystem" type="scsi">
                        <source>
                                <address bus="0" host="4" lun="0" target="0"/>
                        </source>
                </hostdev>
                <memballoon model="virtio">
                        <address bus="0x00" domain="0x0000" function="0x0" slot="0x07" type="pci"/>
                </memballoon>
                <controller index="0" model="virtio-scsi" type="scsi">
                        <address bus="0x00" domain="0x0000" function="0x0" slot="0x04" type="pci"/>
                </controller>
                <controller index="0" ports="16" type="virtio-serial">
                        <address bus="0x00" domain="0x0000" function="0x0" slot="0x05" type="pci"/>
                </controller>
                <video>
                        <address bus="0x00" domain="0x0000" function="0x0" slot="0x02" type="pci"/>
                        <model heads="1" ram="65536" type="qxl" vgamem="16384" vram="8192"/>
                </video>
                <graphics autoport="yes" listen="0" passwd="*****" passwdValidTo="1970-01-01T00:00:01" port="-1" tlsPort="-1" type="spice"/>
                <interface type="bridge">
                        <address bus="0x00" domain="0x0000" function="0x0" slot="0x03" type="pci"/>
                        <mac address="00:1a:4a:16:01:51"/>
                        <model type="virtio"/>
                        <source bridge="ovirtmgmt"/>
                        <filterref filter="vdsm-no-mac-spoofing"/>
                        <link state="up"/>
                        <bandwidth/>
                </interface>
                <disk device="cdrom" snapshot="no" type="file">
                        <address bus="1" controller="0" target="0" type="drive" unit="0"/>
                        <source file="" startupPolicy="optional"/>
                        <target bus="ide" dev="hdc"/>
                        <readonly/>
                        <serial/>
                </disk>
                <disk device="disk" snapshot="no" type="file">
                        <address bus="0x00" domain="0x0000" function="0x0" slot="0x06" type="pci"/>
                        <source file="/rhev/data-center/00000001-0001-0001-0001-00000000022f/9f9069ba-8221-4fad-9ae7-e50a604f0881/images/485dcbe8-bae7-4fe6-be8f-c7e0b57dcc8c/bff788be-6c63-46a7-bbc5-af44b3e3e62b"/>
                        <target bus="virtio" dev="vda"/>
                        <serial>485dcbe8-bae7-4fe6-be8f-c7e0b57dcc8c</serial>
                        <boot order="1"/>
                        <driver cache="none" error_policy="stop" io="threads" name="qemu" type="raw"/>
                </disk>
                <channel type="spicevmc">
                        <target name="com.redhat.spice.0" type="virtio"/>
                </channel>
        </devices>
        <metadata>
                <ovirt:qos/>
        </metadata>
        <os>
                <type arch="x86_64" machine="pc-i440fx-rhel7.2.0">hvm</type>
                <smbios mode="sysinfo"/>
        </os>
        <sysinfo type="smbios">
                <system>
                        <entry name="manufacturer">Red Hat</entry>
                        <entry name="product">RHEV Hypervisor</entry>
                        <entry name="version">7.2-9.el7</entry>
                        <entry name="serial">32393735-3733-5A43-4A32-32343030574E</entry>
                        <entry name="uuid">a774093d-fb09-4fb7-aff3-989d7c3755c1</entry>
                </system>
        </sysinfo>
        <clock adjustment="0" offset="variable">
                <timer name="rtc" tickpolicy="catchup"/>
                <timer name="pit" tickpolicy="delay"/>
                <timer name="hpet" present="no"/>
        </clock>
        <features>
                <acpi/>
        </features>
        <cpu match="exact">
                <model>Westmere</model>
                <topology cores="1" sockets="16" threads="1"/>
                <numa>
                        <cell cpus="0" memory="3001344"/>
                </numa>
        </cpu>
</domain>

Comment 2 Yaniv Kaul 2016-04-10 07:21:09 UTC
Once fixed, please consider backport to 3.6.z, depending on the complexity of the fix.

Comment 3 Michal Skrivanek 2016-04-11 07:50:04 UTC
SCSI passthrough is not supported in 3.6. You should pass the whole controller as a PCI device.

Comment 4 Michal Skrivanek 2016-04-11 12:07:38 UTC
though the 3.6 code broke any scsi device passed through unintentionally.
We should trivially fix this asap

Comment 5 Michal Skrivanek 2016-04-11 12:32:10 UTC
note: 4.0 code change is not needed as that is superseded by bug 1270581 already in progress and partially in

Comment 7 Aharon Canan 2016-04-11 14:40:03 UTC
I just looked at this bug and I feel like I am missing something here.

I verified bug #1291930 which talks about running VM with direct lun and virtio-scsi + passthrough - it worked fine with versions below.

rhevm-3.6.5.1-0.1.el6.noarch   vdsm-4.17.25-0.el7ev.noarch

We also have it in our automation but it seems like we have some problems with RestAPI which we are opening bugs for.

Comment 8 Michal Skrivanek 2016-04-11 15:12:25 UTC
there is also engine side problem that host devices are being send regardless the managed/unmanaged status. That must be fixed as well, in addition to gerrit 55957. 
postponing to 3.6.6

Comment 9 Michal Skrivanek 2016-04-11 15:13:41 UTC
(In reply to Aharon Canan from comment #7)
> I just looked at this bug and I feel like I am missing something here.
> 
> I verified bug #1291930 which talks about running VM with direct lun and
> virtio-scsi + passthrough - it worked fine with versions below.

this bug is not about direct luns/disks, but non-disk devices(e.g. a tape drive)

Comment 10 Nisim Simsolo 2016-05-16 11:44:21 UTC
Created attachment 1157848 [details]
Hook file example

Comment 11 Nisim Simsolo 2016-05-16 11:50:45 UTC
Verified:
rhevm-3.6.6.2-0.1.el6
qemu-kvm-rhev-2.3.0-31.el7_2.11.x86_64
vdsm-4.17.28-0.el7ev.noarch
libvirt-client-1.2.17-13.el7_2.4.x86_64

Verification scenario:
1. Add hook file under /usr/libexec/vdsm/hooks/before_vm_start/ (see attached hook for an example).
2. Chown scsi device to qemu:qemu (/dev/sg[device_id]). 
3. Run VM
4. Observe vdsm.log for VM XML file and verify device attached to VM.
5. Open VM console and verify it can see attached device.

Comment 12 Michal Skrivanek 2016-05-30 09:16:18 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-1112.html

Comment 16 Nisim Simsolo 2016-12-26 13:06:02 UTC
Created attachment 1235391 [details]
hook example without sudo=True


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