Bug 781981

Summary: libvirt should show some error when start the guest which disk's dev and bus is not fit
Product: Red Hat Enterprise Linux 6 Reporter: Huang Wenlong <whuang>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, cwei, dallan, gsun, mzhan, rwu, tzheng, weizhan
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-17 21:04:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Huang Wenlong 2012-01-16 09:07:13 UTC
Description of problem:
libvirt should show some error  when start the guest which  disk's dev and bus is not fit

<target dev='hda' bus='virtio'/> and <target dev='vdb' bus='ide'/>


Version-Release number of selected component (if applicable):
libvirt-0.9.9-1.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. edit guest's xml
#virsh edit $guest

disk like this :
<target dev='hda' bus='virtio'/> or <target dev='vda' bus='ide'/>

2. start the guest
#virsh start q2
Domain q2 started

3. no error or warning
# virsh dumpxml q2

...
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/lib/libvirt/images/q2.img'/>
<target dev='hda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
...

in the guest

disk is  /dev/vda


Actual results:
not fit but no check

Expected results:
show some message when disk dev and bus is not fit

Additional info:

Comment 3 Jiri Denemark 2012-01-17 21:04:16 UTC
I don't really think this is worth fixing. Target dev doesn't really mean anything, it is merely used to easily identify the device (when using virsh commands, for example) and for sorting devices on the same bus. This is also explicitly mentioned in domain XML documentation. Target dev doesn't have to match the in-guest device name and if you run any BSD system or even Windows as a guest, the in-guest device name will not be even close to target dev. Actually since libata started to include drivers for IDE controles, the correspondence doesn't work in Linux either (<target dev='hdc' bus='ide'/> will most likely be /dev/sr0 in a guest). Not to mention that one can rename the devices easily with udev.

In other words, I don't think we should pretend there's something special about target dev and enforce unnecessary relation between dev and bus.

Comment 4 Dave Allan 2012-01-17 21:15:37 UTC
Agreed; sometimes I wish that we hadn't even included the target dev, since it's really quite meaningless.