1
0
mirror of synced 2026-02-22 22:57:23 +00:00

Compare commits

..

17 Commits

Author SHA1 Message Date
Axel Beckert
07622d8ed0 t/xen-delete-image.t: Check xen-delete-image exit code
Also run xen-delete-image verbose and print output.
2013-04-18 16:26:55 +02:00
Axel Beckert
081c0370d4 Properly clean up after t/xt-create-xen-config.t 2013-04-18 16:21:25 +02:00
Axel Beckert
ea209f085b Refactor some code duplication in xen-delete-image 2013-04-18 16:21:25 +02:00
Axel Beckert
a70b79f63f Hopefully catch all remaining "ARRAY(0x…).log" issues 2013-04-18 14:45:27 +02:00
Axel Beckert
c482220b99 Rework xci POD: New SYNOPSIS; add EXAMPLES, rename old SYNOPSIS to OPTIONS 2013-04-18 13:52:45 +02:00
Axel Beckert
dcd0bf09f1 Add reference for the three types of MAC relevant for DomUs 2013-04-16 18:03:33 +02:00
Axel Beckert
92a825b87b Axel's Break-Backwards-Compatibility Wishlist: MAC stuff 2013-04-16 17:57:12 +02:00
Axel Beckert
6871954f6e Merge branch 'lib-vs-share' 2013-04-11 19:49:53 +02:00
Axel Beckert
e9d8bd0896 xt-install-image: Don't bail out if only cdebootstrap is installed
There was a duplicated check on debootstrap being installed and only
one has been expanded when cdebootstrap support was added. So
xen-tools bailed out if debootstrap wasn't installed even if it had
been instructed to use cdebootstrap instead.

This also adds support for cdebootstrap-static.

Additionally xt-install-image dispatcher has been extended to hand
array refs of command paths instead of just single command paths.

Thanks to Elmar Heeb for reporting this issue!
2013-04-11 19:47:05 +02:00
Axel Beckert
9369fd2a03 Update debian/changelog 2013-04-11 19:18:41 +02:00
Axel Beckert
04dd81ec07 Mention http.debian.net as default mirror also in POD 2013-04-11 15:59:42 +02:00
Axel Beckert
d39255dc5e Reindent options in POD 2013-04-11 15:59:19 +02:00
Axel Beckert
5a48067d9e Make some x-c-i commandline options negatable
Update documentation and tests accordingly.

Also add pygrub = 1 as example to xen-tools.conf, now that the effect
can be reversed via commandline options.
2013-04-11 15:51:31 +02:00
Axel Beckert
6fc51d20be Update xen-tools.conf comments to be more concise and consistent
Thanks Elmar Heeb!
2013-04-11 13:08:31 +02:00
Axel Beckert
16dbe870f2 TODO: test for --size constraints
... and its prerequisites
2013-04-11 10:52:45 +02:00
Axel Beckert
cb3227d61b Don't only allow lowercase "b" for "bytes".
Also put some examples in the according error message.
2013-04-11 10:32:20 +02:00
Axel Beckert
a89aa86511 Consistent amount of blank lines in POD 2013-04-11 10:29:56 +02:00
10 changed files with 215 additions and 146 deletions

View File

@@ -187,6 +187,13 @@ Bugs to fix and features to add for 5.0
* Remove from the (unused) Xen::Tools what's already in the used * Remove from the (unused) Xen::Tools what's already in the used
Xen::Tools::Common. Xen::Tools::Common.
* Add test for `--size` constraints (upper- and lowercase letters,
with and without `B`, etc.)
* Needs a `--dry-run` or `--check-constraints` option in
`xen-create-image` first. Which probably both would be a good
idea.
Stuff from Steve's TODO list / Generic TODOs Stuff from Steve's TODO list / Generic TODOs
-------------------------------------------- --------------------------------------------
@@ -232,3 +239,9 @@ Axel's Break-Backwards-Compatibility Wishlist
Maybe add some `--autostart` or such. Maybe add some `--autostart` or such.
* Maybe replace findBinary with File::Which * Maybe replace findBinary with File::Which
* MAC addresses should no more depend on the distribution.
* Let the admin switch between MAC addresses based on XenSource's OUI,
its organisation's own OUI or locally administrated MAC addresses.
See also http://wiki.xen.org/wiki/Xen_Networking#MAC_addresses

View File

