Libvirt support for libxl 
Jim Fehlig 
jfehlig@suse.com
2 
Why libvirt? 
• The tools! 
‒ virt-manager, virt-viewer, installers, monitoring, IaaS, ... 
‒ http://libvirt.org/apps.html 
• Stable API for managing virutalization on a host 
‒ Storage, network interfaces, networks, host devices, 
hypervisors, and virtual machines 
• Stable XML config format for managed entities 
‒ Extensible 
‒ Simple APIs
3 
Why libvirt? 
• Insulate users from changes in underlying 
components 
• Secure migration protocols 
• Integration with other subsystems used in the 
virtualization ecosystem 
• Wide hypervisor support 
‒ Xen, KVM/QEMU, LXC, ESX, Hyper-V, XenServer, VirtualBox, 
bhyve, UML, ...
4 
libvirt Architecture 
stateful stateless 
remote ESX hyperv 
RPC 
libvirtd 
VMware Hyper-V 
Client (virsh) 
libvirt.so 
xen 
qemu lxc storage network 
xend libxl
5 
Hypervisor driver 
• Accessed via hypervisor+protocol URI 
‒ xen+ssh://host, qemu+tls://host 
‒ xen:///, xen:///system, qemu:///system 
• 202 functions in virDriver struct (src/driver.h) 
‒ qemu: 192 functions 
‒ Legacy xen: 91 functions 
‒ libxl: 91 functions 
‒ lxc: 86 functions 
‒ esx: 73 functions 
‒ hyperv: 31 functions 
• src/<hypervisor>/<hypervisor>_driver.c
6 
Legacy Xen driver 
• Uber-driver that uses xend, xenstore, xm, and 
hypercalls 
• Requires and primarily uses xend 
• Became a stateful driver in libvirt 1.0.5, but state 
maintained in xend 
• I repeat: state is maintained in xend
7 
libxl Xen driver 
• Introduced in libvirt 0,9.0 
• Supports Xen >= 4.2 (best to have latest 4.x.y) 
• Accessed with same Xen URI 
• All existing domain configuration should just work 
• Will not load if legacy Xen driver is loaded (xend is 
running) 
• Stateful driver, state maintained in libvirt 
• I repeat: state is maintained in libvirt 
• Note: don't mix and match libxl apps
8 
Migrating libvirt from xend to libxl 
• Export domain config 
virsh dumpxml > dom.xml 
• Update Xen and libvirt 
• Import domain config 
virsh define dom.xml 
• Alternatively 
‒ virsh domxml-from-native <native-config> > dom.xml 
‒ virsh define dom.xml
9 
Planned Improvements 
• Support for xl config format 
‒ domxml-{to,from}-native 
• LockManager integration 
• Snapshots 
• Spice 
• Unit tests 
• <your feature>
10 
Help Wanted! 
• SPoF with only one maintainer of upstream Xen 
drivers 
• Need more libxl APIs 
• Need more functions implemented in the libxl driver 
• Please consider libvirt when adding APIs to libxl 
git://libvirt.org/libvirt.git 
http://libvirt.org/hacking.html
11 
Questions?

XPDS14: libvirt support for libxenlight - James Fehlig, SUSE

  • 1.
    Libvirt support forlibxl Jim Fehlig jfehlig@suse.com
  • 2.
    2 Why libvirt? • The tools! ‒ virt-manager, virt-viewer, installers, monitoring, IaaS, ... ‒ http://libvirt.org/apps.html • Stable API for managing virutalization on a host ‒ Storage, network interfaces, networks, host devices, hypervisors, and virtual machines • Stable XML config format for managed entities ‒ Extensible ‒ Simple APIs
  • 3.
    3 Why libvirt? • Insulate users from changes in underlying components • Secure migration protocols • Integration with other subsystems used in the virtualization ecosystem • Wide hypervisor support ‒ Xen, KVM/QEMU, LXC, ESX, Hyper-V, XenServer, VirtualBox, bhyve, UML, ...
  • 4.
    4 libvirt Architecture stateful stateless remote ESX hyperv RPC libvirtd VMware Hyper-V Client (virsh) libvirt.so xen qemu lxc storage network xend libxl
  • 5.
    5 Hypervisor driver • Accessed via hypervisor+protocol URI ‒ xen+ssh://host, qemu+tls://host ‒ xen:///, xen:///system, qemu:///system • 202 functions in virDriver struct (src/driver.h) ‒ qemu: 192 functions ‒ Legacy xen: 91 functions ‒ libxl: 91 functions ‒ lxc: 86 functions ‒ esx: 73 functions ‒ hyperv: 31 functions • src/<hypervisor>/<hypervisor>_driver.c
  • 6.
    6 Legacy Xendriver • Uber-driver that uses xend, xenstore, xm, and hypercalls • Requires and primarily uses xend • Became a stateful driver in libvirt 1.0.5, but state maintained in xend • I repeat: state is maintained in xend
  • 7.
    7 libxl Xendriver • Introduced in libvirt 0,9.0 • Supports Xen >= 4.2 (best to have latest 4.x.y) • Accessed with same Xen URI • All existing domain configuration should just work • Will not load if legacy Xen driver is loaded (xend is running) • Stateful driver, state maintained in libvirt • I repeat: state is maintained in libvirt • Note: don't mix and match libxl apps
  • 8.
    8 Migrating libvirtfrom xend to libxl • Export domain config virsh dumpxml > dom.xml • Update Xen and libvirt • Import domain config virsh define dom.xml • Alternatively ‒ virsh domxml-from-native <native-config> > dom.xml ‒ virsh define dom.xml
  • 9.
    9 Planned Improvements • Support for xl config format ‒ domxml-{to,from}-native • LockManager integration • Snapshots • Spice • Unit tests • <your feature>
  • 10.
    10 Help Wanted! • SPoF with only one maintainer of upstream Xen drivers • Need more libxl APIs • Need more functions implemented in the libxl driver • Please consider libvirt when adding APIs to libxl git://libvirt.org/libvirt.git http://libvirt.org/hacking.html
  • 11.