Re: [et-mgmt-tools] Re: [libvirt] RE: [Qemu-devel] [ANNOUNCE] virt-mem tools version 0.2.8 released

james
2008-08-12T10:25:52Z

On 11/08/2008, at 8:42 PM, Daniel P. Berrange wrote:

> On Mon, Aug 11, 2008 at 09:18:19AM +0100, Richard W.M. Jones wrote:
>> On Mon, Aug 11, 2008 at 07:39:34PM +1200, james wrote:
>>>> This is what libvirt gives you (and lots more, eg. secure remote
>>>> access to hypervisors, bindings to Perl & many other languages,
>>>> etc.).
>>>> Can you be more specfic about what you couldn't do with libvirt?
>>>
>>> I can give you such an example although I confess it could be due
>>> to my
>>> lack of understanding of the libvirt config. I have tried and
>>> tried to
>>> use libvirt to configure VMs within KVM using scsi disk images.
>>> Usually
>>> when tinkering/experimenting with RAID setups. It just will not
>>> take it.
>>> Starting a KVM based VM from the command line with the appropriate
>>> settings and I have no problems. This inability to use scsi within
>>> libvirt has been extremely frustrating until I took the plunge and
>>> went
>>> to to kvm command line.
>>>
>>> However if you can point out an example xml config for a VM using
>>> scsi
>>> disk images that works then that would be very cool
>
> Configuring SCSI disks with VMs in libvirt is no different to
> configuring
> any other kind of block based storage. The general description is
> here:
>
> http://libvirt.org/formatdomain.html#elementsDisks
>
> Specifically though you'd want a disk section looking like
>
> <disk type='block'>
>
> <target dev='sda' bus='scsi'/>
> </disk>
>
> NB, there is no restriction on mapping to the target bus -ie a SCSI
> disk in
> the host can be mapped to a IDE disk in the guest, and vica-verca.
> Also
> note that the 'dev' attribute on the target isn't a guarenteed
> device name
> in the guest - it is merely used for ordering of devices when
> spawning QEMU.
>
> Now, the main fun you'll have is actually outside of libvirt -
> namely that
> on Linux SCSI disk names are not guarenteed stable across reboots. So
> rather than using /dev/sdf1 you may want to consider one of the udev
> created
> stable paths under the directories /dev/disk/by-{id,path,uuid}, or
> if you are
> using a multipath enabled SAN, then a name under /dev/multipath/XXXX
>
> Regards,
> Daniel

To be clear I have not tried to use block devices but 5 image files as
I am experimenting. I have tried to create VMs using raw image files
under libvirt via the nice Virtual Machine Manager 0.5.3 and through
hand crafted xml files. Neither method will register the images as
scsi disks, it fails with an error. Getting the same disk images to be
regarded as scsi disks via the kvm command line is fine or if I fall
back to ide and limit. The ide test proves that the rest of the xml
file is correct.

Trying to define a domain using virsh using a disk section defined as:

<disk type='file' device='disk'>

<target dev='sda' bus='scsi'/>
</disk>

fails with this error:
libvir: QEMU error : Invalid harddisk device name: sda

Heck if I have missed the wood for the trees and there is a simple
correction to this definition that will make it work I would be one
happy camper.

Cheers.

-- James.