Topic: Virtualisation from the Ground Up
Host: Jon A
An introduction to virtualisation
What is Virtualisation?
Multiple instances of different operating systems running on the same piece of hardware.
Traditional environment – multitude of tin.
Virtual environment – minimal tin.
Power savings etc.
How does it work
Hardware virtualisation instruction set in CPU.
Shared Hardware resources.
Hard disk images.
Virtualbox (OSE) – Oracle.
Xen – Citrix.
KVM – RedHat.
HyperV – Microsoft
Pre-Flight Checks – Hardware
We need to make sure our hardware is capable of virtualisation
egrep -c '(vmx|svm)' /proc/cpuinfo
0 = no hardware support
1 or more = hardware support available but may need to ensure switch is set in the bios
Pre-Flight Checks 2 – CPU
apt-get install cpu-checker kvm-ok
INFO: /dev/kvm does not exist HINT: sudo modprobe kvm_amd INFO: Your CPU supports KVM extensions KVM acceleration can be used
Pre-Flight Checks 3 – Kernel
Use a 64 bit kernel (if possible), To serve more than 2GB of RAM for your VMs, you must use a 64-bit kernel.
egrep -c ' lm ' /proc/cpuinfo 0 means no 64 bit
1 or more means it is
Now lets check we are running a 64 bit kernel
if x86_64 is listed we’re golden!
Check your CPU is 64 bit capable
For this demonstration Ubuntu and KVM is used
Ubuntu 12.04 Server
User called virtdude was created on install
Basic server install OpenSSH server added after reboot conduct the usual update
sudo apt-get update sudo apt-get dist-upgrade KVM Installation
Lets install the needed packages:
sudo apt-get update sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
libvirt-bin provides libvirtd which is the daemon for monitoring qemu and kvm instances using libvirt.
qemu-kvm is the backend hypervisor.
bridge-utils provides a bridge from your network to the virtual machines.
ubuntu-vm-builder powerful command line tool for building virtual machines, uses debootstrap.
KVM – User Privileges
Ensure user is a member of the libvirt group
sudo adduser `id -un` libvirtd Now is probably a good opportunity to reboot.
KVM – Lets connect
Now we have the environment built, the hardware is setup and the hypervisor is running
Lets connect to the hypervisor to test
Id Name State
No VM running but a successful connection to the hypervisor
Out of the box we get a NAT
eth0 = 192.168.1.10 Ideal for testing/single host
We want a bridge onto physical LAN
br0 = 192.168.1.10
Virtualised machines are called guests
Lets make one
On the “management machine” install virt-manager for gui access
sudo apt-get install virt-manager
All eggs in one basket?
Single piece of tin multiple OS
Lets bring online a second host
Eggs in 2 baskets?
NFS Shared Storage
Lets install NFS on host 1
sudo apt-get install nfs-kernel-server
mkdir /export on host1
mkdir /import on both
EOF Lets reboot to get NFS running
We now need to add the storage in the GUI console
We should now be able to migrate a VM from one host to the other
Migration copies the memory footprint and configuration of the running guest from host to host, without dowtime (or at least very little).
As we’ve proved, shared storage is required for this to work, so that both hosts can see the same virtual hard disk file
Local NFS – The Bad news
NFS is great if you have a dedicated storage appliance
Most virtualisation environments utilise filers with multiple disk arrays presented over various protocols such as NFS/iSCSI/FCOE/etc NetApp, EMC, Sun, HP, etc.
We’re back to having one basket with a local NFS setup.
Clustered File Store
If storage must reside on the same hardware as the hypervisor, then we must make the storage available from all hypervisor hosts
storage hosted on all hypervisors and presented via NFS
Essentially raid volume over multiple hosts giving the required resilience
Removed the need for lots of physical hardware.
Thus saving power/money etc.
Provided resilient infrastructure.
Created our own personal cloud.
oVirt – nice management tools
Expand the cloud.
Openstack – Amazon EC2.
Ubuntu Tools – Juju/Charms.
World domination – 1 gazillion dollars.