SlideShare a Scribd company logo
                 Look into libvirt
                     Osier Yang  <jyang@redhat.com>
Status
●   First release on Dec 19 2005
●   1.0.0 in two weeks. (Finally)
●   25 maitainers/commiters.
●   200 ~ 300 patches per release
●   Less than 300 APIs
Why libvirt?
●   Long term API/ABI/XML back-compact
●   Portable between various HVs
●   Hides complex interfaces of HV
●   Hides HV's API changes
●   Available on Linux, Solaris, Windows & OS-X
●   Secure access (TLS, SASL, SSH, PolicyKit)
●   Open, LGPLv2+ license
What libvirt manages
●   Domain
●   Virtual network
●   Host network interface
●   Node device
●   Storage pool/volume
●   Network filter
●   Secret
Supported hypervisors
●   QEMU/KVM
●   XEN: XenD, XenStored, XM, libxenlight
●   VMWare: ESX, GSX server, Workstation,
    Player
●   Linux container: LXC, OpenVZ
●   Test, Remote
●   UML, VirtualBox, Hyper-V, Parallels, etc
Virtual network
●   Nat (dnsmasq/Radvd, iptables)
●   Route
●   Isolated
●   Bridge (Open vSwitch, Macvtap)
●   Host network interface passthrough (SR-IOV
    VFs pool)
Host network interface
●   Based on netcf -> augeas
●   Enumerate
●   Management(ethernets, bonds, bridges, vlan
    interfaces)
●   Transaction support – revert/commit config
    changes
●   Report status (libnl, ioctl, sysfs)
Network filter
●   iptables
●   ebtables
●   Ip6tables
●   E.g. allow-incoming-ipv4 no-ip-multicast
Storage
●   pool, volume
●   fs (dir, fs, netfs)
●   scsi
●   Iscsi
●   Disk
●   lvm
●   mpath
●   sheepdog, rbd
Node device
●   Enumerate host devices
●   Backends (udev, HAL)
●   vHBA create/destroy
Secret
●   Encrypt storage
●   Can be used to encrypt a storage volume or
    domain disk
●   Only support qcow disks
Miscellaneous
●   Hooks (Daemon, QEMU, LXC, Migration)
●   Audit
●   Security (Selinux/Apparmor, sVirt)
●   Locking (libsanlock, POSIX fcntl)
●   Zero-conf (Avahi)
●   etc...
How to talk with QEMU
●   Monitor (HMP, QMP)
●   Guest agent monitor
●   Serial/Parrell console
●   Graphic console (vnc/spice)
●   Network
Domain APIs (libvirt.h)
●   Lifecyle (define/undefine, start/destroy,
    suspend/resume), list, lookup.
●   Save, restore, core dump, suspend, resume
●   Migration
●   Snapshot (Internal/External, Disk-only/
    System checkpoint/VM state)
●   Guest resource management (memory,
    network, memory, cpu, NUMA tuning)
Domain APIs (libvirt.h)
●   Host device passthrough
●   Detach/reattach node devices
●   Async events
●   Node resource management (memory)
●   APIs based on guest agent (E.g. S3/S4)
●   Guest block/network I/O statistics
●   ...more...
libvirt architecture
                                        Node
        client


                                                libvirt-qemu

      public API




                                                                     Agent monitor
                                                        qemu-kvm
                                  libvirtd




                                             monitor
                        RPC
       remote
                        $URI


uri = “qemu://$hostname/system"                              Guest
                                                guest
                                                             agent
The stack
 virsh
virsh      bindings       SNMP             AMQP         ......

                         public API

                          libvirtd

 KVM        XEN         ESX          LXC          UML      ......


Network    Storage     Iface     nwfilter     Secret    Nodedev


cgroup      netcf     iptables   ebtables         tc       libnl


 lvm       selinux     sysfs         udev         HAL   devmap


