virtualization with libvirt kashyap chamarthy
play

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


  1. Virtualization with libvirt Kashyap Chamarthy

  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

  3. Virt Architecture Regular Apps Virsh, Virt-tools, Virt-manager App1 App2 Virtual Virtual Libvirt Machine 1 Machine 2 App3 App4 QEMU (I/O) hypervisor -- KVM[/dev/kvm] (Linux Kernel) X86 Hardware(Intel/AMD)

  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

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

  6. Terminology ● node – Physical machine/Bare Metal ● domain – Virtual machine/Guest machine ● hypervisor – A software layer which enables to run multiple operating systems

  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

  8. Virtualization shell ● A powerful shell interface to manage guests ● $ virsh help host ● $ virsh capabilities ● $ virsh dominfo

  9. virsh examples ● $ virsh nodeinfo ● $ virsh define lovelock1.xml ● $ virsh start lovelock1 ● $ virsh shutdown lovelock1 ● $ virsh list --all

  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

  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

  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

  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

  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, openStack , openNebula etc

  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

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

Recommend


More recommend