Tag Archives: oz-virt

Using OZ tool to create virtual guests (with minimal input)

OZ(part of the Aeolus project) is a neat tool by Chris Lalancette, to create JEOS(just enough operating system)  guests with minimal input. Where minimal input include things like: name of the guest ; OS details like – version, arch, url for the OS tree(or ISO), root-passwd. All of these attributes can be defined in a simple XML type file called TDL(template definition language). Read on for details.

Under the hood, OZ uses all the existing Virtualization infrastructure components like kvm/qemu, libvirt, libguestfs.

Ok,  OZ workflow goes like this:

1/ Firstly, ensure to have all the Fedora Virtualization packages.(if not already present)

$ yum groupinstall Virtualization 

2/ Enable packet forwarding on the host machine. (ensure this).

$ echo 1 > /proc/sys/net/ipv4/ip_forward 

3/ Prepare a simple TDL(template definition language)
(Don’t forget to replace the ‘url’ with a working Fedora install tree. Or ISO could also be used as install type. Refer to the ‘References’ section at the bottom)

 $ cat fedora_15_x86_64.tdl
<template>
  <name>zeus-f15</name>
  <os>
    <name>Fedora</name>
    <version>15</version>
    <arch>x86_64</arch>
    <install type='url'>
      <url>http://foo.bar.com/fedora/linux/releases/15/Fedora/x86_64/os/</url>
    </install>
    <rootpw>testpwd</rootpw>
  </os>
  <description>Fedora 15</description>
</template>

4/ Now, create the guest using the oz-install tool.(takes roughly 8-9 mins.)

$ /usr/bin/oz-install -d 4 fedora_15_x86_64.tdl 2>&1 | tee f15.out 

End of successful ‘oz-install’ output should look like this:

.
.
.

INFO:oz.Guest.FedoraGuest:Cleaning up after install
DEBUG:oz.Guest.FedoraGuest:Removing modified ISO
Libvirt XML was written to zeus-f15Aug_08_2011-16:16:08

Note: zeus-f15Aug_08_2011-16:16:08 is the xml definition file for the guest just created.
A successful run of oz-install looks like this on the stdout — http://kashyapc.fedorapeople.org/virt/oz/stdout-oz-install.txt

5/ Define the guest with the above XML.

$ virsh define zeus-f15Aug_08_2011-16:16:08
Domain zeus-f15 defined from zeus-f15Aug_08_2011-16:16:08

$ virsh start zeus-f5

$ virsh list --all
 Id Name                 State
----------------------------------
  1 zeus-f15             running

I’ve composed most of this into a quick shell script here – http://kashyapc.fedorapeople.org/virt/oz/oz-jeos.bash

References:

  1. oz project page — http://aeolusproject.org/oz.html.
  2. More customizations can be done. All the supported attributes for TDL file can be found in the OZ git repo — https://github.com/clalancette/oz/blob/master/docs/tdl.rng

Leave a comment

Filed under Uncategorized