@@ -8,35 +8,49 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
=head1 SYNOPSIS =head1 SYNOPSIS
xen-create-image --hostname=<hostname> <further options>
=head1 EXAMPLES
xen-create-image --hostname=some-domu --dist=wheezy --lvm=vg0
xen-create-image --hostname=some-domu --dist=precise --dir=/srv/xen
See below for more specific examples: LOOPBACK EXAMPLES, LVM EXAMPLE
and EVMS EXAMPLE.
=head1 OPTIONS
Help Options: Help Options:
--help Show the help information for this script. --help Show the help information for this script.
--manual Read the manual, and examples, for this script. --manual Read the manual, and examples, for this script.
--verbose Show useful debugging information. --(no)verbose (Don't) show more of what xen-create-image is
currently doing.
--dumpconfig Show current configuration. --dumpconfig Show current configuration.
--version Show the version number and exit. --version Show the version number and exit.
Size / General options: Size / General options:
--accounts Copy all non-system accounts to the guest image --(no)accounts
(Don't) copy all non-system accounts to the guest
image
--admins Specify that some administrators should be created for --admins Specify that some administrators should be created for
this image, using xen-shell. this image, using xen-shell.
--boot Boot the new instance after creating it. --(no)boot (Don't) boot the new instance after creating it.
--cache=bool Cache .deb files on the host when installing the new --cache=bool Cache .deb files on the host when installing the new
guest with the debootstrap tool. Accepted values: guest with the debootstrap tool. Accepted values:
"yes" (default) and "no". "yes" (default) and "no".
--cachedir=/path/to/cache/directory --cachedir=/path/to/cache/directory
Override the default .deb cache directory. Defaults to Override the default .deb cache directory. Defaults to
/var/cache/apt/archives/ if it exists (i.e. on Debian /var/cache/apt/archives/ if it exists (i.e. on Debian
@@ -47,7 +61,9 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
Read the specified file in addition to the global Read the specified file in addition to the global
configuration file. configuration file.
--copyhosts Copy entries from the dom0's /etc/hosts file to the guest --(no)copyhosts
(Don't) copy entries from the dom0's /etc/hosts file
to the guest
--copy-cmd NOP: Ignored. --copy-cmd NOP: Ignored.
@@ -57,61 +73,64 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
installed. Specifying the path is optional. installed. Specifying the path is optional.
--disk_device=diskname --disk_device=diskname
Use specified device name for virtual devices instead of Use specified device name for virtual devices instead
the default value "xvda". of the default value "xvda".
--extension=ext --extension=ext
Specify the suffix to give the Xen configuration Specify the suffix to give the Xen configuration
file. (Default value: ".cfg") file. (Default value: ".cfg")
--force Force overwriting existing images. This will remove --(no)force (Don't) force overwriting existing images. This will
existing images or LVM volumes which match those which remove existing images or LVM volumes which match
are liable to be used by the new invocation. those which are liable to be used by the new
invocation.
--fs=fs Specify the filesystem type to use for the new guest. --fs=fs Specify the filesystem type to use for the new guest.
Valid choices are 'ext2', 'ext3', 'ext4', 'reiserfs', Valid choices are 'ext2', 'ext3', 'ext4', 'reiserfs',
'xfs' or 'btrfs'. (Note: pygrub *DOES NOT* support xfs) 'xfs' or 'btrfs'. (Note: pygrub *DOES NOT* support
xfs)
--genpass=1 Generate a random root password (default, set to 0 to turn off) --genpass=1 Generate a random root password (default, set to 0 to
turn off)
--genpass_len=N --genpass_len=N
Override the default password length of 8 and generate a Override the default password length of 8 and generate
random password of length N. Note: this only works in a random password of length N. Note: this only works
conjunction with --genpass in conjunction with --genpass
--hash_method=algorithm --hash_method=algorithm
Override the default hashing method of sha256 and use the Override the default hashing method of sha256 and use
provided algorithm. Can be : md5, sha256 or sha512 the provided algorithm. Can be : md5, sha256 or sha512
--hooks=1 Specify whether to run hooks after the image is created. --hooks=1 Specify whether to run hooks after the image is created.
--ide Use IDE names for virtual devices (i.e. hda not xvda) --ide Use IDE names for virtual devices (i.e. hda not xvda)
--image=str Specify whether to create "sparse" or "full" disk images. --image=str Specify whether to create "sparse" or "full" disk
Full images are mandatory when using LVM, so this setting images. Full images are mandatory when using LVM, so
is ignored in that case. this setting is ignored in that case.
--image-dev=/path/to/device --image-dev=/path/to/device
Specify a physical/logical volume for the disk image. Specify a physical/logical volume for the disk image.
--initrd=/path/to/initrd --initrd=/path/to/initrd
Specify the initial ramdisk. If an image is specified it Specify the initial ramdisk. If an image is specified
must exist. it must exist.
--install=1 Specify whether to install the guest system or not. --install=1 Specify whether to install the guest system or not.
--keep Don't delete our images if installation fails. It maybe --(no)keep (Don't) keep our images if installation fails. It
unmounted, though. maybe unmounted, though.
--kernel=/path/to/kernel --kernel=/path/to/kernel
Set the path to the kernel to use for domU. If a Set the path to the kernel to use for domU. If a
kernel is specified it must exist. kernel is specified it must exist.
--memory=size --memory=size
Setup the amount of memory allocated to the new instance. Setup the amount of memory allocated to the new
As suffix recognized size units are "M", "MB", "G" and instance. As suffix recognized size units are "M",
"GB" (case does not matter). If there's no unit given, "MB", "G" and "GB" (case does not matter). If there's
megabytes are assumed. no unit given, megabytes are assumed.
--modules=/path/to/modules --modules=/path/to/modules
Set the path to the kernel modules to use for domU. Set the path to the kernel modules to use for domU.
@@ -126,9 +145,8 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
--no-xen-ok Don't complain if xen seems not installed or xend is --no-xen-ok Don't complain if xen seems not installed or xend is
not running. (Needed for the testsuite.) not running. (Needed for the testsuite.)
--output=dir Specify the output directory to create the xen configuration --output=dir Specify the output directory to create the xen
file within. configuration file within.
--partitions=file --partitions=file
Use a specific partition layout configuration file. Use a specific partition layout configuration file.
@@ -141,23 +159,23 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
--password=passphrase --password=passphrase
Set the root password for the new guest. Set the root password for the new guest.
--passwd Ask for a root password interactively during setup. --(no)passwd (Don't) ask for a root password interactively during
NOTE: This overrides --genpass --password setup. NOTE: This overrides --genpass --password.
--pygrub DomU should be booted using pygrub. --(no)pygrub DomU should (not) be booted using pygrub.
--role=role Run the specified role script(s) post-install. --role=role Run the specified role script(s) post-install. Role
Role scripts are discussed later in this manpage. scripts are discussed later in this manpage. Can be
Can be an absolute path. Otherwise it's relative to the an absolute path. Otherwise it's relative to the value
value of --roledir. of --roledir.
--role-args="--arg1 --arg2" --role-args="--arg1 --arg2"
Pass the named string literally to any role script. Pass the named string literally to any role script.
This is useful for site-specific roles. This is useful for site-specific roles.
--finalrole=role --finalrole=role
Similar to role scripts. Run the specified role script(s) Similar to role scripts. Run the specified role
after cfg file creation. script(s) after cfg file creation.
--roledir=/path/to/directory --roledir=/path/to/directory
Specify the directory which contains the role scripts. Specify the directory which contains the role scripts.
@@ -184,20 +202,22 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
beforehand. beforehand.
--vcpus=num --vcpus=num
Set the number of vcpus that the new instance will have Set the number of vcpus that the new instance will
instead of the default value of "1". have instead of the default value of "1".
Installation options: Installation options:
--arch=arch Pass the given architecture to debootstrap, rinse, --arch=arch Pass the given architecture to debootstrap, rinse, or
or rpmstrap when installing the system. This argument rpmstrap when installing the system. This argument is
is ignored for other install methods. ignored for other install methods.
--dist=dist Specify the distribution you wish to install. --dist=dist Specify the distribution you wish to install.
--install-method=method --install-method=method
Specify the installation method to use. Valid methods are: Specify the installation method to use. Valid methods
are:
* debootstrap * debootstrap
* cdebootstrap * cdebootstrap
@@ -215,12 +235,13 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
--mirror=url Setup the mirror to use when installing via --mirror=url Setup the mirror to use when installing via
debootstrap. (Default value: mirror used in debootstrap. (Default value: mirror used in
/etc/apt/sources.list or for Debian /etc/apt/sources.list or for Debian
"http://cdn.debian.net/debian/" and for Ubuntu "http://http.debian.net/debian/" and for Ubuntu
"http://archive.ubuntu.com/ubuntu/") "http://archive.ubuntu.com/ubuntu/")
The above mentioned Debian mirror hostname uses GeoIP The above mentioned Debian mirror hostname
to choose a more or less close Debian mirror. See automatically tries to choose a more or less close
http://wiki.debian.org/DebianGeoMirror for details. Debian mirror. See http://http.debian.net/ for
details.
--apt_proxy=url --apt_proxy=url
Specify a proxy to be used by debootstrap, and within Specify a proxy to be used by debootstrap, and within
@@ -235,15 +256,15 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
Networking options: Networking options:
--bridge=brname --bridge=brname
Optionally, set a specific bridge for the new instance. Optionally, set a specific bridge for the new
This can be especially useful when running multiple instance. This can be especially useful when running
bridges on a dom0. multiple bridges on a dom0.
--broadcast=123.456.789.ABC --broadcast=123.456.789.ABC
Setup the broadcast address for the new instance. Setup the broadcast address for the new instance.
--dhcp The guest will be configured to fetch its networking --(no)dhcp The guest will (not) be configured to fetch its
details via DHCP. networking details via DHCP.
--gateway=gw Setup the network gateway for the new instance. --gateway=gw Setup the network gateway for the new instance.
@@ -253,8 +274,9 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
one is setup as the "system" IP, and the additional one is setup as the "system" IP, and the additional
ones are added as aliases. ones are added as aliases.
Note that Xen 3.x supports a maximum of three vif statements Note that Xen 3.x supports a maximum of three vif
per guest. This option conflicts with --dhcp. statements per guest. This option conflicts with
--dhcp.
--mac=AA:BB:CC:DD:EE:FF --mac=AA:BB:CC:DD:EE:FF
Specify the MAC address to use for a given interface. Specify the MAC address to use for a given interface.
@@ -268,26 +290,31 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
--nameserver="123.456.789.ABC 123.456.789.DEF" --nameserver="123.456.789.ABC 123.456.789.DEF"
Setup the nameserver of the machine, multiple space Setup the nameserver of the machine, multiple space
separated nameservers are allowed. separated nameservers are allowed. If not provided,
If not provided, Dom0's /etc/resolv.conf will be copied Dom0's /etc/resolv.conf will be copied to guest.
to guest.
--vifname=vifname --vifname=vifname
Optionally, set a specific vif name for the new instance. Optionally, set a specific vif name for the new
instance.
Mandatory options: Mandatory options:
--dir=/path/to/directory --dir=/path/to/directory
Specify where the output images should go. Specify where the output images should go.
Subdirectories will be created for each guest Subdirectories will be created for each guest.
If you do not wish to use loopback images specify --lvm
or --evms. (These three options are mutually exclusive.) If you do not wish to use loopback images specify
--lvm or --evms. (These three options are mutually
exclusive.)
--evms=lvm2/container --evms=lvm2/container
Specify the container to save images within, i.e. '--evms Specify the container to save images within,
lvm2/mycontainer'. If you do not wish to use EVMS specify i.e. '--evms lvm2/mycontainer'. If you do not wish to
--dir or --lvm. (These three options are mutually exclusive.) use EVMS specify --dir or --lvm. (These three options
are mutually exclusive.)
--hostname=host.example.org --hostname=host.example.org
Set the hostname of the new guest system. Ideally Set the hostname of the new guest system. Ideally
@@ -1422,8 +1449,8 @@ sub checkOption
# Define argument types # Define argument types
my %types = ( my %types = (
integerWithSuffix => { integerWithSuffix => {
check => qr/^[0-9.]+[GgMmKk]b?$/, check => qr/^[0-9.]+[GMk]B?$/i,
message => "takes a suffixed integer.\n", message => "takes a suffixed (mb, MB, G, k, etc.) integer.\n",
}, },
distribution => { distribution => {
check => sub { -d "/usr/share/xen-tools/$_[0].d" }, check => sub { -d "/usr/share/xen-tools/$_[0].d" },
@@ -1614,14 +1641,14 @@ sub parseCommandLineArguments
"disk_device=s", \&checkOption, "disk_device=s", \&checkOption,
# Hosts options # Hosts options
"nohosts", \$CONFIG{ 'nohosts' }, "nohosts", \$CONFIG{ 'nohosts' },
"copyhosts", \$CONFIG{ 'copyhosts' }, "copyhosts!", \$CONFIG{ 'copyhosts' },
# Deprecated legacy options for backwards compatibility # Deprecated legacy options for backwards compatibility
"no-hosts", \$CONFIG{ 'nohosts' }, "no-hosts", \$CONFIG{ 'nohosts' },
"copy-hosts", \$CONFIG{ 'copyhosts' }, "copy-hosts!", \$CONFIG{ 'copyhosts' },
# Networking options # Networking options
"dhcp", \$CONFIG{ 'dhcp' }, "dhcp!", \$CONFIG{ 'dhcp' },
"bridge=s", \&checkOption, "bridge=s", \&checkOption,
"gateway=s", \&checkOption, "gateway=s", \&checkOption,
"hostname=s", \&checkOption, "hostname=s", \&checkOption,
@@ -1642,11 +1669,11 @@ sub parseCommandLineArguments
"debootstrap-cmd=s", \$CONFIG{ 'debootstrap-cmd' }, "debootstrap-cmd=s", \$CONFIG{ 'debootstrap-cmd' },
# Misc. options # Misc. options
"accounts", \$CONFIG{ 'accounts' }, "accounts!", \$CONFIG{ 'accounts' },
"admins=s", \&checkOption, "admins=s", \&checkOption,
"arch=s", \&checkOption, "arch=s", \&checkOption,
"fs=s", \&checkOption, "fs=s", \&checkOption,
"boot", \$CONFIG{ 'boot' }, "boot!", \$CONFIG{ 'boot' },
"cache=s", \&checkOption, "cache=s", \&checkOption,
"cachedir=s", \&checkOption, "cachedir=s", \&checkOption,
"config=s", \&checkOption, "config=s", \&checkOption,
@@ -1654,8 +1681,8 @@ sub parseCommandLineArguments
"scsi", \$CONFIG{ 'scsi' }, "scsi", \$CONFIG{ 'scsi' },
"install=i", \&checkOption, "install=i", \&checkOption,
"hooks=i", \&checkOption, "hooks=i", \&checkOption,
"pygrub", \$CONFIG{ 'pygrub' }, "pygrub!", \$CONFIG{ 'pygrub' },
"passwd", \$CONFIG{ 'passwd' }, "passwd!", \$CONFIG{ 'passwd' },
"genpass=i", \&checkOption, "genpass=i", \&checkOption,
"genpass-len=i", \&checkOption, "genpass-len=i", \&checkOption,
"genpass_len=i", \&checkOption, "genpass_len=i", \&checkOption,
@@ -1666,20 +1693,20 @@ sub parseCommandLineArguments
"role-args=s", \&checkOption, "role-args=s", \&checkOption,
"finalrole=s", \&checkOption, "finalrole=s", \&checkOption,
"roledir=s", \&checkOption, "roledir=s", \&checkOption,
"force", \$CONFIG{ 'force' }, "force!", \$CONFIG{ 'force' },
"no-xen-ok", \$CONFIG{ 'no_xen_ok' }, "no-xen-ok", \$CONFIG{ 'no_xen_ok' },
"keep", \$CONFIG{ 'keep' }, "keep!", \$CONFIG{ 'keep' },
"template=s", \&checkOption, "template=s", \&checkOption,
"output=s", \&checkOption, "output=s", \&checkOption,
"extension:s", \&checkOption, "extension:s", \&checkOption,
"dontformat", \&checkOption, "dontformat", \&checkOption,
# Help options # Help options
"debug", \$CONFIG{ 'debug' }, "debug!", \$CONFIG{ 'debug' },
"help", \$HELP, "help", \$HELP,
"manual", \$MANUAL, "manual", \$MANUAL,
"dumpconfig", \$DUMPCONFIG, "dumpconfig", \$DUMPCONFIG,
"verbose", \$CONFIG{ 'verbose' }, "verbose!", \$CONFIG{ 'verbose' },
"version", \$VERSION "version", \$VERSION
) ) ) )
{ {

View File

@@ -232,25 +232,17 @@ E_O_ROOT
# #
# Loop over the supplied arguments, and attempt to delete each # Loop over the supplied arguments, and attempt to delete each
# image. # image. Check both, bare parameters as well as --hostname options.
# #
while ( my $name = shift )
{ my @hosts = ();
if ( $CONFIG{ 'no_xen_ok' } or !xenRunning($name, \%CONFIG) ) if (exists($CONFIG{ 'hostname' }) and defined($CONFIG{ 'hostname' })) {
{ my $hostname_option = $CONFIG{ 'hostname' };
deleteXenImage($name); @hosts = 'ARRAY' eq ref($hostname_option) ?
} @$hostname_option : $hostname_option;
else
{
print "Skipping xen guest '$name' - it appears to be running.\n";
}
} }
# foreach my $name (@ARGV, @hosts)
# Also delete any which were specified using the --hostname flag
#
my $hosts = $CONFIG{ 'hostname' };
foreach my $name (@$hosts)
{ {
my %PER_HOST_CONFIG = %CONFIG; my %PER_HOST_CONFIG = %CONFIG;
$PER_HOST_CONFIG{ 'hostname' } = $name; $PER_HOST_CONFIG{ 'hostname' } = $name;
@@ -416,7 +408,8 @@ sub deleteXenImage
} }
} }
my %PER_HOST_CONFIG = %CONFIG;
$PER_HOST_CONFIG{ 'hostname' } = $hostname;
if ( defined( $CONFIG{ 'dir' } ) ) if ( defined( $CONFIG{ 'dir' } ) )
{ {
my $prefix = $CONFIG{ 'dir' } . "/domains/"; my $prefix = $CONFIG{ 'dir' } . "/domains/";
@@ -450,7 +443,7 @@ sub deleteXenImage
print "Would remove LVM swap volume /dev/$CONFIG{'lvm'}/$hostname-swap\n"; print "Would remove LVM swap volume /dev/$CONFIG{'lvm'}/$hostname-swap\n";
} else { } else {
print "Removing swap volume\n"; print "Removing swap volume\n";
runCommand("lvremove /dev/$CONFIG{'lvm'}/$hostname-swap --force", \%CONFIG); runCommand("lvremove /dev/$CONFIG{'lvm'}/$hostname-swap --force", \%PER_HOST_CONFIG);
} }
} }
@@ -460,7 +453,7 @@ sub deleteXenImage
print "Would remove LVM disk volume /dev/$CONFIG{'lvm'}/$hostname-disk\n"; print "Would remove LVM disk volume /dev/$CONFIG{'lvm'}/$hostname-disk\n";
} else { } else {
print "Removing LVM disk volume\n"; print "Removing LVM disk volume\n";
runCommand("lvremove /dev/$CONFIG{'lvm'}/$hostname-disk --force", \%CONFIG); runCommand("lvremove /dev/$CONFIG{'lvm'}/$hostname-disk --force", \%PER_HOST_CONFIG);
} }
} }
@@ -482,8 +475,8 @@ sub deleteXenImage
print "Would remove EVMS swap volume: $CONFIG{'evms'}/$hostname-swap\n"; print "Would remove EVMS swap volume: $CONFIG{'evms'}/$hostname-swap\n";
} else { } else {
print "Removing EVMS swap volume\n"; print "Removing EVMS swap volume\n";
runCommand("echo Delete : /dev/evms/$hostname-swap | evms", \%CONFIG); runCommand("echo Delete : /dev/evms/$hostname-swap | evms", \%PER_HOST_CONFIG);
runCommand("echo Delete : $CONFIG{'evms'}/$hostname-swap | evms", \%CONFIG); runCommand("echo Delete : $CONFIG{'evms'}/$hostname-swap | evms", \%PER_HOST_CONFIG);
} }
} }
@@ -494,8 +487,8 @@ sub deleteXenImage
print "Would remove EVMS disk volume: $CONFIG{'evms'}/$hostname-swap\n"; print "Would remove EVMS disk volume: $CONFIG{'evms'}/$hostname-swap\n";
} else { } else {
print "Removing EVMS disk volume\n"; print "Removing EVMS disk volume\n";
runCommand("echo Delete : /dev/evms/$hostname-disk | evms", \%CONFIG); runCommand("echo Delete : /dev/evms/$hostname-disk | evms", \%PER_HOST_CONFIG);
runCommand("echo Delete : $CONFIG{'evms'}/$hostname-disk | evms", \%CONFIG); runCommand("echo Delete : $CONFIG{'evms'}/$hostname-disk | evms", \%PER_HOST_CONFIG);
} }
} }

