Download presentation
Presentation is loading. Please wait.
Published byJennifer Whitehead Modified over 8 years ago
1
Introduction to KVM Andrea Chierici Virtualization tutorial Catania 1-3 dicember 2010
2
What is KVM Kernel Virtual Machine Is a Full virtualization solution for Linux on AMD64 and Intel 64 hardware Is a Linux kernel module built for the standard Linux kernel Can run multiple, unmodified virtualized guest Windows and Linux operating systems The KVM hypervisor in Red Hat Enterprise Linux is managed with the libvirt API and tools built for libvirt, virt-manager and virsh. Andrea Chierici2
3
Guest mode With KVM every virtual machine is a regular Linux process, scheduled by the standard Linux scheduler. KVM adds a third mode to the standard kernel and user modes, the guest mode. Guest mode processes are processes that are run from within the virtual machine. The guest mode, just like the normal mode, has its own kernel and user-space variations. Andrea Chierici3
4
Key Features (1) Overcommitting allocating more virtualized CPUs or memory than the available resources on the system. CPU overcommitting allows virtualized guests to run on fewer servers and in higher densities. Memory overcommitting allows hosts to utilize memory and virtual memory to increase guest densities. Andrea Chierici4
5
Key Features (2) KSM Kernel SamePage Merging (KSM) is used by the KVM hypervisor to allow KVM guests to share identical memory pages These shared pages are usually common libraries or other identical, high-use data. KSM allows for greater guest density of identical or similar guest operating systems by avoiding memory duplication. Andrea Chierici5
6
KVM installation A typical KVM installation consists of the following components: Device driver for managing the virtualization hardware; this driver exposes its capabilities via a character device /dev/kvm. User-space component for emulating PC hardware; currently, this is handled in the user space and is a lightly modified QEMU process. The I/O model is directly derived from QEMU’s, with support for copy-on-write disk images and other QEMU features. Andrea Chierici6
7
Packages To fully utilize the KVM support built into the kernel the following packages are required: qemu-kvm virt-manager virt-viewer python-virtinst Andrea Chierici7
8
Architecture Andrea Chierici8
9
QEMU KVM uses a program called QEMU QEMU is a process emulator that offers many features: can save and restore the state of the virtual machine with all programs running VMs can be equipped with many types of hardware, and virtual hard disk images can be stored so that they only take up disk space that the guest OS actually uses Uses VNC to access the VM display The OS can be installed both locally on the virtualization node HDDs or on the SAN. Booting VMs from SAN allows having diskless servers. KVM has the ability to take advantage of the latest kernel optimizations, advancements and hardware compatibility Andrea Chierici9
10
qcow2 qcow2 is a QEMU disk image format. It is a copy-on-write format. QEMU can use a base image which is read-only, and store all writes to the qcow2 image. Versatile format Use it to have smaller images (useful if your filesystem does not support holes, for example on FAT32), optional AES encryption, zlib based compression and support of multiple VM snapshots Andrea Chierici10
11
Libvirt Libvirt is a hypervisor-independent virtualization API that is able to interact with the virtualization capabilities of a range of operating systems. libvirt is free software available under the GNU Lesser General Public License. The libvirt project aims to provide a long term stable C API. The libvirt Open Source project currently supports Xen, Qemu, KVM, LXC, OpenVZ, VirtualBox, OpenNebula, and VMware ESX. The RHEL libvirt package supports Xen and KVM on RHEL5 and only KVM on RHEL6 Andrea Chierici11
12
virsh The virsh command-line tool is built on the libvirt management API operates as an alternative to the graphical virt-manager application can be used read-only mode by unprivileged users with root access, full administration functionality. Ideal for scripting virtualization administration Included in the libvirt-client package. Andrea Chierici12
13
virt-manager graphical desktop tool for managing virtualized guests can be used to perform virtualization administration, virtualized guest creation, migration and configuration tasks allows access to graphical guest consoles can view virtualized guests, host statistics, device information and performance graphs can manage the local hypervisor and remote hypervisors using the same interface and methods. Andrea Chierici13
14
Difference between KVM and Xen Xen is an external hypervisor assumes control of the machine and divides resources among guests. it does have its own scheduler, memory manager, and machine intialization packages added to Linux On the other hand, KVM is part of Linux and uses the regular Linux scheduler and memory management. KVM is much smaller and simpler to use; it is also more featureful; for example KVM can swap guests to disk in order to free RAM. KVM only run on processors that supports x86 hvm (vt/svm instructions set) Xen allows running modified operating systems on non-hvm x86 processors using a technique called paravirtualization. KVM does not support paravirtualization for CPU but may support paravirtualization for device drivers to improve I/O performance. Andrea Chierici14
15
Difference between KVM and VMware VMware is a proprietary product. KVM is Free Software released under the GPL. Vmware is primarily a piece of software that fully virtualizes the x86 architecture. It is pretty much the industry standard and has great performance scalability. large and complex software package Andrea Chierici15
16
Difference between KVM and QEMU QEMU uses emulation; KVM uses processor extensions (HVM) for virtualization. Andrea Chierici16
17
Virtualized and emulated devices Emulated devices are virtual devices which exist entirely in software. Emulated devices do not require a real hardware device to back them. Emulated drivers may use either a physical device or a virtual software device The device level instructions are completely translated by the KVM hypervisor A system has a number of virtual CPUs (VCPUs) relative to the number of physical processor cores. The number of virtual CPUs is finite and represents the total number of virtual CPUs that can be assigned to guest virtual machines. Andrea Chierici17
18
Para-virtualized drivers (1) Para-virtualized drivers are device drivers that increase the I/O performance of virtualized guests. Para-virtualized drivers decrease I/O latency and increase I/O throughput to near bare-metal levels must be installed on the guest operating system Included in latest RHEL4,5,6 Must be manually installed on windows guests Andrea Chierici18
19
Para-virtualized drivers (2) Para-virtualized network driver Para-virtualized block driver all storage devices supported by the hypervisor attached to the virtualized guest Para-virtualized clock Balloon driver allows guests to express to the hypervisor how much memory they require allows the host to efficiently allocate memory to the guest and allow free memory to be allocated to other guests and processes Guests can mark sections of the guest's RAM as not in use (balloon inflation) When the guest requires the freed memory again, the hypervisor can reallocate RAM to the guest (balloon deflation) Andrea Chierici19
20
KVM VM Migration (1) Migration is the term for the process of moving a virtualized guest from one host to another Offline Live useful for: Load balancing - guests can be moved to hosts with lower usage Hardware failover - when hardware devices on the host start to fail Energy saving - guests can be redistributed to other hosts and host systems powered off to save energy and cut costs in low usage periods. Geographic migration - guests can be moved to another location for lower latency or in serious circumstances Andrea Chierici20
21
KVM VM Migration (2) Migration only moves the virtualized guest's memory. The guest's storage is located on networked storage which is shared between the source host and the destination. Without shared storage migration is not possible Offline migration suspends the guest then moves an image of the guest's memory to the destination host Live migration is the process of migrating a running guest from one physical host to another physical host Andrea Chierici21
22
KVM requirements The KVM hypervisor requires: an Intel processor with the Intel VT and the Intel 64 extensions, or an AMD processor with the AMD-V and the AMD64 extensions. The working guest storage methods are: files on local storage, physical disk partitions, locally connected physical LUNs, LVM partitions, NFS shared file systems, iSCSI, GFS2 clustered file systems, and Fibre Channel-based LUNs SRP devices (SCSI RDMA Protocol), the block export protocol used in Infiniband and 10GbE iWARP adapters. Andrea Chierici22
23
KVM limitations Virtualized guests support up to a maximum of 64 virtualized CPUs in Red Hat Enterprise Linux 6.0 It is not recommended to have more than 10 virtual CPUs per physical processor core SCSI emulation is limited to 16 virtualized (emulated) SCSI devices. KVM is limited to a maximum of four virtualized (emulated) IDE devices per guest Para-virtualized devices, which use the virtio drivers, are PCI devices. Presently, guests are limited to a maximum of 32 PCI devices Live migration is only possible with CPUs from the same vendor (that is, Intel to Intel or AMD to AMD only). Andrea Chierici23
24
Application limitations There are aspects of virtualization which make virtualization unsuitable for certain types of applications. Applications with high I/O throughput requirements should use the para-virtualized drivers for fully virtualized guests. Without the para-virtualized drivers certain applications may be unstable under heavy I/O loads. The following applications should be avoided for their high I/O requirement reasons: kdump, netdump servers Andrea Chierici24
25
KVM compatibility Operating systemSupport level Red Hat Enterprise Linux 3 x86Optimized with para-virtualized drivers Red Hat Enterprise Linux 4 x86Optimized with para-virtualized drivers Red Hat Enterprise Linux 4 AMD 64 and Intel 64Optimized with para-virtualized drivers Red Hat Enterprise Linux 5 x86Optimized with para-virtualized drivers Red Hat Enterprise Linux 5 AMD 64 and Intel 64Optimized with para-virtualized drivers Red Hat Enterprise Linux 6 x86Optimized with para-virtualized drivers Red Hat Enterprise Linux 6 AMD 64 and Intel 64Optimized with para-virtualized drivers Fedora 12 x86Optimized with para-virtualized drivers Fedora 12 AMD 64 and Intel 64Optimized with para-virtualized drivers Fedora 13 x86Optimized with para-virtualized drivers Fedora 13 AMD 64 and Intel 64Optimized with para-virtualized drivers Windows Server 2003 R2 32-BitOptimized with para-virtualized drivers Windows Server 2003 R2 64-BitOptimized with para-virtualized drivers Windows Server 2003 Service Pack 2 32-BitOptimized with para-virtualized drivers Windows Server 2003 Service Pack 2 64-BitOptimized with para-virtualized drivers Windows XP 32-BitOptimized with para-virtualized drivers Windows Vista 32-BitSupported Windows Vista 64-BitSupported Windows Server 2008 32-BitOptimized with para-virtualized drivers Windows Server 2008 (and R2) 64-BitOptimized with para-virtualized drivers Windows 7 32-BitOptimized with para-virtualized drivers Windows 7 64-BitOptimized with para-virtualized drivers Andrea Chierici25
26
References KVM: http://www.linux-kvm.orghttp://www.linux-kvm.org Libvirt: http://libvirt.orghttp://libvirt.org QEMU: http://wiki.qemu.org/Manualhttp://wiki.qemu.org/Manual Gruppo virtualizzazione CCR virtualizzazione@lists.infn.it virtualizzazione@lists.infn.it Andrea Chierici26
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.