Look Into Libvirt Osier Yang

OpenCity Community
OpenCity CommunityFounder at OpenCity Community
                 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 
1 of 28

More Related Content

Similar to Look Into Libvirt Osier Yang(20)

OpenStack Nova Scheduler OpenStack Nova Scheduler
OpenStack Nova Scheduler
Peeyush Gupta13K views
RMLL / LSM 2009RMLL / LSM 2009
RMLL / LSM 2009
Franck_Villaume433 views
[KubeConEU2023] Lima pavilion[KubeConEU2023] Lima pavilion
[KubeConEU2023] Lima pavilion
Akihiro Suda115 views
Kvm and libvirtKvm and libvirt
Kvm and libvirt
plarsen67523 views
Libvirt/KVM Driver Update (Kilo)Libvirt/KVM Driver Update (Kilo)
Libvirt/KVM Driver Update (Kilo)
Stephen Gordon4.7K views
XS Japan 2008 Xen Mgmt EnglishXS Japan 2008 Xen Mgmt English
XS Japan 2008 Xen Mgmt English
The Linux Foundation894 views
Ryu: network operating systemRyu: network operating system
Ryu: network operating system
Isaku Yamahata3.6K views
Malware analysisMalware analysis
Malware analysis
xabean4.3K views
Security of Linux containers in the cloudSecurity of Linux containers in the cloud
Security of Linux containers in the cloud
Dobrica Pavlinušić4.6K views
Linux sever buildingLinux sever building
Linux sever building
Edmond Yu528 views
KVM tools and enterprise usageKVM tools and enterprise usage
KVM tools and enterprise usage
vincentvdk5K views
Linux container & dockerLinux container & docker
Linux container & docker
ejlp121.5K views
Linux advanced concepts - Part 2Linux advanced concepts - Part 2
Linux advanced concepts - Part 2
NAILBITER3.3K views
Open nebula frosconOpen nebula froscon
Open nebula froscon
OpenNebula Project1.7K views

More from OpenCity Community(20)

开源讲义.pdf开源讲义.pdf
开源讲义.pdf
OpenCity Community82 views
物联网操作系统漫谈-GIAC大会.pdf物联网操作系统漫谈-GIAC大会.pdf
物联网操作系统漫谈-GIAC大会.pdf
OpenCity Community35 views
社会化研发社会化研发
社会化研发
OpenCity Community809 views
Containers & CaaSContainers & CaaS
Containers & CaaS
OpenCity Community1.3K views
OaaS:Open as a StrategyOaaS:Open as a Strategy
OaaS:Open as a Strategy
OpenCity Community1.5K views
Hello openstack 2014Hello openstack 2014
Hello openstack 2014
OpenCity Community5.6K views
Docker openstack-2014Docker openstack-2014
Docker openstack-2014
OpenCity Community1.3K views
Learn OpenStack from trystack.cnLearn OpenStack from trystack.cn
Learn OpenStack from trystack.cn
OpenCity Community2.9K views
OpenStack系列公开课2 -20130508OpenStack系列公开课2 -20130508
OpenStack系列公开课2 -20130508
OpenCity Community2.1K views
OpenStack ecosystemOpenStack ecosystem
OpenStack ecosystem
OpenCity Community2.3K views
How to master OpenStack in 2 hoursHow to master OpenStack in 2 hours
How to master OpenStack in 2 hours
OpenCity Community6.4K views
Quantum NetworksQuantum Networks
Quantum Networks
OpenCity Community3K views
云计算思考云计算思考
云计算思考
OpenCity Community1.3K views
Openstorage OpenstackOpenstorage Openstack
Openstorage Openstack
OpenCity Community799 views
Openstack的研究与实践Openstack的研究与实践
Openstack的研究与实践
OpenCity Community1.3K views
Open Stack Cheng Du Swift Alex YangOpen Stack Cheng Du Swift Alex Yang
Open Stack Cheng Du Swift Alex Yang
OpenCity Community971 views
Nova与虚拟机管理Nova与虚拟机管理
Nova与虚拟机管理
OpenCity Community1.5K views
Deep Dive Into QuantumDeep Dive Into Quantum
Deep Dive Into Quantum
OpenCity Community1.7K views

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...