View File

@@ -133,13 +133,19 @@ my $RELEASE = '4.4~dev';
# needDirectory Defined if we need an install-source directory specified. # needDirectory Defined if we need an install-source directory specified.
# #
# #
my $debootstrap_cmd;
my %dispatch = ( my %dispatch = (
"copy" => { sub => \&do_copy, "copy" => { sub => \&do_copy,
needBinary => "/bin/cp", needBinary => "/bin/cp",
needDirectory => 1, needDirectory => 1,
}, },
"debootstrap" => { sub => \&do_debootstrap, "debootstrap" => { sub => \&do_debootstrap,
needBinary => "/usr/sbin/debootstrap", needBinary => ["/usr/sbin/debootstrap", "/usr/bin/cdebootstrap", "/usr/bin/cdebootstrap-static"],
var => \$debootstrap_cmd,
},
"cdebootstrap" => { sub => \&do_debootstrap,
needBinary => ["/usr/sbin/cdebootstrap", "/usr/bin/cdebootstrap-static"],
var => \$debootstrap_cmd,
}, },
"rinse" => { sub => \&do_rinse, "rinse" => { sub => \&do_rinse,
needBinary => "/usr/sbin/rinse", needBinary => "/usr/sbin/rinse",
@@ -210,13 +216,35 @@ if ( defined( $CONFIG{ 'install-method' } ) &&
# #
# Do we need to test for a binary. # Do we need to test for a binary.
if ( ( $installer->{ 'needBinary' } ) && if ( $installer->{ 'needBinary' } ) {
( !-x $installer->{ 'needBinary' } ) ) if ( 'ARRAY' eq ref $installer->{ 'needBinary' } ) {
{ unless (ref $installer->{ 'var' }) {
print die "Assertion: If dispatch->->needBinary is an array ref, dispatch->->var must exist";
"The following required binary for the installation was not found\n"; }
print "\t" . $installer->{ 'needBinary' } . "\n";
exit 1; foreach my $binary (@{$installer->{ 'needBinary' }}) {
if (-x $binary) {
${$installer->{ 'var' }} = $binary;
last;
}
}
unless ( ${$installer->{ 'var' }} ) {
print
"One of the following binaries are required for the installation, but none was found\n";
print "\t" . join(', ', @{$installer->{ 'needBinary' }}) . "\n";
exit 1;
}
}
else
{
if ( !-x $installer->{ 'needBinary' } ) {
print
"The following required binary for the installation was not found\n";
print "\t" . $installer->{ 'needBinary' } . "\n";
exit 1;
}
}
} }
# Do we need a directory specified as the installation source? # Do we need a directory specified as the installation source?
@@ -572,21 +600,9 @@ sub do_debootstrap
# The command is a little configurable - mostly to allow you # The command is a little configurable - mostly to allow you
# to use cdebootstrap. # to use cdebootstrap.
# #
my $cmd = $CONFIG{ 'debootstrap-cmd' }; my $cmd = $CONFIG{ 'debootstrap-cmd' } || $debootstrap_cmd;
print "Using $cmd as debootstrap command\n";
my $cachedir = $CONFIG{ 'cachedir' }; my $cachedir = $CONFIG{ 'cachedir' };
if ( !$cmd )
{
if (-x '/usr/sbin/debootstrap') {
$cmd = '/usr/sbin/debootstrap';
} elsif (-x '/usr/sbin/cdebootstrap') {
$cmd = '/usr/sbin/cdebootstrap';
} else {
print STDERR "Found neither debootstrap nor cdebootstrap and no --debootstrap-cmd given\n";
exit 1;
}
print "Using $cmd as debootstrap command\n";
}
# #
# Cache from host -> new installation if we've got caching # Cache from host -> new installation if we've got caching

7
debian/changelog vendored
View File

@@ -9,6 +9,7 @@ xen-tools (4.4~dev-1) UNRELEASED; urgency=low
- Execute END block not on --version/--help/--manual (Closes: #684346) - Execute END block not on --version/--help/--manual (Closes: #684346)
- Move code for --boot feature to END block. Fixes missing SSH - Move code for --boot feature to END block. Fixes missing SSH
fingerprint display if --boot was used. (Closes: #679183) fingerprint display if --boot was used. (Closes: #679183)
- Correctly handle aborts in END block. (Closes: #704882)
- Use local parameter instead of global variable in unMountImage. - Use local parameter instead of global variable in unMountImage.
- Also recognize "M" and "G" instead of "MB" and "GB" as size unit for - Also recognize "M" and "G" instead of "MB" and "GB" as size unit for
--memory. (Closes: #691320) Document the recognized units. --memory. (Closes: #691320) Document the recognized units.
@@ -22,6 +23,8 @@ xen-tools (4.4~dev-1) UNRELEASED; urgency=low
- Preliminary support for Debian Jessie and Ubuntu Raring - Preliminary support for Debian Jessie and Ubuntu Raring
- Preliminary support for xl toolstack - Preliminary support for xl toolstack
- xen-create-image: Consistently use runCommand() instead of system() - xen-create-image: Consistently use runCommand() instead of system()
- xt-install-image: Don't bail out if only cdebootstrap is installed
but not debootstrap (Thanks Elmar Heeb!)
- Makefile accepts DESTDIR=… - Makefile accepts DESTDIR=…
- Move examples from debian/examples to examples. - Move examples from debian/examples to examples.
- Uses File::Which, added (build-) dependency on libfile-which-perl - Uses File::Which, added (build-) dependency on libfile-which-perl
@@ -39,9 +42,11 @@ xen-tools (4.4~dev-1) UNRELEASED; urgency=low
- Fix filesystem tools installation in 91-install-fs-tools (which was - Fix filesystem tools installation in 91-install-fs-tools (which was
broken since 4.3~rc1-1) by merging 91-install-fs-tools back into broken since 4.3~rc1-1) by merging 91-install-fs-tools back into
90-make-fstab. Also supports RPM-based distributions now. 90-make-fstab. Also supports RPM-based distributions now.
- Fix export of environment variables. Previously they could contain - Fixes export of environment variables. Previously they could contain
dashes and then were only accessible from within Perl, but not from dashes and then were only accessible from within Perl, but not from
within Bash. within Bash.
- Fixes creation of "ARRAY(0x…).log" named log files.
- Makes some options (like --pygrub) negatable.
- Uses Test::NoTabs; add according build-dependency. - Uses Test::NoTabs; add according build-dependency.
* Add debian/gbp.conf to be able to to build xen-tools with * Add debian/gbp.conf to be able to to build xen-tools with
git-buildpackage. git-buildpackage.

View File

@@ -125,13 +125,14 @@ install-method = debootstrap
# Disk and Sizing options. # Disk and Sizing options.
## ##
# #
size = 4Gb # Disk image size. size = 4G # Root disk, suffix (G, M, k) required
memory = 128Mb # Memory size memory = 128M # Suffix (G, M, k) required
swap = 128Mb # Swap size swap = 128M # Suffix (G, M, k) required
# noswap = 1 # Don't use swap at all for the new system. # noswap = 1 # Don't use swap at all for new systems.
fs = ext3 # use the EXT3 filesystem for the disk image. fs = ext3 # Default file system for any disk
dist = `xt-guess-suite-and-mirror --suite` # Default distribution to install. dist = `xt-guess-suite-and-mirror --suite`
image = sparse # Specify sparse vs. full disk images. # Default distribution is determined by Dom0's distribution
image = sparse # Specify sparse vs. full disk images (file based images only)
# #
# See the README for currently supported and tested distributions. You can # See the README for currently supported and tested distributions. You can
@@ -235,6 +236,13 @@ image = sparse # Specify sparse vs. full disk images.
kernel = /boot/vmlinuz-`uname -r` kernel = /boot/vmlinuz-`uname -r`
initrd = /boot/initrd.img-`uname -r` initrd = /boot/initrd.img-`uname -r`
#
# Uncomment the following line if you wish to use pygrub by default
# for all distributions.
#
# pygrub = 1
#
# #
# The architecture to use when using debootstrap, rinse, or rpmstrap. # The architecture to use when using debootstrap, rinse, or rpmstrap.
# #

View File

@@ -39,7 +39,7 @@ foreach my $key ( sort keys %OPTIONS )
foreach my $line ( @lines ) foreach my $line ( @lines )
{ {
if ( $line =~ /--$key/ ) if ( $line =~ /--(\(no\))?$key/ )
{ {
$found = 1; $found = 1;
} }

View File

@@ -51,7 +51,7 @@ sub testFile
foreach my $line ( split( /\n/, $output ) ) foreach my $line ( split( /\n/, $output ) )
{ {
if ( $line =~ /[ \t]*--([a-z-_]+)/ ) if ( $line =~ /[ \t]*--(?:\(no\))?([a-z-_]+)/ )
{ {
push @documented, $1 unless( $line =~ /NOP/i ); push @documented, $1 unless( $line =~ /NOP/i );
} }
@@ -120,6 +120,11 @@ sub testFile
{ {
$o = $1; $o = $1;
} }
#print " - remove negation : $o ";
#
# Discard any "!" at the end
#
$o =~ s/!//;
#print " - remove = : $o "; #print " - remove = : $o ";
# #
# Now avoid blank lines. # Now avoid blank lines.

View File

@@ -75,7 +75,9 @@ close( IMAGE );
# So we need to run the deletion script and verify the images # So we need to run the deletion script and verify the images
# are removed correctly. # are removed correctly.
# #
`perl -I./lib -I../lib ./bin/xen-delete-image --test --no-xen-ok --dir=$dir $hostname`; my $log = `perl -I./lib -I../lib ./bin/xen-delete-image --test --verbose --no-xen-ok --dir=$dir $hostname`;
ok ( $? == 0, 'Calling xen-delete-image returned exit code 0' );
print $log;
# #

View File

@@ -140,7 +140,7 @@ sub runCreateCommand
# #
# Create a temporary directory, and make sure it is present. # Create a temporary directory, and make sure it is present.
# #
my $dir = File::Temp::tempdir( CLEANUP => 0 ); my $dir = File::Temp::tempdir( CLEANUP => 1 );
ok ( -d $dir, "The temporary directory was created: $dir" ); ok ( -d $dir, "The temporary directory was created: $dir" );
# #
@@ -176,7 +176,7 @@ sub runCreateCommand
my @LINES = <OUTPUT>; my @LINES = <OUTPUT>;
close( OUTPUT ); close( OUTPUT );
return( join( "\n", @LINES ) ); return( join( "\n", @LINES ), $dir );
} }
@@ -193,7 +193,7 @@ sub testOutputContains
my ( $text, %params ) = ( @_ ); my ( $text, %params ) = ( @_ );
# Get the output of running the command. # Get the output of running the command.
my $output = runCreateCommand( %params ); my ($output, $dir) = runCreateCommand( %params );
# #
# Look to see if we got the text. # Look to see if we got the text.
@@ -220,7 +220,7 @@ sub noMentionOf
my ( $text, %params ) = ( @_ ); my ( $text, %params ) = ( @_ );
# Get the output of running the command. # Get the output of running the command.
my $output = runCreateCommand( %params ); my ($output, $dir) = runCreateCommand( %params );
# #
# Look to see if we got the text. # Look to see if we got the text.