Submitted by mcordas on Tue, 10/19/2010 - 15:17 Pro Licensee
Hi,
I just updated Cloudmin to 4.9, and saw the new possibility to create VMs with virtio network and disk drivers.
But, is it possible to update exsiting VM's with Virtio drivers ?
Thanks,
Miguel.
Status:
Active
Comments
Submitted by JamieCameron on Tue, 10/19/2010 - 15:31 Comment #1
Do you mean to add a disk using virtIO to an existing VM? Or switch existing disks to virtIO?
Submitted by mcordas on Tue, 10/19/2010 - 15:37 Pro Licensee Comment #2
Yes, I mean switch disk and network driver to virtio.
Submitted by JamieCameron on Tue, 10/19/2010 - 16:09 Comment #3
The network driver can be switched on the Network Interfaces page, by selecting a different model for eth0.
The disk driver cannot be switched without manually editing the cloudmin config file for the VM, as this also requires that /etc/fstab on the host by modified to use /dev/vda instead of /dev/hda . If you are willing to do this, the steps are :
cloudmin list-systems --host yourkvminstance --id-only
/etc/webmin/servers/XXX.serv
, where XXX is the unique IDkvm_drives
line , add,if=virtio
to the options for each diskThis is kind of risky though, as the VM may not boot if the kernel doesn't support virtIO. That's why Cloudmin doesn't currently offer a way to do in via the UI.
Submitted by mcordas on Wed, 10/20/2010 - 01:23 Pro Licensee Comment #4
Did that for the Network driver. I'll test the hard disk part on a test VM.
Thanks !
Submitted by mcordas on Thu, 11/04/2010 - 05:15 Pro Licensee Comment #5
Tested it today for disk driver, and it was a no-go... "No bootable disk found" error.
To be able to boot the VM again, I had to mount it's LVM disk on another VM, revert /etc/fstab to "/dev/hda1", and replace "if=virtio" by "if=ide" in the config file.
I tried to create a new VM with virtio, and it's booting correctly on /dev/vda1.
So I guess we're missing something in the steps to migrate a VM from ide to virtio.
P.S : No problem to migrate network driver to virtio, though.
Submitted by mcordas on Thu, 11/04/2010 - 11:41 Pro Licensee Comment #6
Just had time to investigate a little bit :
on the new VM, wich works with virtio block device, lsmod | grep virtio gives :
virtio_balloon 39877 0
virtio_net 47425 0
virtio_blk 41417 2
virtio_pci 41417 0
virtio_ring 37441 1 virtio_pci
virtio 39365 4 virtio_balloon,virtio_net,virtio_blk,virtio_pci
On the other one, wich didn't work with virtio, the same comman gives :
virtio_net 47424 0
virtio_balloon 39877 0
virtio_pci 41545 0
virtio_ring 37441 1 virtio_pci
virtio 39365 3 virtio_net,virtio_balloon,virtio_pci
So... the virtio block device driver isn't loaded in the kernel. Have to find how to load that kernel module permanently.
P.S: by the way, why does this form remove all CR ? I have to manually add empty lines to prevent it to concat lines... strange.
Submitted by JamieCameron on Thu, 11/04/2010 - 13:30 Comment #7
I just realized that I forgot something in my instructions - when editing the
kvm_drives=
line, you need to add,if=virtio,boot=on
to allow the system to boot from that disk.Submitted by mcordas on Thu, 11/04/2010 - 18:28 Pro Licensee Comment #8
Ok, I'll give a try.
But meanwhile, I found that :
"When switching from IDE to virtio, you need to first build a new initrd in the guest with e.g.:
$> mkinitrd --with virtio_pci --with virtio_blk -f /boot/initrd-$(kernelversion) $(kernelversion)
You only need to do this once. After that, if a new kernel is installed while you're booted off a virtio disk, then mkinitrd will include the modules automatically."
Source : http://www.mail-archive.com/fedora-xen@redhat.com/msg02538.html
Do you think it's relevant in this case ?
Side question : to revert /etc/fstab, I had to attach the image to another VM (I was glad I had a test VM I could reboot). Is there an easy way to mount an VM's LVM Volume on the host, in order to be able to modify files in its filesystem ?
Submitted by JamieCameron on Thu, 11/04/2010 - 18:36 Comment #9
Yes, you might need to build a new initrd. Although I haven't tested this, as I usually do a complete fresh install into a VirtIO VM.
As for access to files, the easiest way is using Cloudmin's command-line API, which can access files even when a virtual machine is down. It does this by mounting the disk image on the host system as needed. See :
http://www.virtualmin.com/documentation/cloudmin/devel/cli
and
http://www.virtualmin.com/documentation/cloudmin/devel/cli/cloudmin_file...
Submitted by mcordas on Fri, 11/05/2010 - 01:18 Pro Licensee Comment #10
Ok. I'll keep you in touch as soon as I can test again the procedure.