KVM tutorial #3 Andrea Chierici Virtualization tutorial Catania 1-3 dicember 2010.

Slides:



Advertisements
Similar presentations
With ovirt & virt manager
Advertisements

Module 3 Configuring Hardware on a Computer Running Windows XP Professional.
Virtual Machine Technology Dr. Gregor von Laszewski Dr. Lizhe Wang.
What’s New: Windows Server 2012 R2 Tim Vander Kooi Systems Architect
VMWare to Hyper-V FOR SERVER What we looked at before migration  Performance – Hyper-V performs at near native speeds.  OS Compatibility – Hyper-V.
Genesis: from raw hardware to processes System booting sequence: how does a machine come into life.
Linux+ Guide to Linux Certification, Second Edition
NWCLUG 01/05/2010 Jared Moore Xen Open Source Virtualization.
MCITP Guide to Microsoft Windows Server 2008 Server Administration (Exam #70-646) Chapter 11 Windows Server 2008 Virtualization.
Introduction to Unix (CA263) File System
MCDST : Supporting Users and Troubleshooting a Microsoft Windows XP Operating System Chapter 8: Troubleshooting Storage Devices and Display Devices.
Installing Windows 7 Lesson 2.
Linux+ Guide to Linux Certification, Second Edition Chapter 3 Linux Installation and Usage.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 2: Managing Hardware Devices.
Hands-On Microsoft Windows Server 2003 Chapter 2 Installing Windows Server 2003, Standard Edition.
Guide To UNIX Using Linux Third Edition
Lesson 7: Creating and Configuring Virtual Machine Settings
A comparison between xen and kvm Andrea Chierici Riccardo Veraldi INFN-CNAF.
Hands-On Microsoft Windows Server 2003 Administration Chapter 6 Managing Printers, Publishing, Auditing, and Desk Resources.
VMware is a registered trademark of VMware, Inc. (an EMC company).
Paper on Best implemented scientific concept for E-Governance Virtual Machine By Nitin V. Choudhari, DIO,NIC,Akola By Nitin V. Choudhari, DIO,NIC,Akola.
Capturing Computer Evidence Extracting Information.
Condor Project Computer Sciences Department University of Wisconsin-Madison Virtual Machines in Condor.
Tanenbaum 8.3 See references
Guide To UNIX Using Linux Fourth Edition
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Virtual Machines Module 7.
Linux & Library – Web Kiosks for Peanuts Sam Deeljore Pius XII Memorial/HSC Libraries Saint Louis University LITA 2004 National Forum St. Louis, Missouri.
Guide to Linux Installation and Administration, 2e1 Chapter 3 Installing Linux.
Tutorial 11 Installing, Updating, and Configuring Software
Hands-On Virtual Computing
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 2: Managing Hardware Devices.
Ch Review1 Review Chapter Microcomputer Systems Hardware, Software, and the Operating System.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
Day 4 Understanding Hardware Partitions Linux Boot Sequence.
Linux in a Virtual Environment Nagarajan Prabakar School of Computing and Information Sciences Florida International University.
Guide to Linux Installation and Administration, 2e1 Chapter 2 Planning Your System.
INTRODUCTION TO VIRTUALIZATION KRISTEN WILLIAMS MOSES IKE.
Module 1: Installing Microsoft Windows XP Professional.
A+ Guide to Managing and Maintaining Your PC Fifth Edition Chapter 13 Understanding and Installing Windows 2000 and Windows NT.
Configuring Data Protection Chapter 12 powered by dj.
1 Review last lecture Pre-installation checks. 2 Post Installation Identify installation problems Install patches, upgrades, service packs MS announces.
OPERAING SYSTEM 1 CA-210 WINDOWS XP. CHAPTER 1 OPERATING SYSTEM FUNDAMENTALS.
VApp Product Support Engineering Rev E VMware Confidential.
Page 1 Printing & Terminal Services Lecture 8 Hassan Shuja 11/16/2004.
Microsoft Windows XP Professional MCSE Exam
Understanding Backup and Recovery Methods Lesson 8.
Chapter 8: Installing Linux The Complete Guide To Linux System Administration.
Alessandro Cardoso, Microsoft MVP Creating your own “Private Cloud” with Windows 10 Hyper- V WIN443.
Hands-On Virtual Computing
Sem 2v2 Chapter 5 Router Startup and Setup. A router initializes by loading the bootstrap, the operating system, and a configuration file. If the router.
1 Setup and Compile Linux Kernel Speaker: Yi-Ji Jheng Date:
Libvirt management Andrea Chierici Virtualization tutorial Catania 1-3 dicember 2010.
CITA 171 Section 1 DOS/Windows Introduction. DOS Disk operating system (DOS) –Term most often associated with MS-DOS –Single-tasking operating system.
Introduction to KVM Andrea Chierici Virtualization tutorial Catania 1-3 dicember 2010.
Performance analysis comparison Andrea Chierici Virtualization tutorial Catania 1-3 dicember 2010.
KVM tutorial #2 Andrea Chierici Virtualization tutorial Catania 1-3 dicember 2010.
Windows Server 2003 { First Steps and Administration} Benedikt Riedel MCSE + Messaging
A comparison between xen and kvm Andrea Chierici Riccardo Veraldi INFN-CNAF CCR 2009.
Intro To Virtualization Mohammed Morsi
Ganeti Instance Creation
Andrea Chierici Virtualization tutorial Catania 1-3 dicember 2010
Virtualization for Cloud Computing
Section 4 Block Storage with SES
Virtualization with libvirt Kashyap Chamarthy
Virtualization overview
Chapter Overview Operating System Basics
SUSE Linux Enterprise Desktop Administration
Presentation transcript:

KVM tutorial #3 Andrea Chierici Virtualization tutorial Catania 1-3 dicember 2010

qemu-kvm QEMU is a generic and open source machine emulator and virtualizer. When used as a machine emulator, QEMU can run OSes and programs made for one machine (e.g. an ARM board) on a different machine (e.g. your own PC). By using dynamic translation, it achieves very good performance. When used as a virtualizer, QEMU achieves near native performances by executing the guest code directly on the host CPU. QEMU supports virtualization when using the KVM kernel module in Linux. qemu-kvm is the variant used by KVM Andrea Chierici2

qemu-kvm with command line It’s possible to use KVM without libvirt wrappers, with bare command line  virsh and virt-manager have no knowledge of VMs created this way  Can be useful in some testing environments See man qemu-kvm for reference qemu-kvm -hda /virtual/test_disk -net nic,model=e1000,macaddr=00:16:3e:00:00:2 a -net tap -m vnc :4 Andrea Chierici3

qemu-kvm options Invocation:  usage: qemu [options] [disk_image] Some options: -hda file -cdrom file -smp n -vnc address:port -snapshot: write to temporary files instead of disk image files. In this case, the raw disk image you use is not written back. You can however force the write back by pressing Andrea Chierici4

qemu monitor The QEMU monitor is used to give complex commands to the QEMU emulator. You can use it to:  Remove or insert removable media images (such as CD-ROM or floppies).  Freeze/unfreeze the Virtual Machine (VM) and save or restore its state from a disk file.  Inspect the VM state without an external debugger.  Perform migration between hosts  Can be accessed with CTRL+ALT+2 Andrea Chierici5

qemu TAP: qemu-ifup -net tap: QEMU adds a virtual network device on your host (called tapN), and you can then configure it as if it was a real ethernet card. A script is required to create a bridged net connection: /etc/qemu-ifup #!/bin/sh switch=$(/sbin/ip route list | awk '/^default / { print $NF }') /sbin/ifconfig $ up /usr/sbin/brctl addif ${switch} $1 Andrea Chierici6

Using qemu-img The qemu-img command line tool is used for formatting various file systems used by KVM. qemu-img should be used for formatting virtualized guest images, additional storage devices and network storage Formatting and creating new images or devices # qemu-img create [-6] [-e] [-b base_image] [-f format] filename [size] Andrea Chierici7

Qemu-img: supported formats Raw: Raw disk image format (default). This format has the advantage of being simple and easily exportable to all other emulators. If your file system supports holes (for example in ext2 or ext3 on Linux or NTFS on Windows), then only the written sectors will reserve space. Use qemu-img info to know the real size used by the image or ls -ls on Unix/Linux. Qcow2: QEMU image format, the most versatile format. Use it to have smaller images (useful if your file system does not supports holes, for example: on Windows), optional AES encryption, zlib based compression and support of multiple VM snapshots. Qcow: Old QEMU image format. Only included for compatibility with older versions. Cow: User Mode Linux Copy On Write image format. The cow format is included only for compatibility with previous versions. It does not work with Windows. Vmdk: VMware 3 and 4 compatible image format. Cloop: Linux Compressed Loop image, useful only to reuse directly compressed CD-ROM images present for example in the Knoppix CD- ROMs. Andrea Chierici8

Qemu-img examples Convert an existing image to another format # qemu-img convert [-c] [-e] [-f format] filename [-O output_format] output_filename  Image conversion is also useful to get smaller image when using a format which can grow, such as qcow or cow. The empty sectors are detected and suppressed from the destination image. getting image information  the info parameter displays information about a disk image. The format for the info option is as follows: # qemu-img info [-f format] filename Andrea Chierici9

Snapshot option With snapshot option it’s possible to “clone” several nodes starting from a single image  Configure the node with DHCP network  Remove all references to mac address  Use command line with --snapshot and different mac addresses for ((i=1;i<=$1;i++)) do /usr/libexec/qemu-kvm -m smp 1 -name wn-test$i \ -boot c -drive file=/virtual/test.img,if=virtio,index=0,boot=on \ -net nic,macaddr=54:52:00:4f:02:3$i,vlan=0,model=virtio -net tap \ -vnc :$i -k en-us -snapshot & sleep 2 done Andrea Chierici10

Libvirt: low level cloning and VM management Libvirt stores by default xml profiles of VMs under /etc/libvirt/qemu/ virsh edit, without path  Manually editing xml profiles is not recommended vi /etc/libvirt/qemu/wn-test.xml  cp wn-test.xml wn-test2.xml  virsh define wn-test-2.xml, after customizations Consider copying disk image file Virsh dumpxml… Andrea Chierici11

Optimizations: swap KVM virtualized guests function as Linux processes. Linux processes are not permanently kept in main memory (physical RAM). The kernel scheduler swaps process memory into virtual memory (swap).  Swap, with conventional hard disk drives, is thousands of times slower than main memory in modern computers.  If a guest is inactive for long periods of time, the guest may be placed into swap by the kernel. Swap usage can be completely turned off to prevent guests from being unresponsive while they are moved back to main memory. This may improve performance but will expose the system to certain risks.  The swapoff command can disable all swap partitions and swap files on a system. Andrea Chierici12

Optimizations: smartd SMART disk monitoring can be safely disabled as virtual disks and the physical storage devices are managed by the host. # service smartd stop # chkconfig --del smartd Andrea Chierici13

Optimizations: shutdown (rhel6) Without the acpid package, the guest does not shut down when the virsh shutdown command is executed.  The virsh shutdown command is designed to gracefully shut down virtualized guests.  Install the acpid package # yum install acpid  Enable the acpid service # chkconfig acpid on # service acpid start Andrea Chierici14

Serial console Fully virtualized guest serial console output can be viewed with the virsh console command. The serial port is called ttyS0 on Linux or COM1 on Windows.  You must configure the virtualized operating system to output information to the virtual serial port. To output kernel information from a fully virtualized Linux guest into the domain modify the /boot/grub/grub.conf file by appending to kernel line: console=ttyS0, Andrea Chierici15