Merge branch 'master' into code-deduplication
Conflicts: bin/xen-create-image bin/xen-create-nfs bin/xt-create-xen-config
This commit is contained in:
@@ -169,6 +169,11 @@ Bugs to fix and features to add for 5.0
|
||||
* Support `cpu_weight` and other features from
|
||||
http://wiki.xensource.com/xenwiki/CreditScheduler
|
||||
|
||||
* Make used Xen toolstack configurable, i.e. via --xen-toolstack=xl
|
||||
|
||||
* Support Xen xl toolstack elsewhere than xen-create-image. Needs code
|
||||
deduplication as mentioned below.
|
||||
|
||||
* Code Deduplication / Refactor the code for less code duplication
|
||||
|
||||
`bin/x*` currently contain the same or similar code like e.g. in the
|
||||
|
||||
@@ -17,6 +17,8 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
|
||||
|
||||
--verbose Show useful debugging information.
|
||||
|
||||
--dumpconfig Show current configuration.
|
||||
|
||||
--version Show the version number and exit.
|
||||
|
||||
|
||||
@@ -310,7 +312,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 Xen configuration file in so that xm can start the new domain.
|
||||
Create a Xen configuration file in so that xm/xl can start the new domain.
|
||||
|
||||
=back
|
||||
|
||||
@@ -784,10 +786,10 @@ use File::Temp qw/ tempdir /;
|
||||
use File::Copy qw/ mv cp /;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
use Data::Dumper;
|
||||
use Xen::Tools::Common;
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Configuration values read initially from the global configuration
|
||||
# file, then optionally overridden by the command line.
|
||||
@@ -1283,7 +1285,7 @@ sub setupDefaultOptions
|
||||
# Paths and files.
|
||||
#
|
||||
$CONFIG{ 'dir' } = '';
|
||||
$CONFIG{ 'xm' } = findBinary("xm");
|
||||
$CONFIG{ 'xm' } = findXenToolstack();
|
||||
$CONFIG{ 'kernel' } = '';
|
||||
$CONFIG{ 'modules' } = '';
|
||||
$CONFIG{ 'initrd' } = '';
|
||||
@@ -1392,6 +1394,40 @@ sub setupDefaultOptions
|
||||
|
||||
|
||||
|
||||
=begin doc
|
||||
|
||||
Find the right Xen toolstack. On Debian and derivatives there's a
|
||||
script which tells you about the current toolstack.
|
||||
|
||||
=end doc
|
||||
|
||||
=cut
|
||||
|
||||
sub findXenToolstack
|
||||
{
|
||||
my $helper = '/usr/lib/xen-common/bin/xen-toolstack';
|
||||
|
||||
if (-x $helper) {
|
||||
my $toolstack = `$helper`;
|
||||
chomp($toolstack);
|
||||
return $toolstack if $toolstack;
|
||||
}
|
||||
|
||||
my $xm = findBinary('xm');
|
||||
if ($xm and system("$xm list >/dev/null 2>/dev/null") == 0) {
|
||||
return $xm;
|
||||
}
|
||||
|
||||
my $xl = findBinary('xl');
|
||||
if ($xl and system("$xl list >/dev/null 2>/dev/null") == 0) {
|
||||
return $xl;
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
|
||||
=begin doc
|
||||
|
||||
Validate options and do what is necessary with them.
|
||||
@@ -1548,9 +1584,10 @@ sub checkOption
|
||||
|
||||
=cut
|
||||
|
||||
my $HELP = 0;
|
||||
my $MANUAL = 0;
|
||||
my $VERSION = 0;
|
||||
my $HELP = 0;
|
||||
my $MANUAL = 0;
|
||||
my $DUMPCONFIG = 0;
|
||||
my $VERSION = 0;
|
||||
|
||||
sub parseCommandLineArguments
|
||||
{
|
||||
@@ -1658,11 +1695,12 @@ sub parseCommandLineArguments
|
||||
"dontformat", \&checkOption,
|
||||
|
||||
# Help options
|
||||
"debug", \$CONFIG{ 'debug' },
|
||||
"help", \$HELP,
|
||||
"manual", \$MANUAL,
|
||||
"verbose", \$CONFIG{ 'verbose' },
|
||||
"version", \$VERSION
|
||||
"debug", \$CONFIG{ 'debug' },
|
||||
"help", \$HELP,
|
||||
"manual", \$MANUAL,
|
||||
"dumpconfig", \$DUMPCONFIG,
|
||||
"verbose", \$CONFIG{ 'verbose' },
|
||||
"version", \$VERSION
|
||||
) )
|
||||
{
|
||||
$FAIL = 2;
|
||||
@@ -1723,6 +1761,12 @@ sub parseCommandLineArguments
|
||||
$CONFIG{ 'swap-dev' } = $install{ 'swap-dev' }
|
||||
if ( defined( $install{ 'swap-dev' } ) );
|
||||
}
|
||||
|
||||
if ($DUMPCONFIG)
|
||||
{
|
||||
print Dumper \%CONFIG;
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3894,7 +3938,7 @@ sub setupRootPassword
|
||||
{
|
||||
if ( -x $MOUNT_POINT . "/usr/bin/passwd" )
|
||||
{
|
||||
system("chroot $MOUNT_POINT /usr/bin/passwd");
|
||||
runCommand("chroot $MOUNT_POINT /usr/bin/passwd", \%CONFIG);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4098,7 +4142,7 @@ sub unMountImage
|
||||
|
||||
sub END
|
||||
{
|
||||
exit 0 if $VERSION || $HELP || $MANUAL;
|
||||
exit 0 if $VERSION || $HELP || $MANUAL || $DUMPCONFIG;
|
||||
|
||||
my $host_rsa_key = '';
|
||||
#
|
||||
@@ -4166,8 +4210,8 @@ sub END
|
||||
$CONFIG{ 'output' } . "/" . $CONFIG{ 'hostname' } .
|
||||
$CONFIG{ 'extension' };
|
||||
|
||||
# Child.
|
||||
system("$CONFIG{'xm'} create $cfg >/dev/null 2>/dev/null");
|
||||
# Start the DomU
|
||||
runCommand("$CONFIG{'xm'} create $cfg");
|
||||
|
||||
logprint("Started new Xen guest: $CONFIG{'hostname'} [$cfg]\n");
|
||||
}
|
||||
@@ -4206,18 +4250,17 @@ sub END
|
||||
logprint("Removing failed install: $CONFIG{'hostname'}\n");
|
||||
|
||||
if ($CONFIG{ 'hostname' }) {
|
||||
my $options = '';
|
||||
my $option = '';
|
||||
if ($CONFIG{ 'lvm' }) {
|
||||
$options = "--lvm=$CONFIG{'lvm'}"
|
||||
$option = "--lvm=$CONFIG{'lvm'}"
|
||||
} elsif ($CONFIG{ 'evms' }) {
|
||||
$options = "--evms=$CONFIG{'evms'}"
|
||||
$option = "--evms=$CONFIG{'evms'}"
|
||||
} elsif ($CONFIG{ 'dir' }) {
|
||||
$options = "--dir=$CONFIG{'dir'}"
|
||||
$option = "--dir=$CONFIG{'dir'}"
|
||||
}
|
||||
|
||||
if ($options) {
|
||||
system('xen-delete-image', $options,
|
||||
"--hostname=$CONFIG{'hostname'}");
|
||||
if ($option) {
|
||||
runCommand("xen-delete-image $option --hostname=$CONFIG{'hostname'}");
|
||||
} else {
|
||||
die "Assertion that either --dir, --lvm, or --dir are given".
|
||||
" failed.\nThis is probably a bug, please report it.";
|
||||
|
||||
2
debian/changelog
vendored
2
debian/changelog
vendored
@@ -11,6 +11,8 @@ xen-tools (4.3.1+dev-1) UNRELEASED; urgency=low
|
||||
- Default DomUs to use the noop scheduler (Closes: #693131)
|
||||
- Remove CVS revisions from --version output
|
||||
- Preliminary support for Debian Jessie and Ubuntu Raring
|
||||
- Preliminary support for xl toolstack (xen-create-image only so far)
|
||||
- xen-create-image: Consistently use runCommand() instead of system()
|
||||
* Add debian/gbp.conf to be able to to build xen-tools with
|
||||
git-buildpackage.
|
||||
* Install (manually generated) upstream ChangeLog only if it
|
||||
|
||||
@@ -274,7 +274,7 @@ sub setupAdminUsers ($)
|
||||
open( SUDOERS, ">>", "/etc/sudoers" ) or
|
||||
warn "Failed to add user to sudoers file : $user - $!";
|
||||
print SUDOERS
|
||||
"$user ALL = NOPASSWD: /usr/sbin/xm, /usr/bin/xen-create-image\n";
|
||||
"$user ALL = NOPASSWD: /usr/sbin/xm, /usr/sbin/xl, /usr/bin/xen-create-image\n";
|
||||
close(SUDOERS);
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test::More 'no_plan', skip_all => '/etc/inittab not present';
|
||||
use Test::More;
|
||||
use File::Temp;
|
||||
use File::Copy;
|
||||
|
||||
@@ -41,6 +41,7 @@ SKIP: {
|
||||
} # SKIP
|
||||
|
||||
|
||||
done_testing();
|
||||
|
||||
sub testHook
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user