iscsiadm    ioctl     libnuma    numad        sanlock   qemu-img
Stuffs around
●   Language bindings (Python, Perl, Ruby, Jave,
    OCaml, C#, PHP)
●   Libvirt-snmp
●   Libvirt-qpid
●   Libvirt-cim
●   libvirt-glib (libvirt-glib, libvirt-gconf, libvirt-
    gobject)
Stuffs around
●   Virt-manager
●   virt-viewer
●   python-virtinst
●   Libosinfo
●   Libvirt-designer
●   Libvirt-sandbox
●   Gnome Boxes
Stuffs around
●   Virt-manager, virt-viewer
●   python-virtinst
●   Libosinfo
●   Libvirt-designer
●   Libvirt-sandbox
●   Gnome Boxes
●   Eucalyptus, openstack
●   Plugins for collectd, munin, Nagios, Zenoss
libguestfs
●   For accessing and modifying virtual machine
    (VM) disk images
●   View and edit files inside guests
●   Scripting changes to VM
●   Monitoring disk used/free statistics
●   P2V, V2V
●   Performing partial backups
●   Cloning VMs, etc..
How libguestfs works
             Appliance
  client
               qemu



               guestfsd
libguestfs


              Linux kernel




               Device or
               Disk image
virt-v2v
●   Convert VMs on XEN/ESX to RH virt stack
●   Support guests of RHEL, Fedora, Windows
●   Based on libguestfs and libvirt
How virt-v2v works
●   Shutdown guest on source host
●   Use libvirt to get domain XML config
●   Copy storage
●   Convert storage and modify XML
●   Use libvirt to define and start the domain on
    dest host
The conversion - RHEL/FC
●   Remove XEN/ESX specific stuffs (E.g.
    xenpv kernel/drivers, VMWare tools)
●   Install or update kernel, try best to let it
    support virtio
●   Update block and network drivers
Ongoing or TODO
●   Snapshot improvements
●   Storage driver improvements (glusterfs,
    job, inotify)
●   LXC driver improvements
●   Persistent vHBA
●   Migration with NPIV
●   Associate storage with domain
●   Improve device hotplug
Ongoing or TODO
●   Lifecycle events for all objects
●   Role based access control on all public APIs
●   Isolate QEMU process with Linux Container
    namespaces.
●   APIs to expose host/hypervior's capabilities
●   Etc...
http://libvirt.org 
  libvir­list@redhat.com
libvirt­user@redhat.com
      #virt on OFTC 

More Related Content

PDF
XPDS14: libvirt support for libxenlight - James Fehlig, SUSE
ODP
Libvirt and bhyve under FreeBSD
PDF
LCE13: Virtualization Forum
PDF
Kvm optimizations
PDF
Optimization_of_Virtual_Machines_for_High_Performance
PDF
How can OpenNebula fit your needs - OpenNebulaConf 2013
PDF
Kubernetes networking
PDF
XPDS14: libvirt support for libxenlight - James Fehlig, SUSE
Libvirt and bhyve under FreeBSD
LCE13: Virtualization Forum
Kvm optimizations
Optimization_of_Virtual_Machines_for_High_Performance
How can OpenNebula fit your needs - OpenNebulaConf 2013
Kubernetes networking

What's hot (20)

PDF
How Can OpenNebula Fit Your Needs: A European Project Feedback
PDF
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
PPTX
ODP
Gluster volume snapshot
PDF
XPDS14 - Xen as High-Performance NFV Platform - Jun Nakajima, Intel
PDF
Quickly Debug VM Failures in OpenStack
PDF
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
PDF
Webdevops - Neos Docker
PDF
FreeBSD hosting
PDF
Devconf.cz 2016 Linux as a guest on Hyper-V
PDF
kdump: usage and_internals
PDF
OpenNebula - OpenNebula and tips for CentOS 7
PDF
XPDS14 - Intel(r) Virtualization Technology for Directed I/O (VT-d) Posted In...
PDF
Extending bhyve beyond FreeBSD guests - EuroBSDCon 2013
PPTX
VirtualBox networking explained
PDF
OpenNebulaConf 2016 - Storage Hands-on Workshop by Javier Fontán, OpenNebula
PDF
OpenVZ Linux Containers
PPT
Linux Virtualization
PDF
Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...
PDF
Fundamental Virtualisasi di openSUSE
How Can OpenNebula Fit Your Needs: A European Project Feedback
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
Gluster volume snapshot
XPDS14 - Xen as High-Performance NFV Platform - Jun Nakajima, Intel
Quickly Debug VM Failures in OpenStack
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Webdevops - Neos Docker
FreeBSD hosting
Devconf.cz 2016 Linux as a guest on Hyper-V
kdump: usage and_internals
OpenNebula - OpenNebula and tips for CentOS 7
XPDS14 - Intel(r) Virtualization Technology for Directed I/O (VT-d) Posted In...
Extending bhyve beyond FreeBSD guests - EuroBSDCon 2013
VirtualBox networking explained
OpenNebulaConf 2016 - Storage Hands-on Workshop by Javier Fontán, OpenNebula
OpenVZ Linux Containers
Linux Virtualization
Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...
Fundamental Virtualisasi di openSUSE
Ad

Similar to Look Into Libvirt Osier Yang (20)

PDF
20241115 [KubeCon NA Pavilion] Lima.pdf_
PDF
20250402 [KubeCon EU Pavilion] Lima.pdf_
PDF
[KubeConNA2023] Lima pavilion
PDF
20240321 [KubeCon EU Pavilion] Lima.pdf_
ODP
OpenStack Nova Scheduler
ODP
Proxmox Talk - Linux Fest Northwest 2018
PDF
Hands on Virtualization with Ganeti (part 1) - LinuxCon 2012
PDF
RMLL / LSM 2009
PDF
Rmll Virtualization As Is Tool 20090707 V1.0
PDF
[KubeConEU2023] Lima pavilion
ODP
Kvm and libvirt
PDF
Libvirt/KVM Driver Update (Kilo)
PDF
XS Japan 2008 Xen Mgmt English
PDF
Ryu: network operating system
ODP
Malware analysis
PDF
Security of Linux containers in the cloud
PDF
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
PDF
4. open mano set up and usage
PDF
Storage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdf
PDF
Linux sever building
20241115 [KubeCon NA Pavilion] Lima.pdf_
20250402 [KubeCon EU Pavilion] Lima.pdf_
[KubeConNA2023] Lima pavilion
20240321 [KubeCon EU Pavilion] Lima.pdf_
OpenStack Nova Scheduler
Proxmox Talk - Linux Fest Northwest 2018
Hands on Virtualization with Ganeti (part 1) - LinuxCon 2012
RMLL / LSM 2009
Rmll Virtualization As Is Tool 20090707 V1.0
[KubeConEU2023] Lima pavilion
Kvm and libvirt
Libvirt/KVM Driver Update (Kilo)
XS Japan 2008 Xen Mgmt English
Ryu: network operating system
Malware analysis
Security of Linux containers in the cloud
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
4. open mano set up and usage
Storage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdf
Linux sever building
Ad

More from OpenCity Community (20)

PDF
开源讲义.pdf
PDF
物联网操作系统漫谈-GIAC大会.pdf
PDF
2017开源年会-企业开源那些事儿-更新.pdf
PDF
社会化研发
PDF
Containers & CaaS
PPT
OaaS:Open as a Strategy
PDF
Hello openstack 2014
PDF
Docker openstack-2014
PDF
Learn OpenStack from trystack.cn
PDF
OpenStack系列公开课2 -20130508
PDF
OpenStack ecosystem
PDF
How to master OpenStack in 2 hours
PDF
Learn OpenStack from trystack.cn ——Folsom in practice
PDF
Quantum Networks
PDF
云计算思考
PDF
Openstorage Openstack
PDF
Openstack的研究与实践
PDF
Open Stack Cheng Du Swift Alex Yang
PDF
Nova与虚拟机管理
PDF
Deep Dive Into Quantum
开源讲义.pdf
物联网操作系统漫谈-GIAC大会.pdf
2017开源年会-企业开源那些事儿-更新.pdf
社会化研发
Containers & CaaS
OaaS:Open as a Strategy
Hello openstack 2014
Docker openstack-2014
Learn OpenStack from trystack.cn
OpenStack系列公开课2 -20130508
OpenStack ecosystem
How to master OpenStack in 2 hours
Learn OpenStack from trystack.cn ——Folsom in practice
Quantum Networks
云计算思考
Openstorage Openstack
Openstack的研究与实践
Open Stack Cheng Du Swift Alex Yang
Nova与虚拟机管理
Deep Dive Into Quantum

Look Into Libvirt Osier Yang

  • 2. Status ● First release on Dec 19 2005 ● 1.0.0 in two weeks. (Finally) ● 25 maitainers/commiters. ● 200 ~ 300 patches per release ● Less than 300 APIs
  • 3. Why libvirt? ● Long term API/ABI/XML back-compact ● Portable between various HVs ● Hides complex interfaces of HV ● Hides HV's API changes ● Available on Linux, Solaris, Windows & OS-X ● Secure access (TLS, SASL, SSH, PolicyKit) ● Open, LGPLv2+ license
  • 4. What libvirt manages ● Domain ● Virtual network ● Host network interface ● Node device ● Storage pool/volume ● Network filter ● Secret
  • 5. Supported hypervisors ● QEMU/KVM ● XEN: XenD, XenStored, XM, libxenlight ● VMWare: ESX, GSX server, Workstation, Player ● Linux container: LXC, OpenVZ ● Test, Remote ● UML, VirtualBox, Hyper-V, Parallels, etc
  • 6. Virtual network ● Nat (dnsmasq/Radvd, iptables) ● Route ● Isolated ● Bridge (Open vSwitch, Macvtap) ● Host network interface passthrough (SR-IOV VFs pool)
  • 7. Host network interface ● Based on netcf -> augeas ● Enumerate ● Management(ethernets, bonds, bridges, vlan interfaces) ● Transaction support – revert/commit config changes ● Report status (libnl, ioctl, sysfs)
  • 8. Network filter ● iptables ● ebtables ● Ip6tables ● E.g. allow-incoming-ipv4 no-ip-multicast
  • 9. Storage ● pool, volume ● fs (dir, fs, netfs) ● scsi ● Iscsi ● Disk ● lvm ● mpath ● sheepdog, rbd
  • 10. Node device ● Enumerate host devices ● Backends (udev, HAL) ● vHBA create/destroy
  • 11. Secret ● Encrypt storage ● Can be used to encrypt a storage volume or domain disk ● Only support qcow disks
  • 12. Miscellaneous ● Hooks (Daemon, QEMU, LXC, Migration) ● Audit ● Security (Selinux/Apparmor, sVirt) ● Locking (libsanlock, POSIX fcntl) ● Zero-conf (Avahi) ● etc...
  • 13. How to talk with QEMU ● Monitor (HMP, QMP) ● Guest agent monitor ● Serial/Parrell console ● Graphic console (vnc/spice) ● Network
  • 14. Domain APIs (libvirt.h) ● Lifecyle (define/undefine, start/destroy, suspend/resume), list, lookup. ● Save, restore, core dump, suspend, resume ● Migration ● Snapshot (Internal/External, Disk-only/ System checkpoint/VM state) ● Guest resource management (memory, network, memory, cpu, NUMA tuning)
  • 15. Domain APIs (libvirt.h) ● Host device passthrough ● Detach/reattach node devices ● Async events ● Node resource management (memory) ● APIs based on guest agent (E.g. S3/S4) ● Guest block/network I/O statistics ● ...more...
  • 16. libvirt architecture Node client libvirt-qemu public API Agent monitor qemu-kvm libvirtd monitor RPC remote $URI uri = “qemu://$hostname/system" Guest guest agent
  • 17. The stack virsh virsh bindings SNMP AMQP ...... public API libvirtd KVM XEN ESX LXC UML ...... Network Storage Iface nwfilter Secret Nodedev cgroup netcf iptables ebtables tc libnl lvm selinux sysfs udev HAL devmap iscsiadm ioctl libnuma numad sanlock qemu-img
  • 18. Stuffs around ● Language bindings (Python, Perl, Ruby, Jave, OCaml, C#, PHP) ● Libvirt-snmp ● Libvirt-qpid ● Libvirt-cim ● libvirt-glib (libvirt-glib, libvirt-gconf, libvirt- gobject)
  • 19. Stuffs around ● Virt-manager ● virt-viewer ● python-virtinst ● Libosinfo ● Libvirt-designer ● Libvirt-sandbox ● Gnome Boxes
  • 20. Stuffs around ● Virt-manager, virt-viewer ● python-virtinst ● Libosinfo ● Libvirt-designer ● Libvirt-sandbox ● Gnome Boxes ● Eucalyptus, openstack ● Plugins for collectd, munin, Nagios, Zenoss
  • 21. libguestfs ● For accessing and modifying virtual machine (VM) disk images ● View and edit files inside guests ● Scripting changes to VM ● Monitoring disk used/free statistics ● P2V, V2V ● Performing partial backups ● Cloning VMs, etc..
  • 22. How libguestfs works Appliance client qemu guestfsd libguestfs Linux kernel Device or Disk image
  • 23. virt-v2v ● Convert VMs on XEN/ESX to RH virt stack ● Support guests of RHEL, Fedora, Windows ● Based on libguestfs and libvirt
  • 24. How virt-v2v works ● Shutdown guest on source host ● Use libvirt to get domain XML config ● Copy storage ● Convert storage and modify XML ● Use libvirt to define and start the domain on dest host
  • 25. The conversion - RHEL/FC ● Remove XEN/ESX specific stuffs (E.g. xenpv kernel/drivers, VMWare tools) ● Install or update kernel, try best to let it support virtio ● Update block and network drivers
  • 26. Ongoing or TODO ● Snapshot improvements ● Storage driver improvements (glusterfs, job, inotify) ● LXC driver improvements ● Persistent vHBA ● Migration with NPIV ● Associate storage with domain ● Improve device hotplug
  • 27. Ongoing or TODO ● Lifecycle events for all objects ● Role based access control on all public APIs ● Isolate QEMU process with Linux Container namespaces. ● APIs to expose host/hypervior's capabilities ● Etc...