Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 71 lines (62 sloc) 1.633 kb
#!/usr/bin/env perl
#
# this generates an XML template for libvirt domain specification,
# which is tailored to an instance by the node controller
use diagnostics;
use warnings;
use sigtrap;
use strict;
use English; # for descriptive predefined var names
use Data::Dumper; # for debugging: print Dumper($var)
use Getopt::Long;
use FindBin;
$OUTPUT_AUTOFLUSH = 1; # no output buffering
our $use_ramdisk = 0;
our $use_ephemeral = 0;
# deal with command-line parameters
GetOptions('ramdisk' => sub { $use_ramdisk = 1; },
'ephemeral' => sub { $use_ephemeral = 1; }
) or exit (1);
print <<EOF;
<domain type='xen' id='18'>
<name>NAME</name>
<os>
<type>linux</type>
<kernel>BASEPATH/kernel</kernel>
EOF
if ( $use_ramdisk ) {
print " <initrd>BASEPATH/ramdisk</initrd>\n";
}
print <<EOF;
<root>/dev/sda1</root>
<cmdline> ro</cmdline>
</os>
<memory>MEMORY</memory>
<vcpu>VCPUS</vcpu>
<devices>
<disk type='file'>
<source file='BASEPATH/root'/>
<target dev='sda1'/>
</disk>
EOF
if ( $use_ephemeral ) {
print <<EOF;
<disk type='file'>
<source file='BASEPATH/ephemeral'/>
<target dev='sda2'/>
</disk>
EOF
}
print <<EOF;
<disk type='file'>
<source file='SWAPPATH/swap'/>
<target dev='sda3'/>
</disk>
<interface type='bridge'>
<source bridge='BRIDGEDEV'/>
<mac address='PRIVMACADDR'/>
<script path='/etc/xen/scripts/vif-bridge'/>
</interface>
</devices>
</domain>
EOF
Jump to Line
Something went wrong with that request. Please try again.