Tux's lil' helper
Joined: 15 Feb 2012
|Posted: Mon Apr 15, 2013 2:12 pm Post subject: question about <controller> element of libvirt
|I'm confused with the logical relationship of <address> and <controller>.
My understanding of <controller>:
1. one <controller> means one bus.
2. <controller> has a "type" attribute, it is als the bus type.
3. each controller has a mandatory attribute type, which must be one of "ide", "fdc", "scsi", "sata", "usb", "ccid", or "virtio-serial" -- from libvirt doc
4. every type of controller has a isolated index space, which means I can have "ide controller 0", "ide contoller 1" and "pci controller 0", "pci controller 1" and also "usb controller 0", "usb controller 1"
My understanding of <address> sub-element in <disk>:
1. the type attribute is mandatory, and is typically "pci" or "drive". -- from libvirt doc
<address type='pci'> is clear, but what does type='drive' mean? type='drive' doesn't match any controller type above.
If I have a virtual ide disk, can't I use <address type='ide' ...> directly?
|For <address> sub-element of <disk>,
Drive addresses have the following additional attributes: controller (a 2-digit controller number), bus (a 2-digit bus number), target (a 2-digit bus number), and unit (a 2-digit unit number on the bus).
|For <target> sub-element of <disk>,
The target element controls the bus / device under which the disk is exposed to the guest OS. The dev attribute indicates the "logical" device name. The actual device name specified is not guaranteed to map to the device name in the guest OS. Treat it as a device ordering hint. The optional bus attribute specifies the type of disk device to emulate; possible values are driver specific, with typical values being "ide", "scsi", "virtio", "xen", "usb" or "sata". If omitted, the bus type is inferred from the style of the device name (e.g. a device named 'sda' will typically be exported using a SCSI bus). ...
Since one controller maps one bus, then why <address type='drive'> has both a "controller" and a "bus" attribute?
<address unit=x> is a way to specify disk sequence, and <target dev='sdb'> is another way to do the same thing.
So I think they must be the same? Can I just omit "dev='sdb'"?
I think it's critical in the case of <target dev='sdb' bus='virtio'> and <target dev='vdb' bus='virtio'>, so libvirt can tell qemu to use virtio-scsi-pci or virtio-blk-pci?