From 120ca27f6dee2d2d1e54f3d990ba8d9fbfc25a3e Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Tue, 18 May 2010 14:09:40 +0200 Subject: [PATCH 1/5] List all possible install-methods close to the option itself --- bin/xen-create-image | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/xen-create-image b/bin/xen-create-image index 4107be5..18db59f 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -147,8 +147,16 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH. --dist=dist Specify the distribution you wish to install. --install-method=method - Specify the installation method to use. (Default - value for Debian and Ubuntu: debootstrap) + Specify the installation method to use. Valid methods are: + + * debootstrap + * rinse + * rpmstrap (deprecated) + * tar (needs --install-source=tarball.tar) + * copy (needs --install-source=/path/to/copy/from) + * image-server + + (Default value for Debian and Ubuntu: debootstrap) --install-source=tarball Specify the source path to use when installing via From 838303a93908c610cb6fda0b48fab837a38f03e7 Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Tue, 18 May 2010 14:10:05 +0200 Subject: [PATCH 2/5] Fix typo in error message: s/LDP/LWP/ --- bin/xt-install-image | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/xt-install-image b/bin/xt-install-image index 6da15a3..903defb 100755 --- a/bin/xt-install-image +++ b/bin/xt-install-image @@ -784,7 +784,7 @@ sub do_image_server eval($test); if ($@) { - die "The module LDP::UserAgent wasn't found...\n"; + die "The module LWP::UserAgent wasn't found...\n"; } From 131782b6c54ab1352e849d55b32c309bab657524 Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Tue, 18 May 2010 14:15:34 +0200 Subject: [PATCH 3/5] debian/control: Add "Suggests: libwww-perl" (needed if --image-server is used) --- debian/changelog | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 1fed193..71f3526 100644 --- a/debian/changelog +++ b/debian/changelog @@ -39,6 +39,7 @@ xen-tools (4.2~rc1-1) UNRELEASED; urgency=low #566683, #550590, LP: #538917, #484098) * Downgrade reiserfsprogs and xfsprogs to Suggests. (Closes: #561618, LP: #80233) + * Added "Suggests: libwww-perl" (needed if --image-server is used) * Bump Standards-Version to 3.8.4 (no changes necessary) * Bump Debhelper Compatibility to 7 - Replace "dh_clean -k" by "dh_prep" diff --git a/debian/control b/debian/control index 76bfcbb..1d9e93e 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Package: xen-tools Architecture: all Depends: debootstrap, perl-modules, libtext-template-perl, libconfig-inifiles-perl, libfile-slurp-perl, ${misc:Depends} Recommends: xen-hypervisor-amd64 | xen-hypervisor-i386 | xen-hypervisor-i386-pae, rinse, xen-shell, libexpect-perl -Suggests: reiserfsprogs, xfsprogs, xen-utils +Suggests: reiserfsprogs, xfsprogs, xen-utils, libwww-perl Description: Tools to manage Xen virtual servers This package contains tools to manage Debian based Xen virtual servers. . From fcf98e6799603350ff6b72786d244a73b159f9ca Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Tue, 18 May 2010 17:24:41 +0200 Subject: [PATCH 4/5] Remove image-server installation method Was used by Steve with a "semi-proprietary" service at some hoster which does no more use it (with Xen). According to Steve nobody else used it so we can rip out this unneeded legacy code. This also reverts the last commit. --- bin/xen-create-image | 8 +-- bin/xt-install-image | 161 ------------------------------------------- debian/changelog | 1 - debian/control | 2 +- misc/xen-tools | 2 +- 5 files changed, 4 insertions(+), 170 deletions(-) diff --git a/bin/xen-create-image b/bin/xen-create-image index 18db59f..fef2720 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -154,7 +154,6 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH. * rpmstrap (deprecated) * tar (needs --install-source=tarball.tar) * copy (needs --install-source=/path/to/copy/from) - * image-server (Default value for Debian and Ubuntu: debootstrap) @@ -1706,18 +1705,16 @@ E_OR if ( defined( $CONFIG{ 'install-method' } ) ) { foreach my $recognised ( - qw/ copy debootstrap image-server rinse rpmstrap tar /) + qw/ copy debootstrap rinse rpmstrap tar /) { $valid = 1 if ( lc( $CONFIG{ 'install-method' } ) eq lc($recognised) ); } # - # If we have "copy", "image-server", or "tar" method - # then make sure we have a source. + # If we have "copy", or "tar" method then make sure we have a source. # if ( ( lc( $CONFIG{ 'install-method' } ) eq "copy" ) || - ( lc( $CONFIG{ 'install-method' } ) eq "image-server" ) || ( lc( $CONFIG{ 'install-method' } ) eq "tar" ) ) { @@ -3230,7 +3227,6 @@ sub installSystem # And where from, if relevant. # if ( ( lc( $CONFIG{ 'install-method' } ) eq "copy" ) || - ( lc( $CONFIG{ 'install-method' } ) eq "image-server" ) || ( lc( $CONFIG{ 'install-method' } ) eq "tar" ) ) { logprint("(Source: $CONFIG{'install-source'})\n"); diff --git a/bin/xt-install-image b/bin/xt-install-image index 903defb..caed1be 100755 --- a/bin/xt-install-image +++ b/bin/xt-install-image @@ -135,9 +135,6 @@ my %dispatch = ( "debootstrap" => { sub => \&do_debootstrap, needBinary => "/usr/sbin/debootstrap", }, - "image-server" => { sub => \&do_image_server, - needURL => 1, - }, "rinse" => { sub => \&do_rinse, needBinary => "/usr/sbin/rinse", }, @@ -756,164 +753,6 @@ sub do_debootstrap -=begin doc - - Install a system using the image-server. - - Note: NON-Advertised .... - -=end doc - -=cut - -sub do_image_server -{ - - # - # Load the modules we require. - # - my $test = 'use LWP::UserAgent; use CGI;'; - - # - # Test loading the module, if it fails then - # we must abort. We don't want to insist the module - # is installed since that adds to the dependencies - # which users will not require for the typical installation - # method(s). - # - eval($test); - if ($@) - { - die "The module LWP::UserAgent wasn't found...\n"; - } - - - # - # The number of attempts to request the image from our - # image server, and the time to sleep between them. - # - my $attempts = 30; - my $sleep = 30; - - - # - # Build up the request we're going to send. - # - my $request = $CONFIG{ 'install-source' } . "/create.cgi?submit=1"; - - # - # Some parameters are hard-wired. - # - $request .= "&arch=amd64"; - $request .= "&root_device=/dev/sda"; - $request .= "&ip1=" . $ENV{ 'ip1' }; - $request .= "&dist=" . CGI::escapeHTML( $CONFIG{ 'dist' } ); - $request .= "&hostname=" . CGI::escapeHTML( $CONFIG{ 'hostname' } ); - - # - # We only care about some keys - # - foreach my $k (qw/ dhcp broadcast gateway netmask /) - { - - # Skip values which aren't defined. - next unless defined $ENV{ $k }; - - # CGI encode. - my $val = CGI::escapeHTML( $ENV{ $k } ); - - # Add on to the request - $request .= "&$k=$val"; - } - - - # - # Create a new user agent. - # - my $ua = LWP::UserAgent->new; - $ua->timeout(10); - $ua->env_proxy; - - # - # Do the creation step - # - my $response = $ua->get($request); - if ( $response->is_success ) - { - my $content = $response->content; - - if ( $content =~ /fetch.cgi\?session=([^"]+)"/ ) - { - my $session = $1; - my $new = $CONFIG{ 'install-source' }; - $new .= "/fetch.cgi?session=$session"; - my $attempt = 1; - - # Make sure we don't wait indefinitely. - while ( $attempt < $attempts ) - { - $CONFIG{ 'verbose' } && print "Request: [$attempt/$attempts]\n"; - - # - # Make a request to see if our tar file is ready yet. - # - $response = $ua->head($new); - if ( $response->is_success ) - { - - # - # Get the headers - # - my $header = $response->headers(); - my $type = $header->{ 'content-type' }; - - # - # OK our file is correct. - # - if ( $type =~ /tar/ ) - { - - # - # Download it to the installation root. - # - $ua->get( $new, - ":content_file" => $CONFIG{ 'location' } . - "/$session.tar" ); - - # - # If it worked .. then untar, remove, and return. - # - system( - "cd $CONFIG{'location'} && tar --numeric-owner -xf $session.tar && rm -f $CONFIG{'location'}/$session.tar" - ); - return 1; - } - } - - sleep($sleep); - $attempt += 1; - - } - print("ERROR: Timeout waiting for image to be ready."); - return 0; - } - else - { - print( - "ERROR: Failed to find session. Received this:\n$content\n"); - return 0; - } - } - else - { - print( "ERROR: Submitting the image create request failed:\n" . - $response->status_line ); - return 0; - } -} - - - =begin doc Install a new distribution of GNU/Linux using the rinse tool. diff --git a/debian/changelog b/debian/changelog index 71f3526..1fed193 100644 --- a/debian/changelog +++ b/debian/changelog @@ -39,7 +39,6 @@ xen-tools (4.2~rc1-1) UNRELEASED; urgency=low #566683, #550590, LP: #538917, #484098) * Downgrade reiserfsprogs and xfsprogs to Suggests. (Closes: #561618, LP: #80233) - * Added "Suggests: libwww-perl" (needed if --image-server is used) * Bump Standards-Version to 3.8.4 (no changes necessary) * Bump Debhelper Compatibility to 7 - Replace "dh_clean -k" by "dh_prep" diff --git a/debian/control b/debian/control index 1d9e93e..76bfcbb 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Package: xen-tools Architecture: all Depends: debootstrap, perl-modules, libtext-template-perl, libconfig-inifiles-perl, libfile-slurp-perl, ${misc:Depends} Recommends: xen-hypervisor-amd64 | xen-hypervisor-i386 | xen-hypervisor-i386-pae, rinse, xen-shell, libexpect-perl -Suggests: reiserfsprogs, xfsprogs, xen-utils, libwww-perl +Suggests: reiserfsprogs, xfsprogs, xen-utils Description: Tools to manage Xen virtual servers This package contains tools to manage Debian based Xen virtual servers. . diff --git a/misc/xen-tools b/misc/xen-tools index 8b4e538..6f3125e 100644 --- a/misc/xen-tools +++ b/misc/xen-tools @@ -119,7 +119,7 @@ _xen_create_image() return 0 ;; --install-method) - COMPREPLY=( $( compgen -W 'copy debootstrap image-server rpmstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) ) + COMPREPLY=( $( compgen -W 'copy debootstrap rpmstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) ) return 0 ;; --ip) From e4eae6fcf5aa3ca6c372fa6295e10e22e723e34d Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Tue, 18 May 2010 17:28:53 +0200 Subject: [PATCH 5/5] bash completion: add rinse to list of install-methods --- misc/xen-tools | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/xen-tools b/misc/xen-tools index 6f3125e..2432cca 100644 --- a/misc/xen-tools +++ b/misc/xen-tools @@ -119,7 +119,7 @@ _xen_create_image() return 0 ;; --install-method) - COMPREPLY=( $( compgen -W 'copy debootstrap rpmstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) ) + COMPREPLY=( $( compgen -W 'copy debootstrap rinse rpmstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) ) return 0 ;; --ip) @@ -433,7 +433,7 @@ _xt-install-image() return 0 ;; --install-method) - COMPREPLY=( $( compgen -W 'copy debootstrap rpmstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) ) + COMPREPLY=( $( compgen -W 'copy debootstrap rinse rpmstrap tar' -- "${COMP_WORDS[COMP_CWORD]}" ) ) return 0 ;; --location)