Hide Forgot
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>
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>
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
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.