1
0
mirror of synced 2026-05-02 06:35:25 +00:00
Files
xen-tools.xen-tools/etc/xm.tmpl
Brian Bennett 89e9a54b06 Fix misbehaviour if the --ip option is passed multiple times
According to xen-create-image(8) if --ip is passed multipe times then the
first IP is used as the "system" IP and the rest are used as aliases. What
actually happened is the last IP is the "system" IP and all other IP's are
silently ignored. (Closes Debian bug #652110)
2012-05-07 21:18:36 +02:00

159 lines
2.8 KiB
Cheetah

#
# Configuration file for the Xen instance {$hostname}, created
# by xen-tools {$xen_tools_version} on { scalar localtime }.
#
#
# Kernel + memory size
#
{ if ( ( $kernel ) && ( !defined($pygrub)) )
{
$OUT.= "kernel = '$kernel'";
}
}
{ if ( ( $initrd ) && ( !defined($pygrub)) )
{
$OUT.= "ramdisk = '$initrd'";
}
}
{
if ( $pygrub )
{
my $pygrub_bin = '';
foreach my $pygrub_path (reverse glob('/usr/lib/xen-*/bin/pygrub
/usr/lib/xen-default/bin/pygrub
/usr/*bin/pygrub')) {
if (-x $pygrub_path) {
$pygrub_bin = $pygrub_path;
last;
}
}
die "pygrub not found" unless $pygrub_bin;
$OUT .= "bootloader = '$pygrub_bin'\n";
}
}
vcpus = '{$vcpus}'
memory = '{$memory}'
#
# Disk device(s).
#
{
if ( !defined($image_vbd ) )
{
for ( my $i = $#PARTITIONS; $i >= 0 ; $i-- )
{
if ( $PARTITIONS[$i]{'mountpoint'} eq '/' )
{
$OUT .= "root = '/dev/$device" . ($i + 1) . " ro'\n";
}
}
$OUT .= "disk = [\n";
for ( my $i = $#PARTITIONS; $i >= 0 ; $i-- )
{
$OUT .= " '$PARTITIONS[$i]{'imagetype'}$PARTITIONS[$i]{'image'},$device" . ( $i + 1 ) .",w',\n";
}
$OUT .= " ]\n";
}
}
#
# Physical volumes
#
{
if ( $image_vbd )
{
$OUT .= "root = '/dev/$device" . "2 ro'\n";
$OUT .= "disk = [\n";
$OUT .= " '$image_vbd," . $device . "2,w',\n";
if ( $swap_vbd )
{
$OUT .= " '$swap_vbd," . $device . "1,w',\n";
}
$OUT .= " ]\n";
}
}
#
# Hostname
#
name = '{$hostname}'
#
# Networking
#
{ if ( $dhcp )
{
$OUT .= "dhcp = 'dhcp'\n";
# Setup the mac address, if present.
my $m = '';
if ( $mac )
{
$m = "mac=$mac"
}
my $br = '';
if ( $bridge )
{
if ( $mac )
{
$br = ",bridge=$bridge"
}
else
{
$br = "bridge=$bridge"
}
}
$OUT .= "vif = [ '";
$OUT .= "$m";
$OUT .= "$br";
$OUT .= "' ]";
}
else
{
#
# Setup the mac address, if present.
#
my $m = '';
if ( $mac )
{
$m = ",mac=$mac"
}
my $vn = '';
if ( $vifname )
{
$vn = ",vifname=$vifname";
}
my $br = '';
if ( $bridge )
{
$br = ",bridge=$bridge"
}
$OUT .= "vif = [ 'ip=$IP_ADDRESSES";
$OUT .= "$m";
$OUT .= "$vn";
$OUT .= "$br";
$OUT .= "' ]";
}
}
#
# Behaviour
#
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'
{ if ( $admins )
{
$OUT .= "xen_shell = '$admins'\n";
}
}