Difference between revisions of "KVM"

From Blue-IT.org Wiki

(Using VirtualBox and KVM together)
(Migration from VirtualBox to KVM)
Line 16: Line 16:
 
== Migration from VirtualBox to KVM ==
 
== Migration from VirtualBox to KVM ==
 
This boils down to
 
This boils down to
# creating a clone of the vbox-machine (easiest way of getting rid of snapshots for a play vbox-disk)
+
# creating a clone of the vbox-machine with ''VBoxManage clonehd'' (this can take a looooong time!). Kloning is the easiest way of getting rid of snapshots of an existing virtual machine.
# converting the images from vbox to qcow
+
# converting the images from ''vdi'' to ''qcow''-format with ''qemu-img convert''
 
# creating and configuring a new kvm-guest
 
# creating and configuring a new kvm-guest
# adding some NAT-fu (see next section)
+
# adding some fou to NAT with a qemu-''hook'' (see next section)
  
 
* http://serverfault.com/questions/249944/how-to-export-a-specific-virtualbox-snapshot-as-a-raw-disk-image/249947#249947
 
* http://serverfault.com/questions/249944/how-to-export-a-specific-virtualbox-snapshot-as-a-raw-disk-image/249947#249947
Line 31: Line 31:
 
  qemu-img convert -f raw myNewVM.raw -O qcow2 myNewVM.qcow
 
  qemu-img convert -f raw myNewVM.raw -O qcow2 myNewVM.qcow
  
 +
Cloning a Snapshot:
 
  # for a snapshot do (not tested)
 
  # for a snapshot do (not tested)
 
  cd /to/the/SnapShot/dir
 
  cd /to/the/SnapShot/dir

Revision as of 20:01, 29 October 2013

Using VirtualBox and KVM together

Using VirtualBox and KVM together at the same server at the same time is NOT possible!!!

Use VirtualBox

sudo service qemu-kvm stop
sudo service vboxdrv start

OR use KVM

sudo service vboxdrv stop
sudo service qemu-kvm start

Decide!

Migration from VirtualBox to KVM

This boils down to

  1. creating a clone of the vbox-machine with VBoxManage clonehd (this can take a looooong time!). Kloning is the easiest way of getting rid of snapshots of an existing virtual machine.
  2. converting the images from vdi to qcow-format with qemu-img convert
  3. creating and configuring a new kvm-guest
  4. adding some fou to NAT with a qemu-hook (see next section)
# to do this - on the same machine - you have to STOP kvm and start vboxdr (see above)
# The conversion can take some time. Other virtual machines are not accessible in this time
VBoxManage clonehd -format RAW myOldVM.vdi /home/vm-exports/myNewVM.raw
0%...
cd /home/vm-exports/
qemu-img convert -f raw myNewVM.raw -O qcow2 myNewVM.qcow

Cloning a Snapshot:

# for a snapshot do (not tested)
cd /to/the/SnapShot/dir
VBoxManage clonehd -format RAW "SNAPSHOT_UUID" /home/vm-exports/myNewVM.raw

Accessing services on KVM guests behind a NAT

I am referring to this article:

which ist mentioned in the libvirt wiki:

I installed the qemu-python script of the first article under ubuntu 12.04 LTS, which worked like expected.

So I can access a port in the virtualmachine-guest with the IP/Port of the host (!). From within the host, it is possible to reach the guest via it's real ip. I am using the virtio-Interface (performance).