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.
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#L7...
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
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#L7...
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
On Tue, Jul 19, 2016 at 02:29:11PM +0300, Yaniv Kaul wrote:
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.
virt-builder images should boot on virtio-scsi "out of the box", certainly the x86-64 ones. If you like you can check what drivers are supported by the initrd like this: $ virt-builder --arch x86_64 fedora-23 $ virt-get-kernel -a fedora-23.img download: /boot/vmlinuz-4.4.6-300.fc23.x86_64 -> ./vmlinuz-4.4.6-300.fc23.x86_64 download: /boot/initramfs-4.4.6-300.fc23.x86_64.img -> ./initramfs-4.4.6-300.fc23.x86_64.img $ zcat initramfs-4.4.6-300.fc23.x86_64.img | cpio -it | grep virtio usr/lib/modules/4.4.6-300.fc23.x86_64/kernel/drivers/block/virtio_blk.ko.xz usr/lib/modules/4.4.6-300.fc23.x86_64/kernel/drivers/char/hw_random/virtio-rng.ko.xz usr/lib/modules/4.4.6-300.fc23.x86_64/kernel/drivers/char/virtio_console.ko.xz usr/lib/modules/4.4.6-300.fc23.x86_64/kernel/drivers/scsi/virtio_scsi.ko.xz usr/lib/modules/4.4.6-300.fc23.x86_64/kernel/drivers/virtio usr/lib/modules/4.4.6-300.fc23.x86_64/kernel/drivers/virtio/virtio.ko.xz usr/lib/modules/4.4.6-300.fc23.x86_64/kernel/drivers/virtio/virtio_pci.ko.xz usr/lib/modules/4.4.6-300.fc23.x86_64/kernel/drivers/virtio/virtio_ring.ko.xz 51087 blocks Hence that particular guest should support booting from virtio-blk or virtio-scsi. 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
participants (2)
-
Richard W.M. Jones -
Yaniv Kaul