diff --git a/AUTHORS b/AUTHORS index 8db37c1..dc88adf 100644 --- a/AUTHORS +++ b/AUTHORS @@ -24,6 +24,16 @@ Contributions Justin Azoff - Added LVM support to xen-create-image. + Pieter Barrezeele + - Several small but useful enhancements + - Bugfixes + + Brian Bennett + - Made multiple times given --ip options work + + Vagrant Cascadian + - Less redundant SSH key generation + Edd Dumbill - Contributed APT sources.list file for Ubuntu's Dapper release. @@ -42,6 +52,9 @@ Contributions Joey Hess - Provided sample code for module copying and several useful bug reports + John Hughes + - Physical devices reordering for pygrub + Kirk Ismay - Added hook for automatic CFEngine installation. @@ -93,6 +106,11 @@ Contributions Gergely Tamas - Added patch to make initrd setup optional. + Alex Tomlins + - apt_proxy support + Ward Vandewege - Made several updates for Ubuntu support. + xstasi on Launchpad + - Proper upstart handling in the chroot diff --git a/KNOWN_BUGS b/KNOWN_BUGS index d723c1a..0ba69ba 100644 --- a/KNOWN_BUGS +++ b/KNOWN_BUGS @@ -29,6 +29,18 @@ Bugs to fix before a 4.3 release * xen-create-image doesn't unmount the tempdir properly if /proc wasn't mounted inside +* xen-create-image says on startup summary that the Debian mirror is + used even if Ubuntu is going to be installed (and works) + * xen-list-images does not honour --extension * --extension='' (i.e. empty string) no more works + + +Bugs to fix later +----------------- + +t/xen-tools.t can't really test Xen::Tools as the latter requires a +local Xen installation. For proper testing, a dummy set of Xen +configuration files and configurable paths to them in Xen::Tools would +be necessary. diff --git a/LICENSE b/LICENSE index 6bdbe41..4909e79 100644 --- a/LICENSE +++ b/LICENSE @@ -2,7 +2,12 @@ xen-tools --------- -Copyright (c) 2005-2007 by Steve Kemp. All rights reserved. +Copyright (c) 2005-2009: Steve Kemp. All rights reserved. +Copyright (c) 2010-2012: The Xen-Tools Development Team, currently consisting of: + Axel Beckert , + Dmitry Nedospasov , and + Stéphane Jourdois + This project is free software. You may redistribute it under the terms of *either* the Perl Artistic License, or the GNU General diff --git a/Makefile b/Makefile index a8abc20..0feebd8 100644 --- a/Makefile +++ b/Makefile @@ -189,6 +189,8 @@ install-hooks: -cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d maverick.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d natty.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d oneiric.d + -cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d precise.d + -cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d quantal.d cp hooks/common.sh ${prefix}/usr/lib/xen-tools diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..9468487 --- /dev/null +++ b/NEWS @@ -0,0 +1,48 @@ +xen-tools 4.3 (released [TODO]) +================================ + +New Options +----------- + + --dontformat (xen-create-image) + --finalrole (xen-create-image) + --apt_proxy (xen-create-image) + +Newly Supported Distribution Releases +------------------------------------- + +* Ubuntu 11.10 Oneiric +* Ubuntu 12.04 Precise +* Ubuntu 12.10 Quantal DomUs + + +xen-tools 4.2.1 (released 17 Mar 2011) +====================================== + +Bugfix Release only + + +xen-tools 4.2 (released 05 Oct 2010) +==================================== + +First final release of the new Xen-Tools Team. + +Supports Ubuntu up to 11.04 (Natty) and Debian up to 7.0 (Wheezy). + + +New Options +----------- + + --debootstrap-cmd (xen-create-image and xt-install-image) + +New Features and Major Changes +------------------------------ + +* Uses hvc0 and xvda devices by default +* Also supports cdebootstrap +* Preliminary btrfs support. +* Uses GeoIP for Debian mirrors: Default Debian mirror is now + cdn.debian.net, see http://wiki.debian.org/DebianGeoMirror for + details. +* New helper program xt-guess-suite-and-mirror, used to find the + default mirror and suite. diff --git a/README b/README index 39d83c3..ae1318e 100644 --- a/README +++ b/README @@ -30,7 +30,7 @@ About: * Etch 4.0 (Dom0 no more tested) * Lenny 5.0 * Squeeze 6.0 - * Wheezy 7.0 (preliminary support as it's not yet available) + * Wheezy 7.0 * Sid (works at least at the moment of writing :-) Ubuntu (only DomUs tested): @@ -43,8 +43,11 @@ About: * Jaunty Jackaplope 9.04 * Karmic Koala 9.10 * Lucid Lynx 10.04 - * Maverick Meerkat 10.10 (works at least at the moment of writing :-) - * Natty Narwhal 11.04 (preliminary support as it's not yet available) + * Maverick Meerkat 10.10 + * Natty Narwhal 11.04 + * Oneiric Ocelot 11.10 + * Precise Pangolin 12.04 + * Quantal Quetzal 12.10 (preliminary support as it's not yet available) [1] There is an issue with debootstrap on hardy not installing ksyslogd This can be fixed by chrooting into the newly installed system diff --git a/bin/xen-create-image b/bin/xen-create-image index 0309c19..5d7fc8c 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -146,6 +146,10 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH. Pass the named string literally to any role script. This is useful for site-specific roles. + --finalrole=role + Similar to role scripts. Run the specified role script(s) + after cfg file creation. + --roledir=/path/to/directory Specify the directory which contains the role scripts. This defaults to /etc/xen-tools/role.d/ @@ -165,6 +169,11 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH. --tar-cmd NOP: Ignored. + --dontformat Do not format the devices specified for installation. + Useful if you want tighter control over the filesystem + creation. Requires the filesystems to be created + beforehand. + --vcpus=num Set the number of vcpus that the new instance will have instead of the default value of "1". @@ -204,6 +213,10 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH. to choose a more or less close Debian mirror. See http://wiki.debian.org/DebianGeoMirror for details. + --apt_proxy=url + Specify a proxy to be used by debootstrap, and within + the guest. + --template=tmpl Specify which template file to use when creating the Xen configuration file. @@ -708,6 +721,9 @@ Install an X11 server, using VNC and XDM installed system as their first argument, and anything passed as a role-arg will be passed allong as additional arguments. + NOTE: Role scripts are invoked before the config file generation. + If you need access to the config file from within your role, + use --finalrole. NOTE: Multiple role scripts may be invoked if you separate their names with commas. @@ -745,7 +761,7 @@ Install an X11 server, using VNC and XDM =head1 LICENSE -Copyright (c) 2005-2009 by Steve Kemp, (c) 2010 by The Xen-Tools +Copyright (c) 2005-2009 by Steve Kemp, (c) 2010-2012 by The Xen-Tools Development Team. All rights reserved. This module is free software; @@ -1054,6 +1070,12 @@ runRoleScripts( $CONFIG{ 'role' } ); runXenConfigCreation(); +# +# Run any specified role scripts. +# +runRoleScripts( $CONFIG{ 'finalrole' } ); + + # # Setup the password if the user wanted that. # @@ -1252,7 +1274,7 @@ sub testXenConfig # Read the configuration file. # open( CONFIG, "<", "/etc/xen/xend-config.sxp" ) or - die "Failed to read /etc/xen/xend-config.sxp: $!"; + fail("Failed to read /etc/xen/xend-config.sxp: $!"); while () { next if ( !$_ || !length($_) ); @@ -1352,19 +1374,20 @@ sub setupDefaultOptions $CONFIG{ 'mirror' } = ''; # Initialize per distribution mirror defaults: Debian - foreach my $debdist (qw(lenny squeeze wheezy sid testing stable unstable)) { + foreach my $debdist (qw(squeeze wheezy sid testing oldstable stable unstable)) { $CONFIG{ 'mirror_'.$debdist } = $CONFIG{ 'mirror' } } - foreach my $debdist (qw(sarge etch)) { + foreach my $debdist (qw(sarge etch lenny)) { $CONFIG{ 'mirror_'.$debdist } = 'http://archive.debian.org/debian'; } # Initialize per distribution mirror defaults: Ubuntu - foreach my $ubuntudist (qw(dapper hardy jaunty karmic lucid maverick natty oneiric)) { + foreach my $ubuntudist (qw(dapper hardy lucid natty oneiric precise quantal)) { $CONFIG{ 'mirror_'.$ubuntudist } = 'http://archive.ubuntu.com/ubuntu'; } - foreach my $ubuntudist (qw(edgy feisty gutsy intrepid)) { + foreach my $ubuntudist (qw(edgy feisty gutsy intrepid jaunty karmic maverick)) { $CONFIG{ 'mirror_'.$ubuntudist } = 'http://old-releases.ubuntu.com/ubuntu'; } + $CONFIG{ 'apt_proxy' } = ''; $CONFIG{ 'arch' } = ''; $CONFIG{ 'fs' } = 'ext3'; $CONFIG{ 'force' } = 0; @@ -1560,7 +1583,7 @@ sub checkOption my $type = $optionsTypes{ $option }; # First, check if type exists - die unless exists $types{ $type }; + fail("Type $type does not exist") unless exists $types{ $type }; my $check = $types{ $type }{ 'check' }; if ( @@ -1568,10 +1591,15 @@ sub checkOption (ref $check eq 'CODE' and &$check( $value ) ) ) { # Option did validate, copy it - $CONFIG{ $option } = $value; + if ( $option eq "ip" ) + { + push @{ $CONFIG{ $option } }, $value; + } else { + $CONFIG{ $option } = $value; + } } else { # Option did _not_ validate - die "ERROR: '$option' argument " . $types{ $type }{ 'message' }; + fail("ERROR: '$option' argument " . $types{ $type }{ 'message' }); } } } @@ -1625,6 +1653,7 @@ sub parseCommandLineArguments "kernel=s", \&checkOption, "initrd=s", \&checkOption, "mirror=s", \&checkOption, + "apt_proxy=s", \&checkOption, "modules=s", \&checkOption, "lvm=s", \$install{ 'lvm' }, "image-dev=s", \$install{ 'image-dev' }, @@ -1683,12 +1712,14 @@ sub parseCommandLineArguments "partitions=s", \&checkOption, "role=s", \&checkOption, "role-args=s", \&checkOption, + "finalrole=s", \&checkOption, "roledir=s", \&checkOption, "force", \$CONFIG{ 'force' }, "keep", \$CONFIG{ 'keep' }, "template=s", \&checkOption, "output=s", \&checkOption, "extension=s", \&checkOption, + "dontformat", \&checkOption, # Help options "debug", \$CONFIG{ 'debug' }, @@ -1833,7 +1864,7 @@ sub checkArguments # # Lucid and probably all later Ubuntus, too, don't work without pygrub # - if ( $CONFIG{ 'dist' } =~ /lucid|maverick|natty|oneiric/ ) + if ( $CONFIG{ 'dist' } =~ /lucid|maverick|natty|oneiric|precise|quantal/ ) { $CONFIG{ 'pygrub' } = 1; } @@ -2329,7 +2360,7 @@ sub checkBinariesPresent } } } - else + elsif (defined( $CONFIG{ 'lvm' } ) ) { # LVM-specific binaries. @@ -2855,7 +2886,7 @@ sub createLoopbackImages eval {mkpath( $output, 0, 0755 );}; if ($@) { - die "Cannot create directory tree $output - $@"; + fail("Cannot create directory tree $output - $@"); } } @@ -3304,37 +3335,28 @@ sub createFilesystem # Split the command into "binary" + "args". Make sure that # the binary exists and is executable. # - if ( $command =~ /([^ ]+) (.*)$/ ) - { - my $binary = $1; - my $args = $2; + my ($binary, $args) = split(/ /, $command, 2); - if ( !defined( findBinary($binary) ) ) - { - logprint( - "The binary '$binary' required to create the filesystem $fs is missing\n" - ); - $FAIL = 1; - exit 127; - } - } - else + if ( !defined( findBinary($binary) ) ) { logprint( - "The filesystem creation hash is bogus for filesystem : $fs\n"); + "The binary '$binary' required to create the filesystem $fs is missing\n" + ); $FAIL = 1; exit 127; } - # - # OK we have the command and the filesystem. Create it. - # - logprint("\nCreating $fs filesystem on $image\n"); + unless ( $CONFIG{ 'dontformat' } ) { + # + # OK we have the command and the filesystem. Create it. + # + logprint("\nCreating $fs filesystem on $image\n"); - $command .= " " . $image; + $command .= " " . $image; - runCommand($command, \%CONFIG); - logprint("Done\n"); + runCommand($command, \%CONFIG); + logprint("Done\n"); + } } @@ -3491,6 +3513,15 @@ sub installSystem } + # + # Propagate --apt_proxy + # + if ( $CONFIG{ 'apt_proxy' } ) + { + $cmd .= " --apt_proxy=$CONFIG{'apt_proxy'}"; + } + + # # Show the user what they are installing # @@ -3674,7 +3705,7 @@ sub findIP # Open and read the file. # open( RANGE, "<", $CONFIG{ 'ipfile' } ) or - die "Failed to read $CONFIG{'ipfile'} - $!"; + fail("Failed to read $CONFIG{'ipfile'} - $!"); my @lines = ; my @updated; close(RANGE); @@ -3705,7 +3736,7 @@ sub findIP # Now write out the new entries. # open( RANGE, ">", $CONFIG{ 'ipfile' } ) or - die "Failed to write to $CONFIG{'ipfile'} - $!"; + fail("Failed to write to $CONFIG{'ipfile'} - $!"); print RANGE join( "\n", @updated ); close(RANGE); @@ -3904,6 +3935,12 @@ sub runXenConfigCreation $command .= " --admins=$CONFIG{'admins'}"; } + # + # Make sure the template gets a list of all IPs + # + $ENV{ 'ips' } = $IP_ADDRESSES; + + logprint("\nCreating Xen configuration file\n"); runCommand($command, \%CONFIG); logprint("Done\n"); @@ -3972,7 +4009,7 @@ sub setupRootPassword } else { - die "oops... unknown hashing method, should not happen!"; + fail("oops... unknown hashing method, should not happen!"); } my $hash = crypt($PASSWORD, $hash_method . $salt); @@ -3983,8 +4020,8 @@ sub setupRootPassword # my $tmp_shadow_path = "$shadow_path.tmp"; cp("$shadow_path","$tmp_shadow_path"); - open(TMP, "<", $tmp_shadow_path) or die $!; - open(SHADOW, ">", $shadow_path) or die $!; + open(TMP, "<", $tmp_shadow_path) or fail($!); + open(SHADOW, ">", $shadow_path) or fail($!); my $line; while(defined($line = )) { @@ -4025,6 +4062,23 @@ sub generatePassword { } +=begin doc + + Properly set $FAIL on die + +=end doc + +=cut + +sub fail +{ + logprint(@_); + $FAIL = 1; + exit 127; +} + + + =begin doc Print the given string to the logfile. diff --git a/bin/xen-create-nfs b/bin/xen-create-nfs index b4e27ee..43ee0a1 100755 --- a/bin/xen-create-nfs +++ b/bin/xen-create-nfs @@ -303,23 +303,23 @@ sub testArguments # this code is borrowed for now... if ( exists($CONFIG{ 'memory' }) and - defined($CONFIG{ 'memory' }) ) { + defined($CONFIG{ 'memory' }) ) { - # - # The memory size: Convert Gb -> Mb. - # - if ( $CONFIG{ 'memory' } =~ /^(\d+)Gb.*$/i ) - { - $CONFIG{ 'memory' } = $1 * 1024; - } + # + # The memory size: Convert Gb -> Mb. + # + if ( $CONFIG{ 'memory' } =~ /^(\d+)Gb.*$/i ) + { + $CONFIG{ 'memory' } = $1 * 1024; + } - # - # Remove any trailing Mb. - # - if ( $CONFIG{ 'memory' } =~ /^(\d+)Mb.*$/i ) - { - $CONFIG{ 'memory' } = $1; - } + # + # Remove any trailing Mb. + # + if ( $CONFIG{ 'memory' } =~ /^(\d+)Mb.*$/i ) + { + $CONFIG{ 'memory' } = $1; + } } # All OK. diff --git a/bin/xt-create-xen-config b/bin/xt-create-xen-config index 15173a1..fae8abe 100755 --- a/bin/xt-create-xen-config +++ b/bin/xt-create-xen-config @@ -114,7 +114,7 @@ xt-create-config - Create a Xen configuration file for a new guest =head1 LICENSE -Copyright (c) 2005-2009 by Steve Kemp, (c) 2010 by The Xen-Tools +Copyright (c) 2005-2009 by Steve Kemp, (c) 2010-2012 by The Xen-Tools Development Team. All rights reserved. This module is free software; diff --git a/bin/xt-guess-suite-and-mirror b/bin/xt-guess-suite-and-mirror index 4e437e1..bf8fa5c 100755 --- a/bin/xt-guess-suite-and-mirror +++ b/bin/xt-guess-suite-and-mirror @@ -39,7 +39,7 @@ xen-create-image(1) or the backticks feature in xen-tools.conf. =head1 LICENSE -Copyright (C) 2010 by The Xen-Tools Development Team. All rights +Copyright (C) 2010-2012 by The Xen-Tools Development Team. All rights reserved. This module is free software; you can redistribute it and/or modify it @@ -68,7 +68,8 @@ my %fallback_suite = ( Debian => 'stable', Ubuntu => 'lucid' ); # Where to look for the sources.list to parse -my $sources_list_file = '/etc/apt/sources.list'; +my @sources_list_files = ( '/etc/apt/sources.list', + glob('/etc/apt/sources.list.d/*.list')); use File::Slurp; use Getopt::Long; @@ -108,47 +109,49 @@ if ($want_manual) { pod2usage( -verbose => 2 ); } -if (-r $sources_list_file) { - # sources.list exists, so it's something debianoid. +all_sources_list_files: foreach my $sources_list_file (@sources_list_files) { + if (-r $sources_list_file) { + # sources.list file exists, so it's something debianoid. - # read sources.list and split it into lines - my @sources_list = read_file($sources_list_file); + # read sources.list and split it into lines + my @sources_list = read_file($sources_list_file); - # Find the first line which is a Debian or Ubuntu mirror but not - # an updates, backports, volatile or security mirror. - foreach my $sources_list_entry (@sources_list) { - # Normalize line - chomp($sources_list_entry); - $sources_list_entry =~ s/^\s*(.*?)\s*$/$1/; + # Find the first line which is a Debian or Ubuntu mirror but not + # an updates, backports, volatile or security mirror. + foreach my $sources_list_entry (@sources_list) { + # Normalize line + chomp($sources_list_entry); + $sources_list_entry =~ s/^\s*(.*?)\s*$/$1/; - # Skip definite non-entries - next if $sources_list_entry =~ /^\s*($|#)/; + # Skip definite non-entries + next if $sources_list_entry =~ /^\s*($|#)/; - # Split up into fields - my @source_components = split(/\s+/, $sources_list_entry); + # Split up into fields + my @source_components = split(/\s+/, $sources_list_entry); - # Minimum number of components is 4 - next if $#source_components < 3; + # Minimum number of components is 4 + next if $#source_components < 3; - # Don't use deb-src entries. - next if $source_components[0] eq 'deb-src'; + # Don't use deb-src entries. + next if $source_components[0] eq 'deb-src'; - # Skip updates, backports, volatile or security mirror. - next if $source_components[2] !~ /^[a-z]+$/; + # Skip updates, backports, volatile or security mirror. + next if $source_components[2] !~ /^[a-z]+$/; - if ($source_components[1] =~ m(/debian/?$|/ubuntu/?$)) { - # Seems a typical mirror. Let's use that one + if ($source_components[1] =~ m(/debian/?$|/ubuntu/?$)) { + # Seems a typical mirror. Let's use that one - $mirror = $source_components[1]; - $suite = $source_components[2]; + $mirror = $source_components[1]; + $suite = $source_components[2]; - $found = 1; - last; + $found = 1; + last all_sources_list_files; + } } } - - warn "Couldn't parse $sources_list_file of the Dom0.\n" unless $found; } +die "Couldn't find a useful entry in the sources.list files of the Dom0. Tried:\n ". + join("\n ", @sources_list_files)."\n" unless $found; my $lsb_release = `which lsb_release`; chomp($lsb_release); diff --git a/bin/xt-install-image b/bin/xt-install-image index 0d19b9b..a15adc1 100755 --- a/bin/xt-install-image +++ b/bin/xt-install-image @@ -27,6 +27,7 @@ xt-install-image - Install a fresh copy of GNU/Linux into a directory --config Read the specified config file in addition to the global configuration file. --mirror The mirror to use when installing with 'debootstrap'. + --apt_proxy The proxy to use when installing with 'debootstrap'. Installation Options: --install-method Specify the installation method to use. @@ -315,6 +316,7 @@ sub parseCommandLineArguments "cachedir=s", \$CONFIG{ 'cachedir' }, "config=s", \$CONFIG{ 'config' }, "mirror=s", \$CONFIG{ 'mirror' }, + "apt_proxy=s", \$CONFIG{ 'apt_proxy' }, # Help. "verbose", \$CONFIG{ 'verbose' }, @@ -630,6 +632,14 @@ sub do_debootstrap $EXTRA .= " --arch $CONFIG{'arch'}"; } + # + # Setup http_proxy so that debootstrap pulls files through the apt-proxy + # + if ( $CONFIG{ 'apt_proxy' } ) + { + print("Using apt_proxy: $CONFIG{'apt_proxy'}\n"); + $ENV{'http_proxy'} = $CONFIG{'apt_proxy'}; + } # # This is the command we'll run diff --git a/debian/changelog b/debian/changelog index c733492..14aff86 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,17 +1,43 @@ -xen-tools (4.2.1+dev-1) UNRELEASED; urgency=low +xen-tools (4.3~dev-1) UNRELEASED; urgency=low * New upstream snapshot - Correctly checks and documents valid values for disk_device. (Closes: #621499) - * Support creating Ubuntu 11.10 Oneiric DomUs (LP: #848654) + - Supports creating Ubuntu 11.10 Oneiric DomUs (LP: #848654) + - Supports creating Ubuntu 12.04 Precise and 12.10 Quantal DomUs + - Updated mirror list for discontinued releases of Debian and Ubuntu + - Workaround for missing unit parsing in xen-create-nfs (Closes: + #648814) + - Fix wildcard vs regexp in memory configuration parsing. + - Fix misbehaviour if --ip option is passed multiple times (Closes: + #652110; Thanks Brian Bennett and Alexander Mette!) + - Supports /etc/apt/sources.list.d/ (Closes: #650300) + - xt-guess-suite-and-mirror exits with non-zero if no proper mirror + could be extracted from /etc/apt/sources.list or + /etc/apt/sources.list.d/*.list (Thanks Phil Frost!) + - Only attempts to generate the ssh host keys if not already present + (Closes: #607236; Thanks Vagrant Cascadian!) + - New option --apt_proxy (Closes: #610457; Thanks Alex Tomlins!) + - Always write down root partition as first physical device, otherwise + pygrub fails (Closes: #609673) + - No more expect at least one option to mkfs.* calls. Fixes btrfs + creation. (Closes: #609982) + - Fixes call to non-existent function logPrint (Closes: #673335) + - Also disable initctl in the chroot, not only start-stop-daemon + (LP: #997063; Thanks xstasi!) + * Add dependency on openssh-client for ssh-keygen (Closes: #649108) + * Use dh_auto_test for build time tests and add according + build-dependencies on devscripts and libfile-slurp-perl. * No more suggest evms-cli -- it's no more available on any supported Dom0 distribution. Thanks to Markus Waldeck for the hint. - * Workaround for missing unit parsing in xen-create-nfs (Closes: - #648814) - * Fix wildcard vs regexp in memory configuration parsing. - * Fix Lintian warning copyright-refers-to-symlink-license. + * Add NEWS to debian/docs. + * Bump Standards-Version to 3.9.3 (no changes) + * Fix the following Lintian warnings: + - copyright-refers-to-symlink-license + - debian-rules-missing-recommended-target + * debian/copyright: Update copyright years - -- Axel Beckert Tue, 15 Nov 2011 22:32:56 +0100 + -- Axel Beckert Wed, 30 May 2012 23:57:31 +0200 xen-tools (4.2.1-1) unstable; urgency=low diff --git a/debian/control b/debian/control index 1cbc92d..0fbabbf 100644 --- a/debian/control +++ b/debian/control @@ -2,15 +2,15 @@ Source: xen-tools Section: utils Priority: extra Maintainer: Axel Beckert -Build-Depends: debhelper (>= 7.0.0), libtest-pod-perl, libtext-template-perl -Standards-Version: 3.9.1 +Build-Depends: debhelper (>= 7.0.0), libtest-pod-perl, libtext-template-perl, libfile-slurp-perl, devscripts +Standards-Version: 3.9.3 Homepage: http://xen-tools.org/software/xen-tools Vcs-Browser: http://gitorious.org/xen-tools/xen-tools Vcs-Git: git://gitorious.org/xen-tools/xen-tools.git Package: xen-tools Architecture: all -Depends: debootstrap | cdebootstrap, perl-modules, libtext-template-perl, libconfig-inifiles-perl, libfile-slurp-perl, ${misc:Depends} +Depends: debootstrap | cdebootstrap, perl-modules, libtext-template-perl, libconfig-inifiles-perl, libfile-slurp-perl, ${misc:Depends}, openssh-client Recommends: xen-hypervisor-amd64 | xen-hypervisor-i386 | xen-hypervisor-i386-pae, rinse, xen-shell, libexpect-perl Suggests: reiserfsprogs, xfsprogs, xen-utils, cfengine2, btrfs-tools Description: Tools to manage Xen virtual servers @@ -25,6 +25,7 @@ Description: Tools to manage Xen virtual servers * Debian 4.0 Etch * Debian 5.0 Lenny * Debian 6.0 Squeeze + * Debian 7.0 Wheezy * Debian Sid (Unstable) * Ubuntu 6.06 Dapper Drake (LTS) * Ubuntu 6.10 Edgy Eft @@ -36,3 +37,6 @@ Description: Tools to manage Xen virtual servers * Ubuntu 9.10 Karmic Koala * Ubuntu 10.04 Lucid Lynx (LTS) * Ubuntu 10.10 Maverick Meerkat + * Ubuntu 11.04 Natty Narwhal + * Ubuntu 11.10 Oneiric Ocelot + * Ubuntu 12.04 Precise Pangolin (LTS) diff --git a/debian/copyright b/debian/copyright index 6efadb7..0bce5e3 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,10 +4,10 @@ Tue, 20 Dec 2005 02:21:05 +0200. It was downloaded from http://xen-tools.org/software/xen-tools/ Copyright 2005-2009: Steve Kemp -Copyright 2010: The Xen-Tools Development Team, currently consisting of: - Axel Beckert , - Dmitry Nedospasov , and - Stéphane Jourdois +Copyright 2010-2012: The Xen-Tools Development Team, currently consisting of: + Axel Beckert , + Dmitry Nedospasov , and + Stéphane Jourdois License: diff --git a/debian/docs b/debian/docs index 7944ff4..1166ded 100644 --- a/debian/docs +++ b/debian/docs @@ -4,3 +4,4 @@ SUPPORT BUGS TODO KNOWN_BUGS +NEWS diff --git a/debian/rules b/debian/rules index 328a442..addafbf 100755 --- a/debian/rules +++ b/debian/rules @@ -9,8 +9,9 @@ configure-stamp: touch configure-stamp -build: build-stamp - +build: build-arch build-indep +build-arch: build-stamp +build-indep: build-stamp build-stamp: configure-stamp dh_testdir touch build-stamp @@ -27,6 +28,7 @@ install: build dh_testroot dh_prep + dh_auto_test make manpages make install prefix=`pwd`/debian/xen-tools diff --git a/etc/xen-tools.conf b/etc/xen-tools.conf index ea72da8..b212f36 100644 --- a/etc/xen-tools.conf +++ b/etc/xen-tools.conf @@ -263,7 +263,7 @@ mirror = `xt-guess-suite-and-mirror --mirror` # # mirror_sarge = http://archive.debian.org/debian # mirror_etch = http://archive.debian.org/debian -# mirror_lenny = http://cdn.debian.net/debian +# mirror_lenny = http://archive.debian.org/debian # mirror_squeeze = http://cdn.debian.net/debian # mirror_wheezy = http://cdn.debian.net/debian # mirror_sid = http://cdn.debian.net/debian @@ -273,12 +273,19 @@ mirror = `xt-guess-suite-and-mirror --mirror` # mirror_gutsy = http://old-releases.ubuntu.com/ubuntu # mirror_hardy = http://archive.ubuntu.com/ubuntu # mirror_intrepid = http://old-releases.ubuntu.com/ubuntu -# mirror_karmic = http://archive.ubuntu.com/ubuntu +# mirror_jaunty = http://old-releases.ubuntu.com/ubuntu +# mirror_karmic = http://old-releases.ubuntu.com/ubuntu # mirror_lucid = http://archive.ubuntu.com/ubuntu # mirror_maverick = http://archive.ubuntu.com/ubuntu # mirror_natty = http://archive.ubuntu.com/ubuntu # mirror_oneiric = http://archive.ubuntu.com/ubuntu +# mirror_precise = http://archive.ubuntu.com/ubuntu +# mirror_quantal = http://archive.ubuntu.com/ubuntu +# If this is defined it will be used by debootstrap, and configured as the +# proxy for the guest +# +# apt_proxy = # # Filesystem options for the different filesystems we support. diff --git a/etc/xm.tmpl b/etc/xm.tmpl index e723486..c53970f 100644 --- a/etc/xm.tmpl +++ b/etc/xm.tmpl @@ -53,7 +53,17 @@ memory = '{$memory}' $OUT .= "disk = [\n"; for ( my $i = $#PARTITIONS; $i >= 0 ; $i-- ) { - $OUT .= " '$PARTITIONS[$i]{'imagetype'}$PARTITIONS[$i]{'image'},$device" . ( $i + 1 ) .",w',\n"; + if ( $PARTITIONS[$i]{'mountpoint'} eq '/' ) + { + $OUT .= " '$PARTITIONS[$i]{'imagetype'}$PARTITIONS[$i]{'image'},$device" . ( $i + 1 ) .",w',\n"; + } + } + for ( my $i = $#PARTITIONS; $i >= 0 ; $i-- ) + { + if ( $PARTITIONS[$i]{'mountpoint'} ne '/' ) + { + $OUT .= " '$PARTITIONS[$i]{'imagetype'}$PARTITIONS[$i]{'image'},$device" . ( $i + 1 ) .",w',\n"; + } } $OUT .= " ]\n"; } @@ -135,7 +145,7 @@ name = '{$hostname}' $br = ",bridge=$bridge" } - $OUT .= "vif = [ 'ip=$ip1"; + $OUT .= "vif = [ 'ip=$ips"; $OUT .= "$m"; $OUT .= "$vn"; $OUT .= "$br"; diff --git a/hooks/common.sh b/hooks/common.sh index 7cfde99..5d33a49 100755 --- a/hooks/common.sh +++ b/hooks/common.sh @@ -121,14 +121,16 @@ disableStartStopDaemon () { local prefix="$1" assert "$LINENO" "${prefix}" - local daemonfile="${prefix}/sbin/start-stop-daemon" + for starter in start-stop-daemon initctl; do + local daemonfile="${prefix}/sbin/${starter}" - mv "${daemonfile}" "${daemonfile}.REAL" - echo '#!/bin/sh' > "${daemonfile}" - echo "echo \"Warning: Fake start-stop-daemon called, doing nothing\"" >> "${daemonfile}" + mv "${daemonfile}" "${daemonfile}.REAL" + echo '#!/bin/sh' > "${daemonfile}" + echo "echo \"Warning: Fake ${starter} called, doing nothing\"" >> "${daemonfile}" - chmod 755 "${daemonfile}" - logMessage "start-stop-daemon disabled / made a stub." + chmod 755 "${daemonfile}" + logMessage "${starter} disabled / made a stub." + done } @@ -140,16 +142,17 @@ enableStartStopDaemon () { local prefix=$1 assert "$LINENO" "${prefix}" - local daemonfile="${prefix}/sbin/start-stop-daemon" - - # - # If the disabled file is present then enable it. - # - if [ -e "${daemonfile}.REAL" ]; then - mv "${daemonfile}.REAL" "${daemonfile}" - logMessage "start-stop-daemon restored to working order." - fi + for starter in start-stop-daemon initctl; do + local daemonfile="${prefix}/sbin/${starter}" + # + # If the disabled file is present then enable it. + # + if [ -e "${daemonfile}.REAL" ]; then + mv "${daemonfile}.REAL" "${daemonfile}" + logMessage "${starter} restored to working order." + fi + done } diff --git a/hooks/dapper/20-setup-apt b/hooks/dapper/20-setup-apt index 4fdd008..f255dfb 100755 --- a/hooks/dapper/20-setup-apt +++ b/hooks/dapper/20-setup-apt @@ -33,9 +33,12 @@ logMessage Script $0 starting # replicate that setup in our new guest via apt-config dump and save # the setting to the proxy guess file. # -logMessage The use of a proxy detected. -apt-config dump | grep -i Acquire::HTTP::Proxy \ - > ${prefix}/etc/apt/apt.conf.d/proxy-guess +if [ ${apt_proxy} ]; then + echo "Acquire::http::Proxy \"${apt_proxy}\";" > ${prefix}/etc/apt/apt.conf.d/01proxy +else + logMessage The use of a proxy detected. + apt-config dump | grep -i Acquire::HTTP::Proxy > ${prefix}/etc/apt/apt.conf.d/01proxy +fi # diff --git a/hooks/dapper/70-install-ssh b/hooks/dapper/70-install-ssh index 8dfe2c5..e6eca32 100755 --- a/hooks/dapper/70-install-ssh +++ b/hooks/dapper/70-install-ssh @@ -36,20 +36,24 @@ mkdir -p ${prefix}/etc/ssh # # Second, Generate the Host RSA Key # +if [ ! -f ${prefix}/etc/ssh/ssh_host_rsa_key ]; then if ssh-keygen -t rsa -N "" -f ${prefix}/etc/ssh/ssh_host_rsa_key -C "root@${hostname}"; then logMessage "successfully generetaged Host RSA" else logMessage "failed to generate Host RSA Key" fi +fi # # Third, Generate the Host DSA Key # +if [ ! -f ${prefix}/etc/ssh/ssh_host_dsa_key ]; then if ssh-keygen -t dsa -N "" -f ${prefix}/etc/ssh/ssh_host_dsa_key -C "root@${hostname}"; then logMessage "successfully generetaged Host DSA" else logMessage "failed to generate Host DSA Key" fi +fi # # Install ssh diff --git a/hooks/debian/20-setup-apt b/hooks/debian/20-setup-apt index 446cd67..b325602 100755 --- a/hooks/debian/20-setup-apt +++ b/hooks/debian/20-setup-apt @@ -32,9 +32,12 @@ logMessage Script $0 starting # replicate that setup in our new guest via apt-config dump and save # the setting to the proxy guess file. # -logMessage The use of a proxy detected. -apt-config dump | grep -i Acquire::HTTP::Proxy \ - > ${prefix}/etc/apt/apt.conf.d/proxy-guess +if [ ${apt_proxy} ]; then + echo "Acquire::http::Proxy \"${apt_proxy}\";" > ${prefix}/etc/apt/apt.conf.d/01proxy +else + logMessage The use of a proxy detected. + apt-config dump | grep -i Acquire::HTTP::Proxy > ${prefix}/etc/apt/apt.conf.d/01proxy +fi # diff --git a/hooks/debian/70-install-ssh b/hooks/debian/70-install-ssh index 8dfe2c5..e6eca32 100755 --- a/hooks/debian/70-install-ssh +++ b/hooks/debian/70-install-ssh @@ -36,20 +36,24 @@ mkdir -p ${prefix}/etc/ssh # # Second, Generate the Host RSA Key # +if [ ! -f ${prefix}/etc/ssh/ssh_host_rsa_key ]; then if ssh-keygen -t rsa -N "" -f ${prefix}/etc/ssh/ssh_host_rsa_key -C "root@${hostname}"; then logMessage "successfully generetaged Host RSA" else logMessage "failed to generate Host RSA Key" fi +fi # # Third, Generate the Host DSA Key # +if [ ! -f ${prefix}/etc/ssh/ssh_host_dsa_key ]; then if ssh-keygen -t dsa -N "" -f ${prefix}/etc/ssh/ssh_host_dsa_key -C "root@${hostname}"; then logMessage "successfully generetaged Host DSA" else logMessage "failed to generate Host DSA Key" fi +fi # # Install ssh diff --git a/hooks/edgy/20-setup-apt b/hooks/edgy/20-setup-apt index 4463ed5..5833c47 100755 --- a/hooks/edgy/20-setup-apt +++ b/hooks/edgy/20-setup-apt @@ -33,9 +33,12 @@ logMessage Script $0 starting # replicate that setup in our new guest via apt-config dump and save # the setting to the proxy guess file. # -logMessage The use of a proxy detected. -apt-config dump | grep -i Acquire::HTTP::Proxy \ - > ${prefix}/etc/apt/apt.conf.d/proxy-guess +if [ ${apt_proxy} ]; then + echo "Acquire::http::Proxy \"${apt_proxy}\";" > ${prefix}/etc/apt/apt.conf.d/01proxy +else + logMessage The use of a proxy detected. + apt-config dump | grep -i Acquire::HTTP::Proxy > ${prefix}/etc/apt/apt.conf.d/01proxy +fi # diff --git a/hooks/edgy/70-install-ssh b/hooks/edgy/70-install-ssh index 8dfe2c5..e6eca32 100755 --- a/hooks/edgy/70-install-ssh +++ b/hooks/edgy/70-install-ssh @@ -36,20 +36,24 @@ mkdir -p ${prefix}/etc/ssh # # Second, Generate the Host RSA Key # +if [ ! -f ${prefix}/etc/ssh/ssh_host_rsa_key ]; then if ssh-keygen -t rsa -N "" -f ${prefix}/etc/ssh/ssh_host_rsa_key -C "root@${hostname}"; then logMessage "successfully generetaged Host RSA" else logMessage "failed to generate Host RSA Key" fi +fi # # Third, Generate the Host DSA Key # +if [ ! -f ${prefix}/etc/ssh/ssh_host_dsa_key ]; then if ssh-keygen -t dsa -N "" -f ${prefix}/etc/ssh/ssh_host_dsa_key -C "root@${hostname}"; then logMessage "successfully generetaged Host DSA" else logMessage "failed to generate Host DSA Key" fi +fi # # Install ssh diff --git a/hooks/intrepid/20-setup-apt b/hooks/intrepid/20-setup-apt index 4463ed5..5833c47 100755 --- a/hooks/intrepid/20-setup-apt +++ b/hooks/intrepid/20-setup-apt @@ -33,9 +33,12 @@ logMessage Script $0 starting # replicate that setup in our new guest via apt-config dump and save # the setting to the proxy guess file. # -logMessage The use of a proxy detected. -apt-config dump | grep -i Acquire::HTTP::Proxy \ - > ${prefix}/etc/apt/apt.conf.d/proxy-guess +if [ ${apt_proxy} ]; then + echo "Acquire::http::Proxy \"${apt_proxy}\";" > ${prefix}/etc/apt/apt.conf.d/01proxy +else + logMessage The use of a proxy detected. + apt-config dump | grep -i Acquire::HTTP::Proxy > ${prefix}/etc/apt/apt.conf.d/01proxy +fi # diff --git a/hooks/intrepid/70-install-ssh b/hooks/intrepid/70-install-ssh index 8dfe2c5..e6eca32 100755 --- a/hooks/intrepid/70-install-ssh +++ b/hooks/intrepid/70-install-ssh @@ -36,20 +36,24 @@ mkdir -p ${prefix}/etc/ssh # # Second, Generate the Host RSA Key # +if [ ! -f ${prefix}/etc/ssh/ssh_host_rsa_key ]; then if ssh-keygen -t rsa -N "" -f ${prefix}/etc/ssh/ssh_host_rsa_key -C "root@${hostname}"; then logMessage "successfully generetaged Host RSA" else logMessage "failed to generate Host RSA Key" fi +fi # # Third, Generate the Host DSA Key # +if [ ! -f ${prefix}/etc/ssh/ssh_host_dsa_key ]; then if ssh-keygen -t dsa -N "" -f ${prefix}/etc/ssh/ssh_host_dsa_key -C "root@${hostname}"; then logMessage "successfully generetaged Host DSA" else logMessage "failed to generate Host DSA Key" fi +fi # # Install ssh diff --git a/hooks/karmic/20-setup-apt b/hooks/karmic/20-setup-apt index 4463ed5..5833c47 100755 --- a/hooks/karmic/20-setup-apt +++ b/hooks/karmic/20-setup-apt @@ -33,9 +33,12 @@ logMessage Script $0 starting # replicate that setup in our new guest via apt-config dump and save # the setting to the proxy guess file. # -logMessage The use of a proxy detected. -apt-config dump | grep -i Acquire::HTTP::Proxy \ - > ${prefix}/etc/apt/apt.conf.d/proxy-guess +if [ ${apt_proxy} ]; then + echo "Acquire::http::Proxy \"${apt_proxy}\";" > ${prefix}/etc/apt/apt.conf.d/01proxy +else + logMessage The use of a proxy detected. + apt-config dump | grep -i Acquire::HTTP::Proxy > ${prefix}/etc/apt/apt.conf.d/01proxy +fi # diff --git a/hooks/karmic/70-install-ssh b/hooks/karmic/70-install-ssh index 8dfe2c5..e6eca32 100755 --- a/hooks/karmic/70-install-ssh +++ b/hooks/karmic/70-install-ssh @@ -36,20 +36,24 @@ mkdir -p ${prefix}/etc/ssh # # Second, Generate the Host RSA Key # +if [ ! -f ${prefix}/etc/ssh/ssh_host_rsa_key ]; then if ssh-keygen -t rsa -N "" -f ${prefix}/etc/ssh/ssh_host_rsa_key -C "root@${hostname}"; then logMessage "successfully generetaged Host RSA" else logMessage "failed to generate Host RSA Key" fi +fi # # Third, Generate the Host DSA Key # +if [ ! -f ${prefix}/etc/ssh/ssh_host_dsa_key ]; then if ssh-keygen -t dsa -N "" -f ${prefix}/etc/ssh/ssh_host_dsa_key -C "root@${hostname}"; then logMessage "successfully generetaged Host DSA" else logMessage "failed to generate Host DSA Key" fi +fi # # Install ssh diff --git a/roles/editor b/roles/editor index 97c13af..68cefdc 100755 --- a/roles/editor +++ b/roles/editor @@ -76,7 +76,7 @@ for i in `find ${source} -name '*.sed' -print`; do # # Log it. # - logPrint "Running script $i - against ${prefix}/${file}" + logMessage "Running script $i - against ${prefix}/${file}" # # Invoke it. diff --git a/t/xen-tools.t b/t/xen-tools.t index 461c81d..cf797a6 100755 --- a/t/xen-tools.t +++ b/t/xen-tools.t @@ -6,7 +6,7 @@ use strict; use warnings; -use Test::More tests => 1, skip_all => 'Xen::Tools is not used for now'; +use Test::More skip_all => 'Xen::Tools is not used for now'; SKIP: { skip "Test only works as root", 1 if $< > 0; @@ -17,5 +17,7 @@ SKIP: { my $xt = Xen::Tools->new( hostname => 'xen-tools-test' ); ok( $xt->isa('Xen::Tools') ); - } + }; } + +done_testing(); diff --git a/t/xt-create-xen-config.t b/t/xt-create-xen-config.t index 13539f5..e304f85 100755 --- a/t/xt-create-xen-config.t +++ b/t/xt-create-xen-config.t @@ -36,28 +36,28 @@ noMentionOf( "ip=", # is no mention of DHCP. # testOutputContains( "ip=192.168.1.1", - memory => 128, ip1 => '192.168.1.1', dir => '/tmp' ); + memory => 128, ips => '192.168.1.1', dir => '/tmp' ); noMentionOf( "dhcp", - memory => 128, ip1 => '192.168.1.1', dir => '/tmp' ); + memory => 128, ips => '192.168.1.1', dir => '/tmp' ); # # SCSI based systems: # testOutputContains( "xvda", - memory => 128, ip1 => '192.168.1.1', dir => '/tmp' ); + memory => 128, ips => '192.168.1.1', dir => '/tmp' ); testOutputContains( "/dev/xvda1 ro", - memory => 128, ip1 => '192.168.1.1', dir => '/tmp' ); + memory => 128, ips => '192.168.1.1', dir => '/tmp' ); noMentionOf( "hda1", - memory => 128, ip1 => '192.168.1.1', dir => '/tmp' ); + memory => 128, ips => '192.168.1.1', dir => '/tmp' ); # # IDE based systems # testOutputContains( "hda1", - memory => 128, ip1 => '192.168.1.1', dir => '/tmp', ide => 1 ); + memory => 128, ips => '192.168.1.1', dir => '/tmp', ide => 1 ); testOutputContains( "/dev/hda1 ro", - memory => 128, ip1 => '192.168.1.1', dir => '/tmp', ide => 1 ); + memory => 128, ips => '192.168.1.1', dir => '/tmp', ide => 1 );