2007-10-25 12:05:21 by steve
Allow the output file to be specified via --output + --extension
This commit is contained in:
parent
09b0f2af3c
commit
ebfc2b3cac
3
AUTHORS
3
AUTHORS
@ -48,6 +48,9 @@ Contributions
|
||||
Walter Reiner <walter [at] at.wreiner>
|
||||
- Provided --image-dev + --swap-dev patch.
|
||||
|
||||
Jameson Rollins <jrollins [at] edu.columbia.phys>
|
||||
- Provided --output + --extension code.
|
||||
|
||||
Felipe Scarel <fbscarel [at] com.gmail>
|
||||
- Bugfix for --no-swap + LVM
|
||||
|
||||
|
||||
@ -186,7 +186,7 @@ Install a new distribution.
|
||||
Run a collection of hook scripts to customise the freshly installed system.
|
||||
|
||||
=item B<xt-create-xen-config>
|
||||
Create a configuration file in /etc/xen so that xm can create the new image.
|
||||
Create a Xen configuration file in so that xm can start the new domain.
|
||||
|
||||
=back
|
||||
|
||||
@ -354,7 +354,8 @@ Create a configuration file in /etc/xen so that xm can create the new image.
|
||||
=head1 XEN CONFIGURATION FILE
|
||||
|
||||
Once a new image has been created an appropriate configuration file
|
||||
for Xen will be saved in the directory /etc/xen.
|
||||
for Xen will be saved in the directory /etc/xen by default. However
|
||||
you may change the ouput directory with the --output flag.
|
||||
|
||||
The configuration file is built up using the template file
|
||||
/etc/xen-tools/xm.tmpl - which is a file processed via
|
||||
@ -591,7 +592,7 @@ Install an X11 server, using VNC and XDM
|
||||
--
|
||||
http://www.steve.org.uk/
|
||||
|
||||
$Id: xen-create-image,v 1.187 2007-10-16 21:28:56 steve Exp $
|
||||
$Id: xen-create-image,v 1.188 2007-10-25 12:05:21 steve Exp $
|
||||
|
||||
=cut
|
||||
|
||||
@ -927,13 +928,17 @@ if ( $CONFIG{'boot'} )
|
||||
#
|
||||
# (Will be present if this is overwriting a previous image, for example.)
|
||||
#
|
||||
if ( ( -d "/etc/xen/auto" ) &&
|
||||
( ! -e "/etc/xen/auto/$CONFIG{'hostname'}.cfg" ) )
|
||||
if ( -d "/etc/xen/auto" )
|
||||
{
|
||||
$xt->log( "Creating auto-start symlink\n" );
|
||||
my $cfg = $CONFIG{'output'} . "/" . $CONFIG{'hostname'} . $CONFIG{'suffix'};
|
||||
|
||||
my $link = "ln -s /etc/xen/$CONFIG{'hostname'}.cfg /etc/xen/auto/";
|
||||
runCommand( $link );
|
||||
if ( ! -e $cfg )
|
||||
{
|
||||
$xt->log( "Creating auto-start symlink to: $cfg\n" );
|
||||
|
||||
my $link = "ln -s $cfg /etc/xen/auto/";
|
||||
runCommand( $link );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -949,10 +954,13 @@ if ( $CONFIG{'boot'} )
|
||||
}
|
||||
else
|
||||
{
|
||||
# Child.
|
||||
system( "$CONFIG{'xm'} create $CONFIG{'hostname'}.cfg >/dev/null 2>/dev/null" );
|
||||
# Config file.
|
||||
my $cfg = $CONFIG{'output'} . "/" . $CONFIG{'hostname'} . $CONFIG{'suffix'};
|
||||
|
||||
$xt->log( "Started new Xen guest: $CONFIG{'hostname'}\n" );
|
||||
# Child.
|
||||
system( "$CONFIG{'xm'} create $cfg >/dev/null 2>/dev/null" );
|
||||
|
||||
$xt->log( "Started new Xen guest: $CONFIG{'hostname'} [$cfg]\n" );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1172,6 +1180,8 @@ sub setupDefaultOptions
|
||||
$CONFIG{'roledir'} = '/etc/xen-tools/role.d';
|
||||
$CONFIG{'partitionsdir'} = '/etc/xen-tools/partitions.d';
|
||||
$CONFIG{'ipfile'} = '/etc/xen-tools/ips.txt';
|
||||
$CONFIG{'output'} = '/etc/xen';
|
||||
$CONFIG{'extension'} = '.cfg';
|
||||
|
||||
#
|
||||
# Installation method defaults to "debootstrap".
|
||||
@ -1376,6 +1386,8 @@ sub parseCommandLineArguments
|
||||
"force", \$CONFIG{'force'},
|
||||
"keep", \$CONFIG{'keep'},
|
||||
"template=s", \$CONFIG{'template'},
|
||||
"output=s", \$CONFIG{'output'},
|
||||
"extension=s", \$CONFIG{'extension'},
|
||||
|
||||
# Help options
|
||||
"debug", \$CONFIG{'debug'},
|
||||
@ -1391,7 +1403,7 @@ sub parseCommandLineArguments
|
||||
|
||||
if ( $VERSION )
|
||||
{
|
||||
my $REVISION = '$Revision: 1.187 $';
|
||||
my $REVISION = '$Revision: 1.188 $';
|
||||
if ( $REVISION =~ /1.([0-9.]+) / )
|
||||
{
|
||||
$REVISION = $1;
|
||||
@ -1748,6 +1760,24 @@ EOF
|
||||
{
|
||||
$CONFIG{'mac'} = generateMACAddress();
|
||||
}
|
||||
|
||||
#
|
||||
# Make sure our output directory exists.
|
||||
#
|
||||
if ( ! -d $CONFIG{'output'} )
|
||||
{
|
||||
print <<EOF;
|
||||
The output directory for creating the xen configuration file within
|
||||
doesn't exist:
|
||||
|
||||
$CONFIG{'dir'}
|
||||
|
||||
Aborting.
|
||||
|
||||
EOF
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -3268,7 +3298,10 @@ sub runXenConfigCreation
|
||||
#
|
||||
# Configuration file we'll create
|
||||
#
|
||||
my $file = '/etc/xen/' . $ENV{'hostname'} . '.cfg';
|
||||
my $dir = $CONFIG{'output'};
|
||||
my $ext = $CONFIG{'extension'};
|
||||
my $file = $dir . "/" . $CONFIG{'hostname'} . $ext;
|
||||
|
||||
|
||||
#
|
||||
# Abort if it exists.
|
||||
@ -3285,8 +3318,10 @@ sub runXenConfigCreation
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $command = 'xt-create-xen-config --output=/etc/xen';
|
||||
#
|
||||
# Create teh config.
|
||||
#
|
||||
my $command = "xt-create-xen-config --output=$dir --extension=$ext";
|
||||
|
||||
#
|
||||
# Add the template if specified
|
||||
|
||||
@ -10,23 +10,31 @@ xt-create-config - Create a Xen configuration file for a new guest
|
||||
|
||||
xt-create-config [options]
|
||||
|
||||
Filename Options:
|
||||
|
||||
--ouput Specify the output directory to use.
|
||||
--extension Specify the file extension to use.
|
||||
|
||||
|
||||
General Options:
|
||||
|
||||
--admins Specify some administrator accounts which should be
|
||||
created for use by the xen-shell.
|
||||
|
||||
--template Specify the template file to use when creating the
|
||||
Xen configuration file.
|
||||
|
||||
|
||||
Help Options:
|
||||
|
||||
--help Show this scripts help information.
|
||||
--manual Read this scripts manual.
|
||||
--version Show the version number and exit.
|
||||
|
||||
Debugging Options:
|
||||
|
||||
--verbose Be verbose in our execution.
|
||||
|
||||
Mandatory Options:
|
||||
--output The directory to save our configuration file to.
|
||||
|
||||
All other options from xen-create-image, such as the new IP address(es)
|
||||
to give to the new instance, will be passed as environmental variables.
|
||||
@ -103,7 +111,7 @@ xt-create-config - Create a Xen configuration file for a new guest
|
||||
--
|
||||
http://www.steve.org.uk/
|
||||
|
||||
$Id: xt-create-xen-config,v 1.45 2007-09-04 21:27:42 steve Exp $
|
||||
$Id: xt-create-xen-config,v 1.46 2007-10-25 12:05:21 steve Exp $
|
||||
|
||||
=cut
|
||||
|
||||
@ -217,6 +225,7 @@ sub parseCommandLineArguments
|
||||
GetOptions(
|
||||
"admins=s", \$ENV{'admins'},
|
||||
"output=s", \$CONFIG{'output'},
|
||||
"extension=s",\$CONFIG{'extension'},
|
||||
"template=s", \$CONFIG{'template'},
|
||||
"verbose", \$CONFIG{'verbose'},
|
||||
"help", \$HELP,
|
||||
@ -230,7 +239,7 @@ sub parseCommandLineArguments
|
||||
|
||||
if ( $VERSION )
|
||||
{
|
||||
my $REVISION = '$Revision: 1.45 $';
|
||||
my $REVISION = '$Revision: 1.46 $';
|
||||
if ( $REVISION =~ /1.([0-9.]+) / )
|
||||
{
|
||||
$REVISION = $1;
|
||||
@ -272,7 +281,6 @@ sub checkArguments
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Make sure that any specified template file exists.
|
||||
#
|
||||
@ -338,7 +346,7 @@ sub createXenConfig
|
||||
#
|
||||
# The output file we're going to process.
|
||||
#
|
||||
my $file = $CONFIG{'output'} . '/' . $ENV{'hostname'} . '.cfg';
|
||||
my $file = $CONFIG{'output'} . '/' . $ENV{'hostname'} . $ENV{'extension'};
|
||||
|
||||
#
|
||||
# The template we're going to read from.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user