Virtualization with libvirt Kashyap Chamarthy Outline 1/ Virt - - PowerPoint PPT Presentation

virtualization with libvirt kashyap chamarthy
SMART_READER_LITE
LIVE PREVIEW

Virtualization with libvirt Kashyap Chamarthy Outline 1/ Virt - - PowerPoint PPT Presentation

Virtualization with libvirt Kashyap Chamarthy Outline 1/ Virt Architecture 2/ What Libvirt 3/ Terminology 4/ Virtualization Shell 5/ Common virsh operations 6/ Snapshots 7/ Security 8/ Libguestfs 9/ Conclusion Virt Architecture Regular


slide-1
SLIDE 1

Virtualization with libvirt Kashyap Chamarthy

slide-2
SLIDE 2

Outline

1/ Virt Architecture 2/ What Libvirt 3/ Terminology 4/ Virtualization Shell 5/ Common virsh operations 6/ Snapshots 7/ Security 8/ Libguestfs 9/ Conclusion

slide-3
SLIDE 3

Virt Architecture

X86 Hardware(Intel/AMD)

hypervisor -- KVM[/dev/kvm] (Linux Kernel)

App1 App2 App4 App3 QEMU (I/O) Virtual Machine 2 Virtual Machine 1 Virsh, Virt-tools, Virt-manager

Regular Apps

Libvirt

slide-4
SLIDE 4

OK, so, what the heck is libvirt?

  • Library to securely manage Virtual Machines
  • Uses a client/server model
  • Supports multiple hypervisors
  • KVM, QEMU, XEN, Virtualbox, LXC, and more
  • XML format to define virtual machine
  • Stable
slide-5
SLIDE 5

More libvirt..

QEMU/KVM CPU tuning Storage Snapshots Devices Networking sVirt MEM tuning SSH/TLS Serial Console Offline/Live Migration MEM tuning Qcow2 Encryption MEM tuning libguestfs

slide-6
SLIDE 6

Terminology

  • node – Physical machine/Bare Metal
  • domain – Virtual machine/Guest machine
  • hypervisor – A software layer which enables to

run multiple operating systems

slide-7
SLIDE 7

Virt-install Illustration1

  • virt-install --connect=qemu:///system \
  • -name fedora16 \
  • -disk /export/vmimgs/fedora16.img,size=5 \
  • -ram 1024 \
  • -vcpus=2 \
  • -check-cpu \
  • -hvm \
  • -cdrom /export/isos/Fedora-16-Beta-x86_64-

Live-Desktop.iso

slide-8
SLIDE 8

Virtualization shell

  • A powerful shell interface to manage guests
  • $ virsh help host
  • $ virsh capabilities
  • $ virsh dominfo
slide-9
SLIDE 9

virsh examples

  • $ virsh nodeinfo
  • $ virsh define lovelock1.xml
  • $ virsh start lovelock1
  • $ virsh shutdown lovelock1
  • $ virsh list --all
slide-10
SLIDE 10

More virsh operations

  • Edit and define
  • $ virsh edit lovelock1
  • Save VM(or domain)
  • $ virsh save lovelock1 savedlovelock1
  • $ virsh restore savedlovelock1
  • Connect to a remote virt-host
  • $ virsh --connect \

qemu+ssh://root@remotehostname/system

slide-11
SLIDE 11

Libvirt Security

  • Guests are run as unprivileged user – 'qemu'
  • sVirt - SELinux(Mandatory Access controls)
  • Integrated into libvirt qemu driver
  • Example SELinux label for a VM
  • Syntax: USER:ROLE:TYPE:MCS label

– system_u:object_r:svirt_image_t:s0:c162,c597

/export/vmimgs/yellow.qcow2

slide-12
SLIDE 12

Snapshots

  • Currently supports Qcow2 disk image formats
  • $ virsh snapshot-create lovelock1
  • Types of snapshots
  • VM state

– VM State is stored to a file ; Can restore instantly

  • Internal

– Single file to move around ; Very handy

  • External

– Uses backing files ; useful to creating templates

slide-13
SLIDE 13

Libguestfs

  • Read, Modify, Manage, Inspect disk images
  • An interactive shell to access guest file-systems
  • For a 'running' guest
  • $ guestfish –ro -i -a /path/to/disk-image
  • For an 'offline guest
  • $ sudo guestfish –rw -i -a /path/to/disk-image
slide-14
SLIDE 14

Where else libvirt is used

  • Virt-manager ; Boxes(gnome-shell integration)
  • Virt-install (part of python-virtinst)
  • Libguestfs and friends
  • Oz – an automatic VM creator with minimal

input

  • Many cloud based projects – aeolusproject,
  • penStack, openNebula etc
slide-15
SLIDE 15

Try it out !

  • http://libvirt.org/
  • http://virt-tools.org/
  • http://fedoraproject.org/wiki/Getting_started_with_v
  • http://aeolusproject.org/oz.html
  • http://libguestfs.org/
  • http://kashyapc.fedorapeople.org/virt/create-guest-virt-i
slide-16
SLIDE 16

Thank You

<kashyapc@fedoraproject.org> kashyap on irc.freenode.net http://kashyapc.fedorapeople.org/ http://kashyapc.wordpress.com/