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 1031079

Summary: Wrong SCSI adapter name results in uninitialized valued to be used
Product: Red Hat Enterprise Linux 7 Reporter: Jiri Denemark <jdenemar>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: acathrow, dyuan, gsun, honzhang, mzhan, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.1.1-13.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 13:29:19 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 Jiri Denemark 2013-11-15 15:02:21 UTC
Description of problem:

When SCSI hostdev XML contains wrong adapter name (i.e., other than scsi_host[0-9]+), libvirt fails to parse it but rather than reporting an error, it uses an uninitialized value as host adapter ID.

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

libvirt-1.1.1-12.el7.x86_64

How reproducible:

100%

Steps to Reproduce:
1. define a domain with wrong SCSI adapter name (see scsi.xml below)
2. try to start it

Actual results:

error: Failed to start domain scsi
error: internal error: Failed to open /sys/bus/scsi/devices/32742:0:0:0/scsi_generic

Expected results:

Cannot parse adapter 'scsi_foo'

Additional info:

scsi.xml:

<domain type='kvm'>
  <name>scsi</name>
  <memory unit='KiB'>262144</memory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <controller type='scsi' index='0'/>
    <hostdev mode='subsystem' type='scsi' managed='no'>
      <source>
        <adapter name='scsi_foo'/>
        <address bus='0' target='0' unit='0'/>
      </source>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
</domain>

Comment 1 Jiri Denemark 2013-11-15 15:04:47 UTC
This is fixed upstream by v1.1.3-rc2-6-g11d9dd7:

commit 11d9dd7ba099c59bc3cb785ab574a84bdb255168
Author: Boris Fiuczynski <fiuczy.ibm.com>
Date:   Mon Sep 30 14:23:17 2013 +0200

    virscsi: hostdev SCSI AdapterId retrieval fix
    
    Fixed the retrieval of the AdapterId from the AdapterName of the
    hostdev source so it does return an error instead of leaving the
    adapter_id uninitialized.
    
    Signed-off-by: Boris Fiuczynski <fiuczy.ibm.com>
    Reviewed-by: Viktor Mihajlovski <mihajlov.ibm.com>

Comment 4 Xuesong Zhang 2013-11-27 08:51:00 UTC
Verified with the latest libvirt build libvirt-1.1.1-13.el7.x86_64, this bug is passed.

Steps:
1. add the following scsi device to the guest xml.
<hostdev mode='subsystem' type='scsi' managed='no'>
      <source>
        <adapter name='scsi_hostfoo'/>
        <address bus='0' target='0' unit='0'/>
      </source>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </hostdev>

2. start the guest.
# virsh start r7-1121
error: Failed to start domain r7-1121
error: internal error: Cannot parse adapter 'scsi_hostfool'

3. change the adapter name to "scsi_host2", the host only have "scsi_host0" and "scsi_host1", didn't have "scsi_host2". Then start the guest again, the error message is as expected.
# virsh start r7-1121
error: Failed to start domain r7-1121
error: internal error: Failed to open /sys/bus/scsi/devices/2:0:0:0/scsi_generic

Comment 5 Ludek Smid 2014-06-13 13:29:19 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.