Using KVM at Tier 2 Nate Yehle University of Chicago

Q: What is KVM?

A: Kernel-based Virtual Machine (KVM) is a virtual machine implementation using the operating system's kernel.

Using KVM, one can run multiple virtual machines running 1 unmodified Virtualization Goals ● Separation of Services ● Easier service based performance monitoring (one service per VM) ● Retire old head node servers by consolidating their services to VMs on new, robust hardware

2 Why KVM?

● KVM is favored by Redhat (good SL fit) ● Easy integration with Cobbler ● Uses a normal linux machine as hypervisor for easier monitoring ● We did not do an exhaustive survey of VM technologies - we did have some experience with VMWare ○ Did not like its Windows client ○ Advanced VMWware features (migrating VMs across physical hosts, high 3 availablity) are nice but requires SAN Implementing KVM at MWT2 ● ~15 VMs currently in production on three physical hosts ● MWT2 runs Dell R710s and PE2950s, good choices for hosting virtual machines ● KVM based VMs in production use for many services including: ○ gums, SRM, ganglia, apache, mysql, condor, cobbler, puppetmasterd, cacti, xrootd redirectors and memcached.

4 Hypervisor Requirements

● Processor Virtualization Extensions ● Cobbler or other PXE based install server ● Koan for installing VMs ● Virsh for administering VMs

5 Installing KVM Hypervisor ● SL5.5 x86_64 ● The CENTOS KVM howto quite useful ● Key RPMs used for installation: ○ kmod-kvm-83-164.el5_5.21 ○ etherboot-zroms-kvm-5.4.4-13.el5 ○ kvm-83-164.el5_5.21 ○ kvm-qemu-img-83-164.el5_5.21 ○ koan-2.0.5-1.el5 ○ -python-0.6.3-33.el5_5.3 ○ libvirt-0.6.3-33.el5_5.3 ○ python-virtinst-0.400.3-9.el5 ● Enable libvirtd service to install VMs ● eth0/1 configured as br0/1 for VMs to use internal/external network access 6 Installing KVM Guests ● Choose a MAC (we track them in a twiki) ● Add a Puppet entry for VM ● Add a dhcpd/named entry for VM (integration with cobbler forthcoming) ● Configure KVM installation options with Cobbler entry ○ Define VM attributes: --virt-ram --virt-path --virt-type=qemu --virt-cpus ○ Define VM network used --virt-bridge=br0 uses host br0 as VM eth0 ● Install configured cobbler entry via: koan --server=uct2-grid1. mwt2.org --virt --system=uct2v-c001.mwt2.org ● Watch newly created kvm VM with virsh console uct2v-c001. mwt2.org ● List running KVMs with virsh list 7 Performance

● We have a few performance studies for KVM (cf: S. Thapa's talk) ● Known that "fully virtualized" devices perform poorly. Use VirtIO - API for virtual IO ● Found improved R/W ~ xx% ● Reference: ● http://twiki.mwt2. org/bin/view/ITB/PerformanceCharacterizationForVM

8 KVM Development ● Custom Cobbler profile SL-55-x86_64-kvm ● Kickstart changes to reference hda instead of sda ● Grub changes to fix serial console for virsh ○ console=ttyS0,115200 needed as kernel option for virsh serial console to work ● Enable virtio on defined kvms for faster IO Remove virbr0 as it is replaced by br0/1

9 References

● http://www.linux-kvm.org/page/Main_Page ● http://wiki.centos.org/HowTos/KVM ● http://docs.redhat.com/docs/en- US/Red_Hat_Enterprise_Linux/5/html/Virtualization/ ● http://www.cyberciti.biz/faq/linux-kvm-disable-virbr0-nat- interface/ ● http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine

10