Compare commits
17 Commits
lib-vs-sha
...
xen-tools-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07622d8ed0 | ||
|
|
081c0370d4 | ||
|
|
ea209f085b | ||
|
|
a70b79f63f | ||
|
|
c482220b99 | ||
|
|
dcd0bf09f1 | ||
|
|
92a825b87b | ||
|
|
6871954f6e | ||
|
|
e9d8bd0896 | ||
|
|
9369fd2a03 | ||
|
|
04dd81ec07 | ||
|
|
d39255dc5e | ||
|
|
5a48067d9e | ||
|
|
6fc51d20be | ||
|
|
16dbe870f2 | ||
|
|
cb3227d61b | ||
|
|
a89aa86511 |
@@ -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
|
||||
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
|
||||
--------------------------------------------
|
||||
|
||||
@@ -232,3 +239,9 @@ Axel's Break-Backwards-Compatibility Wishlist
|
||||
Maybe add some `--autostart` or such.
|
||||
|
||||
* 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
|
||||
|
||||
@@ -8,35 +8,49 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
|
||||
|
||||
=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 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:
|
||||
|
||||
--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
|
||||
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
|
||||
guest with the debootstrap tool. Accepted values:
|
||||
"yes" (default) and "no".
|
||||
|
||||
|
||||
--cachedir=/path/to/cache/directory
|
||||
Override the default .deb cache directory. Defaults to
|
||||
/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
|
||||
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.
|
||||
|
||||
@@ -57,61 +73,64 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
|
||||
installed. Specifying the path is optional.
|
||||
|
||||
--disk_device=diskname
|
||||
Use specified device name for virtual devices instead of
|
||||
the default value "xvda".
|
||||
Use specified device name for virtual devices instead
|
||||
of the default value "xvda".
|
||||
|
||||
--extension=ext
|
||||
Specify the suffix to give the Xen configuration
|
||||
file. (Default value: ".cfg")
|
||||
|
||||
--force Force overwriting existing images. This will remove
|
||||
existing images or LVM volumes which match those which
|
||||
are liable to be used by the new invocation.
|
||||
--(no)force (Don't) force overwriting existing images. This will
|
||||
remove existing images or LVM volumes which match
|
||||
those which are liable to be used by the new
|
||||
invocation.
|
||||
|
||||
--fs=fs Specify the filesystem type to use for the new guest.
|
||||
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
|
||||
Override the default password length of 8 and generate a
|
||||
random password of length N. Note: this only works in
|
||||
conjunction with --genpass
|
||||
Override the default password length of 8 and generate
|
||||
a random password of length N. Note: this only works
|
||||
in conjunction with --genpass
|
||||
|
||||
--hash_method=algorithm
|
||||
Override the default hashing method of sha256 and use the
|
||||
provided algorithm. Can be : md5, sha256 or sha512
|
||||
Override the default hashing method of sha256 and use
|
||||
the provided algorithm. Can be : md5, sha256 or sha512
|
||||
|
||||
--hooks=1 Specify whether to run hooks after the image is created.
|
||||
|
||||
--ide Use IDE names for virtual devices (i.e. hda not xvda)
|
||||
|
||||
--image=str Specify whether to create "sparse" or "full" disk images.
|
||||
Full images are mandatory when using LVM, so this setting
|
||||
is ignored in that case.
|
||||
--image=str Specify whether to create "sparse" or "full" disk
|
||||
images. Full images are mandatory when using LVM, so
|
||||
this setting is ignored in that case.
|
||||
|
||||
--image-dev=/path/to/device
|
||||
Specify a physical/logical volume for the disk image.
|
||||
|
||||
--initrd=/path/to/initrd
|
||||
Specify the initial ramdisk. If an image is specified it
|
||||
must exist.
|
||||
Specify the initial ramdisk. If an image is specified
|
||||
it must exist.
|
||||
|
||||
--install=1 Specify whether to install the guest system or not.
|
||||
|
||||
--keep Don't delete our images if installation fails. It maybe
|
||||
unmounted, though.
|
||||
--(no)keep (Don't) keep our images if installation fails. It
|
||||
maybe unmounted, though.
|
||||
|
||||
--kernel=/path/to/kernel
|
||||
Set the path to the kernel to use for domU. If a
|
||||
kernel is specified it must exist.
|
||||
|
||||
--memory=size
|
||||
Setup the amount of memory allocated to the new instance.
|
||||
As suffix recognized size units are "M", "MB", "G" and
|
||||
"GB" (case does not matter). If there's no unit given,
|
||||
megabytes are assumed.
|
||||
Setup the amount of memory allocated to the new
|
||||
instance. As suffix recognized size units are "M",
|
||||
"MB", "G" and "GB" (case does not matter). If there's
|
||||
no unit given, megabytes are assumed.
|
||||
|
||||
--modules=/path/to/modules
|
||||
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
|
||||
not running. (Needed for the testsuite.)
|
||||
|
||||
--output=dir Specify the output directory to create the xen configuration
|
||||
file within.
|
||||
|
||||
--output=dir Specify the output directory to create the xen
|
||||
configuration file within.
|
||||
|
||||
--partitions=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
|
||||
Set the root password for the new guest.
|
||||
|
||||
--passwd Ask for a root password interactively during setup.
|
||||
NOTE: This overrides --genpass --password
|
||||
--(no)passwd (Don't) ask for a root password interactively during
|
||||
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 scripts are discussed later in this manpage.
|
||||
Can be an absolute path. Otherwise it's relative to the
|
||||
value of --roledir.
|
||||
--role=role Run the specified role script(s) post-install. Role
|
||||
scripts are discussed later in this manpage. Can be
|
||||
an absolute path. Otherwise it's relative to the value
|
||||
of --roledir.
|
||||
|
||||
--role-args="--arg1 --arg2"
|
||||
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.
|
||||
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.
|
||||
@@ -184,20 +202,22 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
|
||||
beforehand.
|
||||
|
||||
--vcpus=num
|
||||
Set the number of vcpus that the new instance will have
|
||||
instead of the default value of "1".
|
||||
Set the number of vcpus that the new instance will
|
||||
have instead of the default value of "1".
|
||||
|
||||
|
||||
|
||||
Installation options:
|
||||
|
||||
--arch=arch Pass the given architecture to debootstrap, rinse,
|
||||
or rpmstrap when installing the system. This argument
|
||||
is ignored for other install methods.
|
||||
--arch=arch Pass the given architecture to debootstrap, rinse, or
|
||||
rpmstrap when installing the system. This argument is
|
||||
ignored for other install methods.
|
||||
|
||||
--dist=dist Specify the distribution you wish to install.
|
||||
|
||||
--install-method=method
|
||||
Specify the installation method to use. Valid methods are:
|
||||
Specify the installation method to use. Valid methods
|
||||
are:
|
||||
|
||||
* debootstrap
|
||||
* 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
|
||||
debootstrap. (Default value: mirror used in
|
||||
/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/")
|
||||
|
||||
The above mentioned Debian mirror hostname uses GeoIP
|
||||
to choose a more or less close Debian mirror. See
|
||||
http://wiki.debian.org/DebianGeoMirror for details.
|
||||
The above mentioned Debian mirror hostname
|
||||
automatically tries to choose a more or less close
|
||||
Debian mirror. See http://http.debian.net/ for
|
||||
details.
|
||||
|
||||
--apt_proxy=url
|
||||
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:
|
||||
|
||||
--bridge=brname
|
||||
Optionally, set a specific bridge for the new instance.
|
||||
This can be especially useful when running multiple
|
||||
bridges on a dom0.
|
||||
Optionally, set a specific bridge for the new
|
||||
instance. This can be especially useful when running
|
||||
multiple bridges on a dom0.
|
||||
|
||||
--broadcast=123.456.789.ABC
|
||||
Setup the broadcast address for the new instance.
|
||||
|
||||
--dhcp The guest will be configured to fetch its networking
|
||||
details via DHCP.
|
||||
--(no)dhcp The guest will (not) be configured to fetch its
|
||||
networking details via DHCP.
|
||||
|
||||
--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
|
||||
ones are added as aliases.
|
||||
|
||||
Note that Xen 3.x supports a maximum of three vif statements
|
||||
per guest. This option conflicts with --dhcp.
|
||||
Note that Xen 3.x supports a maximum of three vif
|
||||
statements per guest. This option conflicts with
|
||||
--dhcp.
|
||||
|
||||
--mac=AA:BB:CC:DD:EE:FF
|
||||
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"
|
||||
Setup the nameserver of the machine, multiple space
|
||||
separated nameservers are allowed.
|
||||
If not provided, Dom0's /etc/resolv.conf will be copied
|
||||
to guest.
|
||||
separated nameservers are allowed. If not provided,
|
||||
Dom0's /etc/resolv.conf will be copied to guest.
|
||||
|
||||
--vifname=vifname
|
||||
Optionally, set a specific vif name for the new instance.
|
||||
Optionally, set a specific vif name for the new
|
||||
instance.
|
||||
|
||||
|
||||
|
||||
Mandatory options:
|
||||
|
||||
--dir=/path/to/directory
|
||||
|
||||
Specify where the output images should go.
|
||||
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.)
|
||||
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.)
|
||||
|
||||
--evms=lvm2/container
|
||||
Specify the container to save images within, i.e. '--evms
|
||||
lvm2/mycontainer'. If you do not wish to use EVMS specify
|
||||
--dir or --lvm. (These three options are mutually exclusive.)
|
||||
Specify the container to save images within,
|
||||
i.e. '--evms lvm2/mycontainer'. If you do not wish to
|
||||
use EVMS specify --dir or --lvm. (These three options
|
||||
are mutually exclusive.)
|
||||
|
||||
--hostname=host.example.org
|
||||
Set the hostname of the new guest system. Ideally
|
||||
@@ -1422,8 +1449,8 @@ sub checkOption
|
||||
# Define argument types
|
||||
my %types = (
|
||||
integerWithSuffix => {
|
||||
check => qr/^[0-9.]+[GgMmKk]b?$/,
|
||||
message => "takes a suffixed integer.\n",
|
||||
check => qr/^[0-9.]+[GMk]B?$/i,
|
||||
message => "takes a suffixed (mb, MB, G, k, etc.) integer.\n",
|
||||
},
|
||||
distribution => {
|
||||
check => sub { -d "/usr/share/xen-tools/$_[0].d" },
|
||||
@@ -1614,14 +1641,14 @@ sub parseCommandLineArguments
|
||||
"disk_device=s", \&checkOption,
|
||||
|
||||
# Hosts options
|
||||
"nohosts", \$CONFIG{ 'nohosts' },
|
||||
"copyhosts", \$CONFIG{ 'copyhosts' },
|
||||
"nohosts", \$CONFIG{ 'nohosts' },
|
||||
"copyhosts!", \$CONFIG{ 'copyhosts' },
|
||||
# Deprecated legacy options for backwards compatibility
|
||||
"no-hosts", \$CONFIG{ 'nohosts' },
|
||||
"copy-hosts", \$CONFIG{ 'copyhosts' },
|
||||
"no-hosts", \$CONFIG{ 'nohosts' },
|
||||
"copy-hosts!", \$CONFIG{ 'copyhosts' },
|
||||
|
||||
# Networking options
|
||||
"dhcp", \$CONFIG{ 'dhcp' },
|
||||
"dhcp!", \$CONFIG{ 'dhcp' },
|
||||
"bridge=s", \&checkOption,
|
||||
"gateway=s", \&checkOption,
|
||||
"hostname=s", \&checkOption,
|
||||
@@ -1642,11 +1669,11 @@ sub parseCommandLineArguments
|
||||
"debootstrap-cmd=s", \$CONFIG{ 'debootstrap-cmd' },
|
||||
|
||||
# Misc. options
|
||||
"accounts", \$CONFIG{ 'accounts' },
|
||||
"accounts!", \$CONFIG{ 'accounts' },
|
||||
"admins=s", \&checkOption,
|
||||
"arch=s", \&checkOption,
|
||||
"fs=s", \&checkOption,
|
||||
"boot", \$CONFIG{ 'boot' },
|
||||
"boot!", \$CONFIG{ 'boot' },
|
||||
"cache=s", \&checkOption,
|
||||
"cachedir=s", \&checkOption,
|
||||
"config=s", \&checkOption,
|
||||
@@ -1654,8 +1681,8 @@ sub parseCommandLineArguments
|
||||
"scsi", \$CONFIG{ 'scsi' },
|
||||
"install=i", \&checkOption,
|
||||
"hooks=i", \&checkOption,
|
||||
"pygrub", \$CONFIG{ 'pygrub' },
|
||||
"passwd", \$CONFIG{ 'passwd' },
|
||||
"pygrub!", \$CONFIG{ 'pygrub' },
|
||||
"passwd!", \$CONFIG{ 'passwd' },
|
||||
"genpass=i", \&checkOption,
|
||||
"genpass-len=i", \&checkOption,
|
||||
"genpass_len=i", \&checkOption,
|
||||
@@ -1666,20 +1693,20 @@ sub parseCommandLineArguments
|
||||
"role-args=s", \&checkOption,
|
||||
"finalrole=s", \&checkOption,
|
||||
"roledir=s", \&checkOption,
|
||||
"force", \$CONFIG{ 'force' },
|
||||
"force!", \$CONFIG{ 'force' },
|
||||
"no-xen-ok", \$CONFIG{ 'no_xen_ok' },
|
||||
"keep", \$CONFIG{ 'keep' },
|
||||
"keep!", \$CONFIG{ 'keep' },
|
||||
"template=s", \&checkOption,
|
||||
"output=s", \&checkOption,
|
||||
"extension:s", \&checkOption,
|
||||
"dontformat", \&checkOption,
|
||||
|
||||
# Help options
|
||||
"debug", \$CONFIG{ 'debug' },
|
||||
"debug!", \$CONFIG{ 'debug' },
|
||||
"help", \$HELP,
|
||||
"manual", \$MANUAL,
|
||||
"dumpconfig", \$DUMPCONFIG,
|
||||
"verbose", \$CONFIG{ 'verbose' },
|
||||
"verbose!", \$CONFIG{ 'verbose' },
|
||||
"version", \$VERSION
|
||||
) )
|
||||
{
|
||||
|
||||
@@ -232,25 +232,17 @@ E_O_ROOT
|
||||
|
||||
#
|
||||
# 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 )
|
||||
{
|
||||
if ( $CONFIG{ 'no_xen_ok' } or !xenRunning($name, \%CONFIG) )
|
||||
{
|
||||
deleteXenImage($name);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Skipping xen guest '$name' - it appears to be running.\n";
|
||||
}
|
||||
|
||||
my @hosts = ();
|
||||
if (exists($CONFIG{ 'hostname' }) and defined($CONFIG{ 'hostname' })) {
|
||||
my $hostname_option = $CONFIG{ 'hostname' };
|
||||
@hosts = 'ARRAY' eq ref($hostname_option) ?
|
||||
@$hostname_option : $hostname_option;
|
||||
}
|
||||
|
||||
#
|
||||
# Also delete any which were specified using the --hostname flag
|
||||
#
|
||||
my $hosts = $CONFIG{ 'hostname' };
|
||||
foreach my $name (@$hosts)
|
||||
foreach my $name (@ARGV, @hosts)
|
||||
{
|
||||
my %PER_HOST_CONFIG = %CONFIG;
|
||||
$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' } ) )
|
||||
{
|
||||
my $prefix = $CONFIG{ 'dir' } . "/domains/";
|
||||
@@ -450,7 +443,7 @@ sub deleteXenImage
|
||||
print "Would remove LVM swap volume /dev/$CONFIG{'lvm'}/$hostname-swap\n";
|
||||
} else {
|
||||
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";
|
||||
} else {
|
||||
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";
|
||||
} else {
|
||||
print "Removing EVMS swap volume\n";
|
||||
runCommand("echo Delete : /dev/evms/$hostname-swap | evms", \%CONFIG);
|
||||
runCommand("echo Delete : $CONFIG{'evms'}/$hostname-swap | evms", \%CONFIG);
|
||||
runCommand("echo Delete : /dev/evms/$hostname-swap | evms", \%PER_HOST_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";
|
||||
} else {
|
||||
print "Removing EVMS disk volume\n";
|
||||
runCommand("echo Delete : /dev/evms/$hostname-disk | evms", \%CONFIG);
|
||||
runCommand("echo Delete : $CONFIG{'evms'}/$hostname-disk | evms", \%CONFIG);
|
||||
runCommand("echo Delete : /dev/evms/$hostname-disk | evms", \%PER_HOST_CONFIG);
|
||||
runCommand("echo Delete : $CONFIG{'evms'}/$hostname-disk | evms", \%PER_HOST_CONFIG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,13 +133,19 @@ my $RELEASE = '4.4~dev';
|
||||
# needDirectory Defined if we need an install-source directory specified.
|
||||
#
|
||||
#
|
||||
my $debootstrap_cmd;
|
||||
my %dispatch = (
|
||||
"copy" => { sub => \&do_copy,
|
||||
needBinary => "/bin/cp",
|
||||
needDirectory => 1,
|
||||
},
|
||||
"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,
|
||||
needBinary => "/usr/sbin/rinse",
|
||||
@@ -210,13 +216,35 @@ if ( defined( $CONFIG{ 'install-method' } ) &&
|
||||
#
|
||||
|
||||
# Do we need to test for a binary.
|
||||
if ( ( $installer->{ 'needBinary' } ) &&
|
||||
( !-x $installer->{ 'needBinary' } ) )
|
||||
{
|
||||
print
|
||||
"The following required binary for the installation was not found\n";
|
||||
print "\t" . $installer->{ 'needBinary' } . "\n";
|
||||
exit 1;
|
||||
if ( $installer->{ 'needBinary' } ) {
|
||||
if ( 'ARRAY' eq ref $installer->{ 'needBinary' } ) {
|
||||
unless (ref $installer->{ 'var' }) {
|
||||
die "Assertion: If dispatch->->needBinary is an array ref, dispatch->->var must exist";
|
||||
}
|
||||
|
||||
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?
|
||||
@@ -572,21 +600,9 @@ sub do_debootstrap
|
||||
# The command is a little configurable - mostly to allow you
|
||||
# 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' };
|
||||
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
|
||||
|
||||
7
debian/changelog
vendored
7
debian/changelog
vendored
@@ -9,6 +9,7 @@ xen-tools (4.4~dev-1) UNRELEASED; urgency=low
|
||||
- Execute END block not on --version/--help/--manual (Closes: #684346)
|
||||
- Move code for --boot feature to END block. Fixes missing SSH
|
||||
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.
|
||||
- Also recognize "M" and "G" instead of "MB" and "GB" as size unit for
|
||||
--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 xl toolstack
|
||||
- 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=…
|
||||
- Move examples from debian/examples to examples.
|
||||
- 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
|
||||
broken since 4.3~rc1-1) by merging 91-install-fs-tools back into
|
||||
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
|
||||
within Bash.
|
||||
- Fixes creation of "ARRAY(0x…).log" named log files.
|
||||
- Makes some options (like --pygrub) negatable.
|
||||
- Uses Test::NoTabs; add according build-dependency.
|
||||
* Add debian/gbp.conf to be able to to build xen-tools with
|
||||
git-buildpackage.
|
||||
|
||||
@@ -125,13 +125,14 @@ install-method = debootstrap
|
||||
# Disk and Sizing options.
|
||||
##
|
||||
#
|
||||
size = 4Gb # Disk image size.
|
||||
memory = 128Mb # Memory size
|
||||
swap = 128Mb # Swap size
|
||||
# noswap = 1 # Don't use swap at all for the new system.
|
||||
fs = ext3 # use the EXT3 filesystem for the disk image.
|
||||
dist = `xt-guess-suite-and-mirror --suite` # Default distribution to install.
|
||||
image = sparse # Specify sparse vs. full disk images.
|
||||
size = 4G # Root disk, suffix (G, M, k) required
|
||||
memory = 128M # Suffix (G, M, k) required
|
||||
swap = 128M # Suffix (G, M, k) required
|
||||
# noswap = 1 # Don't use swap at all for new systems.
|
||||
fs = ext3 # Default file system for any disk
|
||||
dist = `xt-guess-suite-and-mirror --suite`
|
||||
# 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
|
||||
@@ -235,6 +236,13 @@ image = sparse # Specify sparse vs. full disk images.
|
||||
kernel = /boot/vmlinuz-`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.
|
||||
#
|
||||
|
||||
@@ -39,7 +39,7 @@ foreach my $key ( sort keys %OPTIONS )
|
||||
|
||||
foreach my $line ( @lines )
|
||||
{
|
||||
if ( $line =~ /--$key/ )
|
||||
if ( $line =~ /--(\(no\))?$key/ )
|
||||
{
|
||||
$found = 1;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ sub testFile
|
||||
|
||||
foreach my $line ( split( /\n/, $output ) )
|
||||
{
|
||||
if ( $line =~ /[ \t]*--([a-z-_]+)/ )
|
||||
if ( $line =~ /[ \t]*--(?:\(no\))?([a-z-_]+)/ )
|
||||
{
|
||||
push @documented, $1 unless( $line =~ /NOP/i );
|
||||
}
|
||||
@@ -120,6 +120,11 @@ sub testFile
|
||||
{
|
||||
$o = $1;
|
||||
}
|
||||
#print " - remove negation : $o ";
|
||||
#
|
||||
# Discard any "!" at the end
|
||||
#
|
||||
$o =~ s/!//;
|
||||
#print " - remove = : $o ";
|
||||
#
|
||||
# Now avoid blank lines.
|
||||
|
||||
@@ -75,7 +75,9 @@ close( IMAGE );
|
||||
# So we need to run the deletion script and verify the images
|
||||
# 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;
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -140,7 +140,7 @@ sub runCreateCommand
|
||||
#
|
||||
# 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" );
|
||||
|
||||
#
|
||||
@@ -176,7 +176,7 @@ sub runCreateCommand
|
||||
my @LINES = <OUTPUT>;
|
||||
close( OUTPUT );
|
||||
|
||||
return( join( "\n", @LINES ) );
|
||||
return( join( "\n", @LINES ), $dir );
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ sub testOutputContains
|
||||
my ( $text, %params ) = ( @_ );
|
||||
|
||||
# Get the output of running the command.
|
||||
my $output = runCreateCommand( %params );
|
||||
my ($output, $dir) = runCreateCommand( %params );
|
||||
|
||||
#
|
||||
# Look to see if we got the text.
|
||||
@@ -220,7 +220,7 @@ sub noMentionOf
|
||||
my ( $text, %params ) = ( @_ );
|
||||
|
||||
# Get the output of running the command.
|
||||
my $output = runCreateCommand( %params );
|
||||
my ($output, $dir) = runCreateCommand( %params );
|
||||
|
||||
#
|
||||
# Look to see if we got the text.
|
||||
|
||||
Reference in New Issue
Block a user