[libvirt] virsh attach-disk using files and KVM

Daniel P. Berrange berrange at redhat.com
Wed Aug 18 17:31:36 UTC 2010


On Wed, Aug 18, 2010 at 12:22:27PM -0500, Ryan Harper wrote:
> Currently virsh attach-disk interface only accepts 'file' or 'tap' for
> driver type when attaching files as disks.  One can succesfully attach
> a file as disk with:
> 
> virsh attach-disk <vm> <file> <drive> --driver file --type disk
> 
> which generates the following xml which is passed to libvirt:
> 
> 
>  <disk type='file' device='disk'>
>    <driver name='file' type='raw'/>
>    <source file='/images/test02.img'/>
>    <target dev='vdc' bus='virtio'/>
>    <alias name='virtio-disk2'/>
>    <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
>  </disk>
> 
> 
> Now, if you shutdown the guest and restart, libvirt complains that the
> driver type 'file' isn't supported.  This is from
> src/qemu/qemu_conf.c:4146 where if the driver name isn't 'qemu' it
> rejects the configuration.  
> 
> How best to resolve this?  Update qemu_conf.c to accept 'file' type?
> update virsh to allow specifying 'qemu' as a driver type for files?

No, 'file' is not the correct type for QEMU. virsh is broken - it has
no business doing any validation checks for these parameters. It must
be left upto the driver itself to validate

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list