Libvirt and bhyve under FreeBSD
-
Upload
craig-rodrigues -
Category
Software
-
view
5.797 -
download
0
Transcript of Libvirt and bhyve under FreeBSD
Libvirt and bhyve
Craig Rodrigues
[email protected]
Bay Area FreeBSD Users GroupJuly 10, 2014
libvirt
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
Libvirt architecture
Source: http://www.tuxradar.com/content/howto-linux-and-windows-virtualization-kvm-and-qemu
libvirt and bhyve
Libvirt and bhyve:
Thanks to Roman
Roman Bogorodskiy has added bhyve support to libvirt
Roman has pushed the code upstream to libvirt.org
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
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.html
py-libvirt
py-libvirt
Python bindings for libvirt
Available in ports: /usr/ports/devel/py-libvirt
py-libvirt sample code
import libvirtimport sys
# Note we need to specify the URL hereconn = 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())
virt-manager
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-manager.html
virt-manager screenshot
Jenkins and libvirt
Jenkins libvirt plugin
Libvirt slaves plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Libvirt+Slaves+Plugin
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-jenkins.html
Thanks!
Roman Bogorodskiy , wrote the code, pushed it upstream
Jason Helfman , maintains the libvirt port
I need help
Need more people to try this stuff out
Report bugs to [email protected]
(see http://lists.freebsd.org )
Supply code, patches, and documentation
Implement more of the libvirt API for bhyve, and send patches to Roman