From 89e9a54b06daef9f6b54d43df87197f778a51980 Mon Sep 17 00:00:00 2001 From: Brian Bennett Date: Mon, 7 May 2012 21:18:36 +0200 Subject: [PATCH 1/8] 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) --- bin/xen-create-image | 13 ++++++++++++- etc/xm.tmpl | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/xen-create-image b/bin/xen-create-image index d3ae6d7..df42c97 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -1648,7 +1648,12 @@ 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' }; @@ -3984,6 +3989,12 @@ sub runXenConfigCreation $command .= " --admins=$CONFIG{'admins'}"; } + # + # Make sure the template gets a list of all IPs + # + $ENV{ 'IP_ADDRESSES' } = $IP_ADDRESSES; + + logprint("\nCreating Xen configuration file\n"); runCommand($command); logprint("Done\n"); diff --git a/etc/xm.tmpl b/etc/xm.tmpl index e723486..c35d0de 100644 --- a/etc/xm.tmpl +++ b/etc/xm.tmpl @@ -135,7 +135,7 @@ name = '{$hostname}' $br = ",bridge=$bridge" } - $OUT .= "vif = [ 'ip=$ip1"; + $OUT .= "vif = [ 'ip=$IP_ADDRESSES"; $OUT .= "$m"; $OUT .= "$vn"; $OUT .= "$br"; From f55461b1bcb53e9e2a6381a6e4985c32012077fc Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Mon, 7 May 2012 21:22:36 +0200 Subject: [PATCH 2/8] Mention Brian Bennett's fix in the Debian changelog --- debian/changelog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 580a15c..766f1dc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ xen-tools (4.2.1+dev-1) UNRELEASED; urgency=low - 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!) * No more suggest evms-cli -- it's no more available on any supported Dom0 distribution. Thanks to Markus Waldeck for the hint. * Bump Standards-Version to 3.9.3 (no changes) @@ -16,7 +18,7 @@ xen-tools (4.2.1+dev-1) UNRELEASED; urgency=low - copyright-refers-to-symlink-license - debian-rules-missing-recommended-target - -- Axel Beckert Tue, 15 Nov 2011 22:32:56 +0100 + -- Axel Beckert Mon, 07 May 2012 21:21:33 +0200 xen-tools (4.2.1-1) unstable; urgency=low From a9aea889d8abb5ca7b8d2efb815362f6ee6773e5 Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Mon, 7 May 2012 21:32:00 +0200 Subject: [PATCH 3/8] Support sources.list.d (i.e. when no sources.list exists; closes #650300) --- bin/xt-guess-suite-and-mirror | 64 ++++++++++++++++++----------------- debian/changelog | 1 + 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/bin/xt-guess-suite-and-mirror b/bin/xt-guess-suite-and-mirror index 4e437e1..4fc7fe5 100755 --- a/bin/xt-guess-suite-and-mirror +++ b/bin/xt-guess-suite-and-mirror @@ -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,48 +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; } - - warn "Couldn't parse $sources_list_file of the Dom0.\n" unless $found; } - my $lsb_release = `which lsb_release`; chomp($lsb_release); diff --git a/debian/changelog b/debian/changelog index 766f1dc..93605d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ xen-tools (4.2.1+dev-1) UNRELEASED; urgency=low - Fix wildcard vs regexp in memory configuration parsing. - Fix misbehaviour if --ip option is passed multiple times (Closes: #652110; Thanks Brian Bennett!) + - Supports /etc/apt/sources.list.d/ (Closes: #650300) * No more suggest evms-cli -- it's no more available on any supported Dom0 distribution. Thanks to Markus Waldeck for the hint. * Bump Standards-Version to 3.9.3 (no changes) From 3e44a19a6640d5eff9eadbbc9363d9131d068b9f Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Mon, 7 May 2012 21:42:03 +0200 Subject: [PATCH 4/8] xt-guess-suite-and-mirror exits with non-zero if no proper mirror could be found --- bin/xt-guess-suite-and-mirror | 5 +++-- debian/changelog | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/xt-guess-suite-and-mirror b/bin/xt-guess-suite-and-mirror index 4fc7fe5..7bf4e16 100755 --- a/bin/xt-guess-suite-and-mirror +++ b/bin/xt-guess-suite-and-mirror @@ -148,10 +148,11 @@ all_sources_list_files: foreach my $sources_list_file (@sources_list_files) { 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/debian/changelog b/debian/changelog index 93605d6..379adb2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,9 @@ xen-tools (4.2.1+dev-1) UNRELEASED; urgency=low - Fix misbehaviour if --ip option is passed multiple times (Closes: #652110; Thanks Brian Bennett!) - 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!) * No more suggest evms-cli -- it's no more available on any supported Dom0 distribution. Thanks to Markus Waldeck for the hint. * Bump Standards-Version to 3.9.3 (no changes) From ce626e3e9f9d5bcc292115e27c6f82c84fa4f434 Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Mon, 7 May 2012 21:50:36 +0200 Subject: [PATCH 5/8] Add dependency on openssh-client for ssh-keygen (Closes: #649108) --- debian/changelog | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 379adb2..bc05be0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,7 @@ xen-tools (4.2.1+dev-1) UNRELEASED; urgency=low - 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!) + * Add dependency on openssh-client for ssh-keygen (Closes: #649108) * No more suggest evms-cli -- it's no more available on any supported Dom0 distribution. Thanks to Markus Waldeck for the hint. * Bump Standards-Version to 3.9.3 (no changes) diff --git a/debian/control b/debian/control index 43aeb06..2733130 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ 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 From f4103617e6b67977ab25e44109028ccbbbbd0b42 Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Mon, 7 May 2012 22:00:03 +0200 Subject: [PATCH 6/8] Update README and long description in debian/control for new releases --- README | 9 ++++++--- debian/control | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README b/README index 001d779..db80872 100644 --- a/README +++ b/README @@ -29,7 +29,7 @@ About: * Etch 4.0 * 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: @@ -42,8 +42,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/debian/control b/debian/control index 2733130..dfaa30b 100644 --- a/debian/control +++ b/debian/control @@ -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) From 81656a9ef57c4b4e3a8edee4f735568f4f56af8e Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Mon, 7 May 2012 22:16:39 +0200 Subject: [PATCH 7/8] only attempt to generate the ssh host keys if not already present --- hooks/dapper/70-install-ssh | 4 ++++ hooks/debian/70-install-ssh | 4 ++++ hooks/edgy/70-install-ssh | 4 ++++ hooks/intrepid/70-install-ssh | 4 ++++ hooks/karmic/70-install-ssh | 4 ++++ 5 files changed, 20 insertions(+) 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/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/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/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/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 From cfd615b62d9ed6dd98b7a8098e8c675258c82c21 Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Mon, 7 May 2012 22:18:34 +0200 Subject: [PATCH 8/8] Mention Vagrant Cascadian's patch in the changelog --- debian/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/changelog b/debian/changelog index bc05be0..3c54ded 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,8 @@ xen-tools (4.2.1+dev-1) UNRELEASED; urgency=low - 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!) * Add dependency on openssh-client for ssh-keygen (Closes: #649108) * No more suggest evms-cli -- it's no more available on any supported Dom0 distribution. Thanks to Markus Waldeck for the hint.