We’ve just pushed some of the code myself and John Levon had been working on over the past few months to opensolaris.org: virtcfg and virtadm. (I was hoping to get this pushed in time for Christmas, hence the photo, but alas!)

Taking their inspiration from zonecfg(1M) and zoneadm(1M), we wanted to provide command-line and interactive interfaces to creating and maintaining xVM guests on OpenSolaris that would be familiar to sysadmins already using zones.

We tried to go a little further, and include a useful templating system that allows users to easily reuse guest configurations, or components of guest configurations (disk configs, network configs, etc.)

On the back-end, they use libvirt to communicate with the xVM hypervisor, but our eventual goal with these tools was to have them work with the other forms of virtualisation available on OpenSolaris: LDOMs, VirtualBox, perhaps also Zones: we think that with our design, it would be possible to manage all of these forms of virtualisation – though for now, the code just supports xVM.

For more information on how you can download the source and install the tools on your system, see virtcfg & virtadm: making xVM guest administration easy

We don’t have firm plans to integrate this into OpenSolaris, but thought that the code’s now in a good enough state that it could be put up on opensolaris.org for developers to look at. Do send feedback to xen-discuss on opensolaris.org if you like the project, or feel like sending us patches or bug reports.

Here’s a quick snippet of me showing a guest configuration in virtcfg, adding a new disk, showing what guest templates we include out of the box, then booting the guest.

# virtcfg ls -r osol
cpu_capped: 2
memory: 2048M
id/
id/displayname: osol
id/name: osol
id/uuid: 36947b42-cf0b-4bf5-affd-6d112a061812
id/osinfo/
id/osinfo/type: solaris
id/osinfo/variant: opensolaris
id/osinfo/version: [unset]
boot/
boot/args: [unset]
boot/autoboot: no
params/
params/acpi: no
params/brand: pv
params/hvm: no
params/ioapic: no
params/rtc: localtime
devices/
devices/network/
devices/network/address: [unset]
devices/network/datalink/
devices/network/datalink/cappedbandwidth: [unset]
devices/network/datalink/mac: 00:16:3e:6a:44:76
devices/network/datalink/name: auto
devices/network/datalink/over: auto
devices/network/datalink/type: vnic
devices/network/datalink/vlan: [unset]
devices/disk/
devices/disk/bus: xen
devices/disk/readonly: no
devices/disk/target: xvda
devices/disk/type: hd
devices/disk/volume/
devices/disk/volume/capacity: 16G
devices/disk/volume/format: raw
devices/disk/volume/local: [unset]
devices/disk/volume/name: space/guests/osol-disk1
devices/disk/volume/options: [unset]
devices/disk/volume/path: /dev/zvol/dsk/space/guests/osol-disk1
devices/disk/volume/type: zfs
devices/tty/
devices/tty/index: 0
install/
install/configuration: [unset]
install/source: file:///rpool/guests/osol-dev-129-x86.iso
install/status: installed
install/type: cd
#
# virtcfg osol
loading guest osol
Usage:
add [ -t tmpl ] <resource>        Add a resource
clear <property> ...              Clear one or more properties
clone <new guest>                 Clone a guest
commit [-f] [-t] [-n] [name]      Save configuration or template
context [context]                 Switch context
delete <name>                     Delete a template or guest configuration
exit                              Exit virtcfg
get | info [-p] <prop> ...        Get one or more property values
help [object] | [cmd]             Show help for a resource, property or command
history [-c]                      Print command history
list | ls [-r] [-l|-p] [path]..   List resources
prompt [on|off]                   Toggle or set the extended CLI prompting
remove | rm <expr> ...            Remove one or more resources or properties
select | cd [expr]                Navigate around the tree
set <prop>=<value>                Set a property value
templates [-pH] [-o field] [name] List templates
(osol)/:> cd devices
(osol)/devices:> add -t zvol disk
(osol)/devices/disk[2]:> ls
volume/
readonly: no
type: hd
(osol)/devices/disk[2]:> cd volume
(osol)/devices/disk[2]/volume:> ls
capacity: [unset]
format: raw
local: true
name: [unset]
options: [unset]
type: zfs
(osol)/devices/disk[2]/volume:> set name=space/guests/osol-disk2
(osol)/devices/disk[2]/volume:> set capacity=10g
(osol)/devices/disk[2]/volume:> commit
virtcfg: written osol
(osol)/devices/disk[2]/volume:> exit
# virtcfg templates guest
NAME                TYPE          LOCATION
centos-5.4          guest         -
debian-lenny        guest         -
fedora-11           guest         -
linux-hvm           guest         -
linux-pv            guest         -
opensolaris         guest         -
solaris10           guest         -
ubuntu              guest         -
windows-xp          guest         -
#
# virtadm boot osol
virtadm: booting osol
virtadm: creating ZFS volume space/guests/osol-disk2 ... done
Connected to domain 16
Escape character is '^]'
v3.4.2-xvm-debug chgset 'Sun Dec 06 22:26:11 2009 -0800 19673:56d9e54df9d2'
SunOS Release 5.11 Version snv_129 64-bit
Copyright 1983-2009 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
.
.

As a footnote, I’m actually moving on to other work in OpenSolaris – pkg(5): the Image Packaging System, so won’t be able to spend much time maintaining the part of the code I was previously responsible for (virtcfg), but I will try to keep a half an ear open to virtcfg issues.

Advertisements