Packages
* RPM -
http://upload.packages.lcfg.ucs.ed.ac.uk/pkgs/devolved/world/sl5_64/rpms/lcfg-libvirt-0.1.2-1.noarch.rpm
* SRPM -
http://upload.packages.lcfg.ucs.ed.ac.uk/pkgs/devolved/world/sl5_64/srpms/lcfg-libvirt-0.1.2-1.src.rpm
* Schema -
http://upload.packages.lcfg.ucs.ed.ac.uk/pkgs/devolved/world/sl5_64/rpms/lcfg-libvirt-defaults-s1-0.1.2-1.noarch.rpm
Any bug reports to lcfg-xen have been applied to lcfrg-libvirt as well. Any future bug reports to lcfg-xen will be applied to lcfg-libvirt where there's common code/functionality.
For XEN hosts, the following header (libvirt_xen.h) is required:
#ifndef MDP_OPTIONS_LIBVIRT
#ifndef DENY_MDP_OPTIONS_LIBVIRT
#define MDP_OPTIONS_LIBVIRT
#ifdef OS_LINUX
!profile.packages mADD(lcfg-libvirt-0.1.2-1/noarch)
/* Make sure we've got the Xen packagelist installed */
#include <lcfg/options/xen.h>
/* Need to install more recent version of libvirt for
* converting standard Xen config files to libvirt's XML */
!profile.packages mEXTRA(+libvirt-python-0.6.4-3.phys)
!profile.packages mEXTRA(+libvirt-devel-0.6.4-3.phys)
!profile.packages mEXTRA(+libvirt-0.6.4-3.phys)
/* Add qemu package that the latest xen component depends on */
!profile.packages mEXTRA(qemu-img-0.9.1-11.el5)
/* Pull in the default resources */
#include <mdp/defaults/libvirt.h>
!libvirt.hosttype mSET(xen)
/* Add the required packages if running a minimal build */
!profile.pkgcppopts mADD(-DXEN)
/* Instruct the kernel component to manage the xen type of kernel
symbolic links (for initrd, kernel, etc.) */
!kernel.kerneltype mSET(xen)
/* Add GRUB stanzas (at the beginning) for the xen kernel (and xen
kernel single user) and set it to be default. Warning, these
settings assume a "standard" MDP GRUB config. See
'mdp/defaults/grub.h'. The PIE 'image-build-lcfg' script looks for
'xen' in the grub.menuitems_defaultboot resource, and if there is
one it then munges the menu.lst that the grub component created to
ensure it boots by default the 'disk1' entry, since the XEN kernel
isn't installed at first boot (it's not in the image). */
#ifdef MDP_DEFAULTS_GRUB
!grub.menuitems_defaultboot mPREPEND(xen xensingle)
grub.root_defaultboot_xen (hd0,4)
grub.kernel_defaultboot_xen /boot/xen.gz
grub.modules_defaultboot_xen kernel initrd
grub.module_defaultboot_xen_kernel /boot/vmlinuz root=<%grub.kroot_defaultboot_disk1%> <%grub.kernelargs_defaultboot_disk1%>
grub.module_defaultboot_xen_initrd /boot/initrd.img
grub.boot_defaultboot_xen yes
grub.title_defaultboot_xen Scientific Linux (XEN)
grub.root_defaultboot_xensingle (hd0,4)
grub.kernel_defaultboot_xensingle /boot/xen.gz
grub.modules_defaultboot_xensingle kernel initrd
grub.module_defaultboot_xensingle_kernel /boot/vmlinuz root=<%grub.kroot_defaultboot_disk1single%> <%grub.kernelargs_defaultboot_disk1single%>
grub.module_defaultboot_xensingle_initrd /boot/initrd.img
grub.boot_defaultboot_xensingle yes
grub.title_defaultboot_xensingle Scientific Linux (XEN Single User)
#else
#error Must include mdp/defaults/grub.h before mdp/defaults/xen-host.h.
#endif /* MDP_DEFAULTS_GRUB */
/* FIXME: Temporarily remove the i386 version of libvirt which was
erroneously (at my and Panos' request) added to
lcfg_sl5_64_xen.rpms. Check if still needed after the 20080911???
release. */
#ifdef ARCH_X86_64
!profile.packages mEXTRA(-i386/libvirt-*-*)
#endif /* ARCH_X86_64 */
#else
#error Only Linux clients can run libvirt.
#endif /* OS_LINUX */
#else
#pragma LCFG denied "mdp/options/libvirt.h"
#endif /* DENY_MDP_OPTIONS_LIBVIRT */
#else
#pragma LCFG seen "mdp/options/libvirt.h"
#endif /* MDP_OPTIONS_LIBVIRT */
/* eof */
For KVM host, the following header (libvirt_kvm.h) is required:
#ifndef MDP_OPTIONS_LIBVIRT
#ifndef DENY_MDP_OPTIONS_LIBVIRT
#define MDP_OPTIONS_LIBVIRT
#ifdef OS_LINUX
!profile.packages mADD(lcfg-libvirt-0.1.2-1/noarch)
/* Get our default resources set */
#include <mdp/defaults/libvirt.h>
/* Add some packages which are missing from the full build */
/* FIXME: Why don't we include the xen packagelist to get
* most of these? */
!profile.packages mADD(libvirt)
profile.packages_libvirt \
xen-libs-3.0.3-94.el5_4.1 \
kvm-kmod-2.6.30.1-1.phys \
xen-devel-3.0.3-94.el5_4.1 \
qemu-kvm-0.11.0-1.phys \
libvirt-python-0.6.4-3.phys \
libvirt-devel-0.6.4-3.phys \
libvirt-0.6.4-3.phys \
virt-manager-0.5.3-10.el5 \
python-virtinst-0.300.2-12.sl.1/noarch \
pulseaudio-libs-0.9.10-1.el5.3 \
/** lcfg-network-1.99.34_dev-23/noarch **/
!libvirt.hosttype mSET(kvm)
#else
#error Only Linux clients can run libvirt.
#endif /* OS_LINUX */
#else
#pragma LCFG denied "mdp/options/libvirt.h"
#endif /* DENY_MDP_OPTIONS_LIBVIRT */
#else
#pragma LCFG seen "mdp/options/libvirt.h"
#endif /* MDP_OPTIONS_LIBVIRT */
/* eof */
Having created the headers, they could be used by including them in the host's profile as bellow (one per host - they can't co-exist):
#include <phys/options/epcc/libvirt_xen.h>
#include <phys/options/epcc/libvirt_kvm.h>
To have libvirt work effectively, it requires active bridge networking. lcfg-network supports this:
!network.interfaces mADD(eth0 br0)
!network.hwaddr_eth0 mSET(XX:XX:XX:XX:XX:XX)
!network.ipaddr_eth0 DHCP
!network.bridge_eth0 br0
!network.ipaddr_br0 DHCP
!network.type_br0 Bridge
Virtual host example:
!libvirt.vms mADD(pe2900x1 pe2900x2)
!libvirt.name_pe2900x1 mSET(pe2900x1)
!libvirt.type_pe2900x1 mSET(hvm)
!libvirt.uuid_pe2900x1 mSET(56bcea35-a598-4ce8-97f1-02cba34e325)
!libvirt.disks_pe2900x1 mADD(root)
!libvirt.diskname_pe2900x1_root mSET(pe2900x1)
!libvirt.disksize_pe2900x1_root mSET(32)
!libvirt.diskpath_pe2900x1_root mSET(/guests)
!libvirt.boot_pe2900x1 mSET(yes)
!libvirt.opts_pe2900x1 mADD(vnc monitor)
!libvirt.optvalue_pe2900x1_vnc mSET(1)
!libvirt.optvalue_pe2900x1_monitor mSET(pty)
!libvirt.nethost_pe2900x1 mADD(vif1)
!libvirt.hostmac_pe2900x1_vif1 mSET(11:11:aa:cc:dd:ff)
!libvirt.bridge_pe2900x1_vif1 mSET(routed)
!libvirt.netmode_pe2900x1_vif1 mSET(network)
!libvirt.name_pe2900x2 mSET(pe2900x2)
!libvirt.type_pe2900x2 mSET(hvm)
!libvirt.uuid_pe2900x2 mSET(56bcea35-a598-4ce8-97f1-02aba24f2819)
!libvirt.disks_pe2900x2 mADD(root)
!libvirt.diskname_pe2900x2_root mSET(pe2900x2)
!libvirt.disksize_pe2900x2_root mSET(32)
!libvirt.diskpath_pe2900x2_root mSET(/guests)
!libvirt.opts_pe2900x2 mADD(vnc monitor)
!libvirt.optvalue_pe2900x2_vnc mSET(1)
!libvirt.optvalue_pe2900x2_monitor mSET(pty)
!libvirt.nethost_pe2900x2 mSET(vif1 vif2)
!libvirt.hostmac_pe2900x2_vif1 mSET(21:22:33:44:55:1c)
!libvirt.bridge_pe2900x2_vif1 mSET(routed)
!libvirt.netmode_pe2900x2_vif1 mSET(network)
!libvirt.hostmac_pe2900x2_vif2 mSET(22:2d:ab:21:2c:4a)
!libvirt.bridge_pe2900x2_vif2 mSET(default)
!libvirt.netmode_pe2900x2_vif2 mSET(network)
!libvirt.template_pe2900x2 mSET(/guests/pe2900x1.img)
!libvirt.partition_pe2900x2 mSET(1)
Additional interface example:
!libvirt.networking mADD(routed)
!libvirt.nettype_routed mSET(interface)
!libvirt.netname_routed mSET(routed)
!libvirt.netuuid_routed mSET(56bcea35-a598-4ce8-97f1-12def24s5125)
!libvirt.bridgename_routed mSET(virbr19)
!libvirt.mode_routed mSET(nat)
!libvirt.ipaddr_routed mSET(192.168.7.1)
!libvirt.netmask_routed mSET(255.255.255.0)
!libvirt.dhcpstart_routed mSET(192.168.7.2)
!libvirt.dhcpend_routed mSET(192.168.7.254)
!libvirt.activate_routed mSET(yes)
Virtual group example:
!libvirt.virtualgroup mADD(cluster1)
!libvirt.groupmemory_cluster1 mSET(1024)
!libvirt.groupvcpus_cluster1 mSET(2)
!libvirt.groupnettype_cluster1 mSET(network)
!libvirt.groupbridge_cluster1 mSET(routed)
Storage pool example:
!libvirt.storagepools mADD(testpool)
!libvirt.pooltype_testpool mSET(dir)
!libvirt.poolname_testpool mSET(testpool)
!libvirt.pooluuid_testpool mSET(0ff699dd-a286-443d-a35a-31f00c9d82e7)
!libvirt.targetPath_testpool mSET(/mnt/test)
!libvirt.allocation_testpool mSET(200)
!libvirt.capacity_testpool mSET(150)
!libvirt.available_testpool mSET(100)
!libvirt.targetOwner_testpool mSET(980)