Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Libvirt and bhyve
Craig Rodrigues
rodrigc@FreeBSD.org
Bay Area FreeBSD Users Group
July 10, 2014
libvirt
What is libvirt?
● Open source project: http://libvirt.org
● Toolkit to interact with hypervisors: KVM, Xen,
LXC, OpenVZ, ...
Libvirt architecture
Source:
http://www.tuxradar.com/content/howto-linux-and-wind
libvirt and bhyve
Libvirt and bhyve:
Thanks to Roman
● Roman Bogorodskiy <novel@freebsd.org> has
added bhyve support to libvirt
● Roman has ...
Installing the code
● Need to build from ports, patches committed on July
9, 2014
● Update ports tree:
portsnap fetch; por...
Running the code
● Customize /usr/local/etc/libvirtd.conf
● Start the demon: libvirtd
● Edit a config file in XML format w...
py-libvirt
py-libvirt
● Python bindings for libvirt
● Available in ports: /usr/ports/devel/py-libvirt
py-libvirt sample code
import libvirt
import sys
# Note we need to specify the URL here
conn = libvirt.openReadOnly("bhyve...
virt-manager
What is virt-manager?
● GUI application for interacting with libvirt
● Written in Python, with GTK bindings for GUI
● Avai...
virt-manager screenshot
Jenkins and libvirt
Jenkins libvirt plugin
● Libvirt slaves plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Libvirt+S
● Allows VM's to be ...
Thanks!
● Roman Bogorodskiy <novel@freebsd.org>,
wrote the code, pushed it upstream
● Jason Helfman <jgh@freebsd.org>, mai...
I need help
● Need more people to try this stuff out
● Report bugs to
freebsd-virtualization@freebsd.org
(see http://lists...
Upcoming SlideShare
Loading in …5
×

Libvirt and bhyve under FreeBSD

6,591 views

Published on

This presentation discusses using the libvirt virtualization API for controlling bhyve virtual machines under FreeBSD.

Video for this presentation is available at:

https://www.youtube.com/watch?v=LRLV_SZo6Sw

Published in: Software

Libvirt and bhyve under FreeBSD

  1. 1. Libvirt and bhyve Craig Rodrigues rodrigc@FreeBSD.org Bay Area FreeBSD Users Group July 10, 2014
  2. 2. libvirt
  3. 3. What is libvirt? ● Open source project: http://libvirt.org ● Toolkit to interact with hypervisors: KVM, Xen, LXC, OpenVZ, Usermode Linux, VirtualBox, VMWare ESX, Hyper-V, Parallels, Bhyve ● C library, with bindings for other languages: Python, Ruby, Java, C#, Ocaml, Perl, PHP ● Used by many 3rd party applications
  4. 4. Libvirt architecture Source: http://www.tuxradar.com/content/howto-linux-and-wind
  5. 5. libvirt and bhyve
  6. 6. Libvirt and bhyve: Thanks to Roman ● Roman Bogorodskiy <novel@freebsd.org> has added bhyve support to libvirt ● Roman has pushed the code upstream to libvirt.org
  7. 7. Installing the code ● Need to build from ports, patches committed on July 9, 2014 ● Update ports tree: portsnap fetch; portsnap update ● Make sure you have libvirt 1.2.6 or higher ● Build it: cd /usr/ports/devel/libvirt; make; make install ● In future, pkg install devel/libvirt
  8. 8. Running the code ● Customize /usr/local/etc/libvirtd.conf ● Start the demon: libvirtd ● Edit a config file in XML format with the bhyve VM info ● Run commands via virsh to start the VM ● See step-by-step instructions: http://people.freebsd.org/~rodrigc/libvirt/libvirt-bhyve
  9. 9. py-libvirt
  10. 10. py-libvirt ● Python bindings for libvirt ● Available in ports: /usr/ports/devel/py-libvirt
  11. 11. py-libvirt sample code import libvirt import sys # Note we need to specify the URL here conn = libvirt.openReadOnly("bhyve:///system") if conn == None: print 'Failed to open connection to the hypervisor' sys.exit(1) try: print("All domains: ",conn.listAllDomains()) print("Defined domains: ", conn.listDefinedDomains()) dom0 = conn.lookupByName("bhyve") except: print 'Failed to find the main domain' sys.exit(1) print("Domain 0: id %d running" % (dom0.ID())) print(dom0.info())
  12. 12. virt-manager
  13. 13. What is virt-manager? ● GUI application for interacting with libvirt ● Written in Python, with GTK bindings for GUI ● Available in ports: /usr/ports/deskutils/virt-manager ● Patch to port for bhyve required: http://people.freebsd.org/~rodrigc/libvirt/virt-manage
  14. 14. virt-manager screenshot
  15. 15. Jenkins and libvirt
  16. 16. Jenkins libvirt plugin ● Libvirt slaves plugin: https://wiki.jenkins-ci.org/display/JENKINS/Libvirt+S ● Allows VM's to be created on demand in response to build jobs, and shut down after job is complete ● See step-by-step instructions: http://people.freebsd.org/~rodrigc/libvirt/libvirt-bhyve
  17. 17. Thanks! ● Roman Bogorodskiy <novel@freebsd.org>, wrote the code, pushed it upstream ● Jason Helfman <jgh@freebsd.org>, maintains the libvirt port
  18. 18. I need help ● Need more people to try this stuff out ● Report bugs to freebsd-virtualization@freebsd.org (see http://lists.freebsd.org ) ● Supply code, patches, and documentation ● Implement more of the libvirt API for bhyve, and send patches to Roman

×