Yaniv Kaul
2016-Jul-14 15:54 UTC
[Libguestfs] Changing a given image from virtio-blk to virtio-scsi
Any idea what 'virt-customize' script I should use to convert from virtio-blk (vda, vdb...) to virtio-scsi (sda, sdb...) ? I've tried naively to convince libvirt to use virtio-scsi and still present it to the guest as 'vd*' - that didn't work ( <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/dev/shm/run/default/images/lago_basic_suite_master_storage_root.qcow2'/> <backingStore type='file' index='1'> <format type='raw'/> <source file='/home/lagostore/phx_repo:el7-base:latest'/> <backingStore/> </backingStore> * <target dev='vda' bus='scsi'/>* <boot order='1'/> <alias name='scsi0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> TIA, Y.
Richard W.M. Jones
2016-Jul-14 18:03 UTC
Re: [Libguestfs] Changing a given image from virtio-blk to virtio-scsi
On Thu, Jul 14, 2016 at 06:54:20PM +0300, Yaniv Kaul wrote:> Any idea what 'virt-customize' script I should use to convert from > virtio-blk (vda, vdb...) to virtio-scsi (sda, sdb...) ?You'll find that you have to recreate the initrd, else it won't boot (I'm assuming this is a Linux guest). This is somewhat complicated and involves running some commands from the guest. Here's what virt-v2v does, although virt-v2v is especially complicated because it supports doing this for everything back to RHEL 3(!) You probably only need to run dracut if you only care about modern Fedora & RHEL. https://github.com/libguestfs/libguestfs/blob/master/v2v/convert_linux.ml#L794-L921> I've tried naively to convince libvirt to use virtio-scsi and still present > it to the guest as 'vd*' - that didn't work (Yeah the target dev names in libvirt XML aren't really arbitrary strings. Device names are controlled by the *guest* kernel, nothing to do with the host which just exports one or another PCI device. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Yaniv Kaul
2016-Jul-19 11:29 UTC
Re: [Libguestfs] Changing a given image from virtio-blk to virtio-scsi
On Thu, Jul 14, 2016 at 9:03 PM, Richard W.M. Jones <rjones@redhat.com> wrote:> On Thu, Jul 14, 2016 at 06:54:20PM +0300, Yaniv Kaul wrote: > > Any idea what 'virt-customize' script I should use to convert from > > virtio-blk (vda, vdb...) to virtio-scsi (sda, sdb...) ? > > You'll find that you have to recreate the initrd, else it won't boot > (I'm assuming this is a Linux guest). > > This is somewhat complicated and involves running some commands from > the guest. Here's what virt-v2v does, although virt-v2v is especially > complicated because it supports doing this for everything back to RHEL 3(!) > You probably only need to run dracut if you only care about modern > Fedora & RHEL. > > > https://github.com/libguestfs/libguestfs/blob/master/v2v/convert_linux.ml#L794-L921 > > > I've tried naively to convince libvirt to use virtio-scsi and still > present > > it to the guest as 'vd*' - that didn't work ( > > Yeah the target dev names in libvirt XML aren't really arbitrary > strings. Device names are controlled by the *guest* kernel, nothing > to do with the host which just exports one or another PCI device. > > Rich. >Does it make more sense to just use virt-builder and build it from scratch? I did not find where in virt-builder I can actually specify virtio-scsi as the type. (BTW, the reason for all this is mainly to get 'discard' support...) Y.> -- > Richard Jones, Virtualization Group, Red Hat > http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-top is 'top' for virtual machines. Tiny program with many > powerful monitoring features, net stats, disk stats, logging, etc. > http://people.redhat.com/~rjones/virt-top >