1
0
mirror of synced 2026-02-22 14:47:18 +00:00

Compare commits

..

67 Commits

Author SHA1 Message Date
Axel Beckert
459f418f12 No more specific milestones in KNOWN_BUGS 2012-12-13 14:49:06 +01:00
Axel Beckert
448a176e58 Bump version to 4.4~dev 2012-11-28 01:28:48 +01:00
Axel Beckert
0a7544c57a Replace some verbose print()s by logprint_with_config() 2012-11-28 01:10:58 +01:00
Axel Beckert
4830ce8b8a TODO: Unify --debug and --dumpconfig 2012-11-28 01:10:09 +01:00
Axel Beckert
00b316a2c4 Call findXenToolstack() also in xen-{delete,resize,update}-image 2012-11-28 01:09:24 +01:00
Axel Beckert
1efbc72676 Add --no-xen-ok option also to xen-create-image 2012-11-28 01:09:23 +01:00
Axel Beckert
8bd56bd67e Bugfix: Can't pass @_ to templated functions which expect scalars 2012-11-28 00:52:20 +01:00
Axel Beckert
ab9b033068 Fix some whitespace issues in t/argument-check.t 2012-11-28 00:04:25 +01:00
Axel Beckert
16dd2d9f2f Use done_testing instead of no_plan 2012-11-28 00:04:07 +01:00
Axel Beckert
00bb137012 New xen-delete-image option --no-xen-ok for disabling xenRunning tests 2012-11-27 23:53:03 +01:00
Axel Beckert
4c3e4abff7 Move findBinary to Xen::Tools::Common 2012-11-27 23:43:06 +01:00
Axel Beckert
6b64dcc122 Call scripts in tests with local library paths 2012-11-27 23:39:49 +01:00
Axel Beckert
9a9fa39f69 Make t/pod-coverage.t pass for Xen::Tools::Common 2012-11-27 23:38:26 +01:00
Axel Beckert
ffa0ac5681 Fix some logprint() calls with multiple arguments 2012-11-27 23:37:46 +01:00
Axel Beckert
b5499e48b4 Define fail() and logprint() helpers as early as necessary 2012-11-27 23:37:09 +01:00
Axel Beckert
2d79f13714 All runCommand() calls should pass %CONFIG 2012-11-27 23:31:21 +01:00
Axel Beckert
de9d3f2814 Replace one more die by fail 2012-11-27 23:30:07 +01:00
Axel Beckert
9da26382f4 Fix missing trailing semicolon 2012-11-27 23:30:07 +01:00
Axel Beckert
85f7d1b9fe Consequently use $CONFIG{FAIL} instead of $FAIL 2012-11-27 23:30:07 +01:00
Axel Beckert
d2f935b823 Make fail(), logprint() and logonly() get \%CONFIG, too 2012-11-27 23:29:59 +01:00
Axel Beckert
68d548ef60 Parameter templates for fail(), logprint() and logonly() 2012-11-27 23:04:45 +01:00
Axel Beckert
ea23c79431 Support Xen xl toolstack elsewhere than xen-create-image 2012-11-27 22:49:56 +01:00
Axel Beckert
76fbd23423 Move findXenToolstack() to Xen::Tools::Common 2012-11-27 22:48:37 +01:00
Axel Beckert
494ec02a7c Merge branch 'master' into code-deduplication
Conflicts:
	bin/xen-create-image
	bin/xen-create-nfs
	bin/xt-create-xen-config
2012-11-27 22:40:08 +01:00
Axel Beckert
83eede665c Fix warning about no_plan usage in t/hook-inittab.t 2012-11-27 22:29:04 +01:00
Axel Beckert
8f1f298551 New option to dump contents of %CONFIG
Probably only needed for debugging.
2012-11-27 22:28:38 +01:00
Axel Beckert
e57e7f16eb Preliminary support for the Xen xl toolstack
(xen-create-image supported only so far)
2012-11-27 22:26:30 +01:00
Axel Beckert
b54d5b84f9 Refactoring: Replace $options with $option as it contains just one option 2012-11-27 18:26:47 +01:00
Axel Beckert
b99ca853e1 Replace system() by runCommand() 2012-11-27 16:01:27 +01:00
Axel Beckert
e7b710d43a No more refer to forking in the comments 2012-11-27 13:24:33 +01:00
Axel Beckert
6f2814f414 Merge branch 'master' into code-deduplication
Conflicts:
	bin/xen-create-image
2012-11-27 13:22:34 +01:00
Axel Beckert
874d1fcfb0 No more mention xm bash-completion file. It has been removed. 2012-11-27 13:13:14 +01:00
Axel Beckert
814adbd85a Fix typo in README 2012-11-22 20:49:00 +01:00
Axel Beckert
74ef51eb26 Fix even more Markdown indenting 2012-11-15 20:09:37 +01:00
Axel Beckert
ff4620c39a Fix some Markdown indenting 2012-11-15 20:06:22 +01:00
Axel Beckert
bac1d6c63b Use .markdown instead of .mdwn as GitHub doesn't recognize the latter 2012-11-15 18:38:26 +01:00
Axel Beckert
0842ddd128 Converting a first bunch of documentation to Markdown format 2012-11-15 18:29:38 +01:00
Axel Beckert
026e47ac83 Preliminary support for Debian Jessie and Ubuntu Raring
Also set the default mirror for Ubuntu Natty to
old-releases.ubuntu.com as it's end of life and will move there soon.
2012-11-15 16:55:10 +01:00
Axel Beckert
b116f1cca7 Update contact information in SUPPORT 2012-11-14 00:18:26 +01:00
Axel Beckert
a87b0d1b2c Remove CVS revisions from --version output 2012-11-14 00:02:54 +01:00
Axel Beckert
80edc04573 Merge branch 'master' of github.com:xtaran/xen-tools
Conflicts:
	debian/changelog
2012-11-13 23:38:30 +01:00
Axel Beckert
3b7750e9a9 Also suppport elevator=noop for pygrub 2012-11-13 23:35:20 +01:00
Axel Beckert
a7cc86c567 Default DomUs to use the noop scheduler (Closes: #693131) 2012-11-13 23:10:04 +01:00
Axel Beckert
442021849d Also recognize M and G as size unit for --memory (Closes: #691320)
Document all recognized units.
2012-11-13 22:55:53 +01:00
Axel Beckert
446e157b80 Move code for --boot feature to END block.
Fixes missing SSH fingerprint display if --boot was used. (Closes: #679183)

Remove a redundant unsetting of $MOUNT_POINT. Guard a potentially
second call to the not idempotent unMountImage().
2012-11-13 22:41:47 +01:00
Axel Beckert
1dbb1f191f Use local parameter instead of global variable in unMountImage 2012-11-13 22:29:46 +01:00
Axel Beckert
adca82e808 2 new TODOs: Remove CVS keywords, uncouple auto-start from --boot 2012-11-13 20:45:50 +01:00
Axel Beckert
324fff9f7e Execute END block not on --version/--help/--manual (Closes: #684346) 2012-11-13 19:47:36 +01:00
Axel Beckert
7b908a4069 Fix symbolic link hooks/centos-6/15-setup-arch (Closes: #690299) 2012-11-13 18:16:02 +01:00
Axel Beckert
b233cb614d Bump version to 4.3.1+dev 2012-11-13 18:07:42 +01:00
Axel Beckert
8523d76c14 Document ideas about authorized_keys 2012-10-26 15:14:38 +02:00
Axel Beckert
35477c6172 Install upstream ChangeLog only if it exists.
The upstream changelog is generated during the upstream release
process, but expected when building the binary .debs. Make its
inclusion optional in the binary .debs.
2012-08-13 00:37:41 +02:00
Axel Beckert
b692dbbe75 Add forgotten section header in gbp.conf 2012-08-12 19:49:05 +02:00
Axel Beckert
26b4c1ed90 Add debian/gbp.conf for git-buildpackage support 2012-08-12 19:44:36 +02:00
Axel Beckert
f58a9faa6a Merge branch 'master' into code-deduplication 2012-05-31 01:29:11 +02:00
Axel Beckert
b1476676fe Xen::Tools::Common should return true 2012-05-31 01:21:35 +02:00
Axel Beckert
a23f31077a Call commands in tests with proper search path for perl modules 2012-05-31 01:19:23 +02:00
Axel Beckert
34ccb63f64 Move functions fail, logonly and logprint to Xen::Tools::Common
They're used in there
2012-05-31 01:10:14 +02:00
Axel Beckert
ed91f1fc43 Merge branch 'master' into code-deduplication
Conflicts:
	bin/xen-create-image
2012-05-31 01:07:59 +02:00
Axel Beckert
65d76b6aa4 Deduplicate setupAdminUsers 2011-11-16 01:44:11 +01:00
Axel Beckert
0f71f545df deduplicate runCommand()
Version taken from xen-create-image. Needed a small hack WRT $FAIL.
2011-11-16 01:34:23 +01:00
Axel Beckert
2de01d8cbc deduplicate xenRunning() 2011-11-16 01:10:51 +01:00
Axel Beckert
1d45cd33ab Use function prototypes in Xen::Tools::Common 2011-11-16 01:02:01 +01:00
Axel Beckert
eabb327786 Remove all occurrences of 'sub readConfigurationFile' in bin/.
Use the version from Xen::Tools::Common instead
2011-11-16 00:55:12 +01:00
Axel Beckert
8835b9134b Add lib to Perl search path in t/perl-syntax.t 2011-11-16 00:47:57 +01:00
Axel Beckert
fec2114caf Merge branch 'master' into code-deduplication 2011-11-16 00:35:53 +01:00
Axel Beckert
24cd27b737 Create new Perl module Xen::Tools::Common, start with xen-create-nfs' readConfigurationFile function 2011-11-16 00:19:20 +01:00
55 changed files with 1316 additions and 1890 deletions

27
BUGS
View File

@@ -1,27 +0,0 @@
Reporting Bugs
--------------
To report a bug please use the xen-tools-discuss mailing list:
http://xen-tools.org/software/xen-tools/lists.html
If you're capable of fixing it yourself a patch is appreciated,
and a test case would be a useful bonus.
Known Bugs
----------
The Debian bug tracker contains a list of all currently
open issues which have been reported by the users of the Debian
package (the primary user-base):
http://bugs.debian.org/xen-tools
If you're running the code on a Debian host system then reporting
bugs against this package is a good thing to do; by doing so you
allow others to view issues, and I check the bug-page regularly.
Steve
--

23
BUGS.markdown Normal file
View File

@@ -0,0 +1,23 @@
Reporting Bugs
==============
To report a bug please use the [xen-tools-discuss* mailing
list](http://xen-tools.org/software/xen-tools/lists.html).
If you're capable of fixing it yourself a patch is appreciated, and a
test case would be a useful bonus.
Known Bugs
==========
The Debian bug tracker contains a [list of all currently open
issues](http://bugs.debian.org/xen-tools) which have been reported by
the users of the Debian package (the primary user-base).
If you're running the code on a Debian host system then reporting bugs
against this package is a good thing to do; by doing so you allow
others to view issues, and I check the bug-page regularly.
--
The Xen-Tools Developer Team

View File

@@ -1,46 +0,0 @@
KNOWN BUGS in xen-tools
Bugs to fix before a 4.3 release
--------------------------------
* xen-delete-image doesn't remove all logical volumes if --partitions is used.
See the link below for details how to reproduce. Reproducable at
least with --lvm. Thanks to Antoine Benkemoun for reporting.
http://xen-tools.org/pipermail/xen-tools-discuss/2010-May/000757.html
* xen-delete-image ignores extension setting
* partitions were mounted in config file order, not in mountpoint order.
That implies that if you specified :
/boot
/
in that order, / was mounted _over_ /boot, and you would not _see_ /boot.
Xen-Tools would then install boot on your / partition, and your boot device
was just empty and unbootable.
Workaround for 4.2 is to write your partition file such as mounts overlap
correctly when mounted in specified order.
Current (unreleased) fix is to sort by mountpoint length.
Fix would be to reproduce what mount does with mount -a.
* xen-create-image doesn't unmount the tempdir properly if /proc wasn't mounted inside
* xen-create-image says on startup summary that the Debian mirror is
used even if Ubuntu is going to be installed (and works)
* xen-list-images does not honour --extension
* --extension='' (i.e. empty string) no more works
Bugs to fix later
-----------------
t/xen-tools.t can't really test Xen::Tools as the latter requires a
local Xen installation. For proper testing, a dummy set of Xen
configuration files and configurable paths to them in Xen::Tools would
be necessary.

50
KNOWN_BUGS.markdown Normal file
View File

@@ -0,0 +1,50 @@
KNOWN BUGS in xen-tools
=======================
Bugs to fix rather soon
-----------------------
* `xen-delete-image` doesn't remove all logical volumes if `--partitions` is used.
See the link below for details how to reproduce. Reproducable at
least with `--lvm`. Thanks to Antoine Benkemoun for reporting.
[Bug Report](http://xen-tools.org/pipermail/xen-tools-discuss/2010-May/000757.html)
* `xen-delete-image` ignores extension setting
* partitions were mounted in config file order, not in mountpoint order.
That implies that if you specified :
/boot
/
in that order, `/` was mounted _over_ `/boot`, and you would not
_see_ `/boot`. Xen-Tools would then install `boot` on your `/`
partition, and your boot device was just empty and unbootable.
Workaround for 4.2 is to write your partition file such as mounts overlap
correctly when mounted in specified order.
Current (unreleased) fix is to sort by mountpoint length.
Fix would be to reproduce what mount does with mount `-a`.
* `xen-create-image` doesn't unmount the `tempdir` properly if `/proc`
wasn't mounted inside
* `xen-create-image` says on startup summary that the Debian mirror is
used even if Ubuntu is going to be installed (and works)
* `xen-list-images` does not honour `--extension`
* `--extension=''` (i.e. empty string) no more works
Bugs to fix later
-----------------
`t/xen-tools.t` can't really test Xen::Tools as the latter requires a
local Xen installation. For proper testing, a dummy set of Xen
configuration files and configurable paths to them in `Xen::Tools`
would be necessary.

View File

@@ -14,7 +14,7 @@
# #
TMP ?= /tmp TMP ?= /tmp
DIST_PREFIX = ${TMP} DIST_PREFIX = ${TMP}
VERSION = 4.3.1 VERSION = 4.4~dev
DEBVERSION = $(shell echo $(VERSION)|sed 's/\(rc\|pre\|beta\|alpha\)/~\1/') DEBVERSION = $(shell echo $(VERSION)|sed 's/\(rc\|pre\|beta\|alpha\)/~\1/')
BASE = xen-tools BASE = xen-tools
VCS = git VCS = git
@@ -173,6 +173,7 @@ install-hooks:
-cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d lenny.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d lenny.d
-cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d squeeze.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d squeeze.d
-cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d wheezy.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d wheezy.d
-cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d jessie.d
-cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d sid.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d sid.d
-cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d testing.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d testing.d
-cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d stable.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s debian.d stable.d
@@ -196,6 +197,7 @@ install-hooks:
-cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d oneiric.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d oneiric.d
-cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d precise.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d precise.d
-cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d quantal.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d quantal.d
-cd ${prefix}/usr/lib/xen-tools/ && ln -s karmic.d raring.d
cp hooks/common.sh ${prefix}/usr/lib/xen-tools cp hooks/common.sh ${prefix}/usr/lib/xen-tools
cp -r hooks/common ${prefix}/usr/lib/xen-tools cp -r hooks/common ${prefix}/usr/lib/xen-tools

173
README
View File

@@ -1,173 +0,0 @@
xen-tools
---------
Homepage:
http://www.xen-tools.org/software/xen-tools
Git Repository:
http://gitorious.org/xen-tools
Mailing Lists:
http://www.xen-tools.org/software/xen-tools/lists.html
About:
Xen-tools contains a collection of Perl scripts for working with Xen
guest images under Linux.
Using this software, you can easily create new Xen guests configured
to be accessible over the network via OpenSSH.
xen-tools currently has scripts to install most releases of Debian
(starting with 3.1 "Sarge") and Ubuntu (starting with 6.06 LTS
"Dapper") and some RPM-based distributions. On the Dom0 side all
current Xen supporting distributions should work.
However, currently only Debian and Ubuntu releases are tested and
known to work, i.e.:
Debian:
* Sarge 3.1 (i386 and DomU only)
* Etch 4.0 (Dom0 no more tested)
* Lenny 5.0
* Squeeze 6.0
* Wheezy 7.0
* Sid (works at least at the moment of writing :-)
Ubuntu (only DomUs tested):
* Dapper Drake 6.06
* Edgy Eft 6.10
* Feisty Fawn 7.04
* Gutsy Gibbon 7.10
* Hardy Heron 8.04 (see [1])
* Interpid Ibex 8.10
* Jaunty Jackaplope 9.04
* Karmic Koala 9.10
* Lucid Lynx 10.04
* 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)
CentOS (only DomUs tested, pygrub support incomplete):
* CentOS 5
* CentOS 6
[1] There is an issue with debootstrap on hardy not installing ksyslogd
This can be fixed by chrooting into the newly installed system
and removing the startup scripts. See:
http://www.linux-vserver.org/Installing_Ubuntu_8.04_Hardy_as_guest
Xen-Tools are available prepackaged in Debian and as source tar-ball
for local installation. Installing from source should work flawlessly
on most Linux systems that meet the installation requirements.
Requirements
------------
To use these tools you'll need the following software:
* debootstrap
* Perl
* The Perl module "Text::Template"
* The Perl module "Config::IniFiles"
- Both of these modules are available as Debian packages,
or direct from http://www.cpan.org/ for non-Debian distributions.
* Make, if you are not installing through a package manager
You can try to install RPM-based distributions such as CentOS, or
Fedora Core, but you will need a correctly installed and configured
"rinse" package. This is currently not supported.
If you wish to create new Xen instances which may be controlled by
users via a login shell you can have a look at the (currently
unmaintained) xen-shell package which is available from:
http://xen-tools.org/software/xen-shell/
Installation
------------
As root or with sudo, execute "make install".
See debian/README.source how to build the Debian package from a
checked out copy of the git repository (i.e. without a source tar
ball).
The Scripts
-----------
Here is a brief description of each included script, for more
thorough documentation please consult the appropriate man page.
xen-create-image
----------------
This script is designed to create new images which may be used
with the Xen hypervisor.
This script performs the initial setup, then delegates the real
work to a collection of helper scripts:
* xt-install-image
Installs a distribution into a directory.
* xt-customize-image
Run a collection of hook scripts to configure the freshly
installed system.
* xt-create-xen-config
Create a configuration file in /etc/xen such that Xen can
boot the newly created machine.
* xt-guess-suite-and-mirror
In case of a Debian or Ubuntu Dom0, this script tries to guess
the most suitable suite and mirror for DomUs based on the Dom0's
/etc/apt/sources.list.
xen-create-nfs
--------------
This script is similar in spirit to xen-create-image, but much
less complex. It allows the creation of Xen guests which are
diskless, mounting their root filesystem over a remote NFS-share.
There are not many options to tweak, but still a useful addition
to the suite.
xen-delete-image
----------------
This script will allow you to completely remove Xen instances
which have previously been created by xen-create-image, this
includes removing the storage block devices from the system,
and deleting the Xen configuration file.
xen-list-images
---------------
List all the created images beneath a given root directory along
with a brief overview of their setup details.
xen-update-image
----------------
This script runs "apt-get update; apt-get upgrade" for a given
Xen image.
NOTES:
* The image should not be running or corruption will occur!
* The script should only be used for Xen instances of Debian or
a Debian-derived distribution.
--
The Xen-Tools Developer Team

178
README.markdown Normal file
View File

@@ -0,0 +1,178 @@
xen-tools
=========
* [Homepage](http://www.xen-tools.org/software/xen-tools)
* Git Repository:
* [at Gitorious](http://gitorious.org/xen-tools)
* [at GitHub](http://github.com/xtaran/xen-tools)
* [Mailing Lists](http://www.xen-tools.org/software/xen-tools/lists.html)
About
-----
xen-tools contains a collection of Perl scripts for working with Xen
guest images under Linux.
Using this software, you can easily create new
[Xen](http://www.xen.org) guests configured to be accessible over the
network via [OpenSSH](http://www.openssh.org/).
xen-tools currently has scripts to install most releases of
[Debian](http://www.debian.org/) (starting with 3.1 "Sarge") and
[Ubuntu](http://www.ubuntu.com/) (starting with 6.06 LTS "Dapper") and
some RPM-based distributions. On the Dom0 side all current Xen
supporting distributions should work.
However, currently only Debian and Ubuntu releases are tested and
known to work reliably, i.e.:
### Debian
* Sarge 3.1 (i386 and DomU only)
* Etch 4.0 (Dom0 no more tested)
* Lenny 5.0
* Squeeze 6.0
* Wheezy 7.0
* Jessie 8.0 (preliminary support as it's not yet available)
* Sid (works at least at the moment of writing :-)
### Ubuntu
(only DomUs tested)
* Dapper Drake 6.06
* Edgy Eft 6.10
* Feisty Fawn 7.04
* Gutsy Gibbon 7.10
* Hardy Heron 8.04 (see [1][])
* Interpid Ibex 8.10
* Jaunty Jackaplope 9.04
* Karmic Koala 9.10
* Lucid Lynx 10.04
* Maverick Meerkat 10.10
* Natty Narwhal 11.04
* Oneiric Ocelot 11.10
* Precise Pangolin 12.04
* Quantal Quetzal 12.10
* Raring Ringtail 13.04 (preliminary support as it's not yet available)
[1]: http://www.linux-vserver.org/Installing_Ubuntu_8.04_Hardy_as_guest
"There is an issue with debootstrap on hardy not installing ksyslogd
This can be fixed by chrooting into the newly installed system and
removing the startup scripts."
### CentOS
(only DomUs tested, pygrub support incomplete)
* CentOS 5
* CentOS 6
Packages
--------
xen-tools are available prepackaged in Debian (and derivates) and as
source tar-ball for local installation. Installing from source should
work flawlessly on most Linux systems that meet the installation
requirements.
Requirements
------------
To use these tools you'll need the following software:
* [debootstrap](http://packages.debian.org/debootstrap)
* Perl
* The Perl module [Text::Template](http://search.cpan.org/dist/Text-Template/)
([Debian Package libtext-template-perl](http://packages.debian.org/libtext-template-perl))
* The Perl module [Config::IniFiles](http://search.cpan.org/dist/Config-IniFiles/)
([Debian Package libconfig-inifiles-perl](http://packages.debian.org/libconfig-inifiles-perl))
* Make, if you are not installing through a package manager
You can try to install RPM-based distributions such as CentOS, or
Fedora Core, but you will need a correctly installed and configured
[rinse](http://packages.debian.org/rinse) package. This is currently
not fully supported.
If you wish to create new Xen instances which may be controlled by
users via a login shell you can have a look at the (currently
unmaintained) [xen-shell](http://xen-tools.org/software/xen-shell/)
project.
Installation
------------
As root or with sudo, execute `make instal`.
See `debian/README.source` how to build the Debian package from a
checked out copy of the git repository (i.e. without a source tar
ball).
The Scripts
-----------
Here is a brief description of each included script, for more thorough
documentation please consult the appropriate man page.
### xen-create-image
This script is designed to create new images which may be used
with the Xen hypervisor.
This script performs the initial setup, then delegates the real
work to a collection of helper scripts:
* `xt-install-image`: Installs a distribution into a directory.
* `xt-customize-image`: Run a collection of hook scripts to configure
the freshly installed system.
* `xt-create-xen-config`: Create a configuration file in `/etc/xen`
such that Xen can boot the newly created machine.
* `xt-guess-suite-and-mirror`: In case of a Debian or Ubuntu Dom0,
this script tries to guess the most suitable suite and mirror for
DomUs based on the Dom0's `/etc/apt/sources.list`.
### xen-create-nfs
This script is similar in spirit to `xen-create-image`, but much less
complex. It allows the creation of Xen guests which are diskless,
mounting their root filesystem over a remote NFS-share.
There are not many options to tweak, but still a useful addition
to the suite.
### xen-delete-image
This script will allow you to completely remove Xen instances which
have previously been created by `xen-create-image`, this includes
removing the storage block devices from the system, and deleting the
Xen configuration file.
### xen-list-images
List all the created images beneath a given root directory along with
a brief overview of their setup details.
### xen-update-image
This script runs "apt-get update; apt-get upgrade" for a given Xen
image.
#### NOTES
* The image should not be running or corruption will occur!
* The script should only be used for Xen instances of Debian or a
Debian-derived distribution.
--
The Xen-Tools Developer Team

42
SUPPORT
View File

@@ -1,42 +0,0 @@
Mailing List
------------
For assistance on using, or customising, these scripts please
consult the manpages initially, then the website:
http://xen-tools.org/software/xen-tools/
If these are not sufficient resources please consider posting
any queries you might have to the mailing list:
http://xen-tools.org/software/xen-tools/lists.html
Included with the release you should find the file "BUGS" which
contains some notes on reporting bugs.
Xen Queries
-----------
If your query is mostly related to Xen, rather than these tools,
then please consider joining the xen-users mailing list:
http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users
The members of that list are very good at diagnosing issues with
networking, block devices, and other Xen oddities.
Contact The Author
------------------
As a last resort feel free to contact the author at <steve@steve.org.uk>.
I say last resort not because I'm unwilling to help, but because
it will take longer for me to respond to you personally and I hate
answering the same question multiple times.
Steve
--

41
SUPPORT.markdown Normal file
View File

@@ -0,0 +1,41 @@
Mailing List
============
For assistance on using, or customising, these scripts please consult
the manpages initially, then the
[website](http://xen-tools.org/software/xen-tools/).
If these are not sufficient resources please consider posting any
queries you might have to the [mailing
list](http://xen-tools.org/software/xen-tools/lists.html)
Included with the release you should find the file `BUGS.markdown`
which contains some notes on reporting bugs.
Xen Queries
===========
If your query is mostly related to Xen, rather than these tools, then
please consider joining the [xen-users mailing
list](http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users)
The members of that list are very good at diagnosing issues with
networking, block devices, and other Xen oddities.
There's also the IRC channel `##xen` (the double hashmark is not a
typo) on the [Freenode](http://freenode.net/) IRC network.
Contact The Author
==================
As a last resort you can to contact the current maintainer, Axel
Beckert, at <abe@deuxchevaux.org>.
As the previous xen-tools maintainer and original author, Steve
Kemp, said, I say last resort not because I'm unwilling to help, but
because it may take longer for me to respond to you personally.
--
Axel

209
TODO
View File

@@ -1,209 +0,0 @@
TODO
====
See KNOWN_BUGS for real bugs.
Bugs to fix and features to add for 4.3
---------------------------------------
Refactor TLS disabling. Seems to be happen twice, once in 20-setup-apt
and once in 10-disable-tls.
Bugs to fix and features to add for 5.0
---------------------------------------
* xen-create-image man page overhaul:
- ambiguous option list with regards to parameters
- Set Fail in more situations where the script has clearly failed
i.e.: lvm exists
* Test and support more file system types.
Actually this should be pretty simple now that the parameters are
stored in the configuration hash.
* Setup locales in the hooks?
Currently no locales are set and this causes several domU errors
which appear in the domU's logs.
* Documentation overhaul
Better explain what roles /should be/ used for, and that roles
are examples, and shouldn't cover every single scenario. They
are also easy to write.
* Think again about disk_device checks :
Newer Xen provides "xvda", older provided "sda". The current check for
valid values of disk_device (used for root device in domU /etc/fstab)
does only allow those values.
This forbids any deployment of LVM/RAID _inside_ domU, which cannot
be created by xen-tools anyway. So the current check is fine with the
current possibilities of xen-tools, but could become a limitation.
- Is it possible/wanted to "query" xend for default device names ?
- Is it possible to create /dev/mapper devices with xend conf ?
- Can we just avoid to ask for this value and not specify the device
in /etc/fstab (and use /dev/root, /dev/by-uuid, or anything ?)
* xen-create-image --dist=... / sources.list generation should be more fine-grained
xen-tools should offer the possibility to enable/disable
security/volatile/backports as well as
contrib/non-free/universe/restricted/multiverse for each of them
not only based on defaults plus the Dom0's sources.list
One idea is to allow parameters like
--dist="lenny:main,contrib,non-free;security;volatile:main"
and maybe (if the default will be to include security) to also
allow
--dist="lenny;no-security"
The second idea (by Mathieu Parent) is to have an
/etc/xen-tools/sources.list.d/ which then contains files like
lenny.list, lenny-server.list, karmic.list, etc. which defaults to
$dist.list, but can be also select with --sources-list=lenny-server
(which looks for ./lenny-server.list, ./lenny-server,
/etc/xen-tools/sources.list.d/lenny-server.list and
/etc/xen-tools/sources.list.d/lenny-server in that order).
Third variant is to use /etc/xen-tools/sources.lists/ instead of
/etc/xen-tools/sources.list.d/ because that directory is no
runparts-like directory.
* LVM snapshot support as an install source.
* Clean up mounts on Ctrl-C, causes error while installing otherwise:
Removing /dev/vg0/acromantula-domu1-disk - since we're forcing the
install Can't remove open logical volume "acromantula-domu1-disk"
this should be a matter of unmounting the mounted volume from /tmp.
* Generic grub support
This will generate a much nicer menu.lst as a side effect, as its
currently generated once at install, and is never updated. Installing
a full grub into the domU should update the menu.lst every time a
new kernel is installed and will also use the domU distro's menu.lst
conform.
* pv-grub support
This is a ways away and will probably start with a xen-pv-grub
package.
* Move the hooks directory to /etc/xen-tools/ to officially allow
added and modified hooks.
* Clean up the hooks directory
We still have a link farm for hooks and a meta link farm for distro
releases created on "make install". It probably would be better if
we would just have one directory per distro (like with debian) but
without the need to created symlinks on "make install"
Currently CentOS's 25-setup-kernel creates an fstab and
90-make-fstab does again. It works, but that cries for debugging
hell.
centos-5/25-setup-kernel centos-6/25-setup-kernel still differ and
I'm not sure if that's necessary respectively what's the common
denominator.
80-install-kernel is not yet merged into one hook script.
Common oneliners for code deduplication in the hooks/ directory:
$ find -L . -not -xtype l -not -type d -not -path '*/common/*' | sort -t / -k3
$ fdupes -r1 . | sort -t / -k3
$ find . -type f | sim_text -ipTt 50 | tac | column -t
* Create users, add ssh pubkeys to .ssh/authorized_keys
Still have to think of a good way of doing this. It would be nice
To specify a directory of public keys, parsing the hostnames
parsing the usernames from the ssh comment line
* More generic roles
Deploy a web server or setup ssmtp directly via flag when setting up
the machine. Open to suggestions, should just be some general use-cases
that are fairly common.
* Sections for the xen-tools.conf file
Currently it's really annoying when you are trying to create VMs
on multiple subnets. It would be nice to specify with a flag what
"type" of configuration you want, and a set of options specific to
that flag could be parsed from xen-tools.conf
* Refactor the code for less variants of calling cp, rm, mv, etc.
E.g. always use either cp() from File::Copy or /bin/cp, but not
both. To allow verbose copying, I (Axel) would prefer /bin/cp over
cp();
* Parse numerical parameters transparently for the user
The user shouldn't have to know weather he should specify size
as <size>G or <size>Gb or <size>. This should be parsed without
user interaction and rely on a common format.
* xen-update-image should mount /dev/pts before running apt-get
* xen-update-image should have options for using ...
... aptitude instead of apt-get
... dist-upgrade instead of upgrade
* Support cpu_weight and other features from
http://wiki.xensource.com/xenwiki/CreditScheduler
* Code Deduplication / Refactor the code for less code duplication
bin/x* currently contain the same or similar code like e.g. in the
function readConfigurationFile. This needs to be cleaned up.
* Use Perl::Critic
Stuff from Steve's TODO list / Generic TODOs
--------------------------------------------
* Write more test cases.
* xen-delete-image should unallocate any used IP addresses.
Axel's Break-Backwards-Compatibility Wishlist
---------------------------------------------
* Make empty extension the default
This would ease tab completion and CLI parameter reusage with "xm
create" and friends.
* Check if we can reduce MAKEDEV invocations in hooks/common/55-create-dev
MAKEDEV std is called in any case. First comment says "Early
termination if we have a couple of common devices present should
speed up installs which use --copy/--tar" and then "We still need
to make sure the basic devices are present" and calls MAKEDEV more
often than otherwise.
Additionally the 55-create-dev for CentOS/Fedora just created
console, zero and null. zero and null are part of "MAKEDEV std",
perhaps can we reduce it to that. console is part of "MAKEDEV
generic".
Additionally the devices hda, sda and tty1 may not necessary in any
case, but instead hvc0 should be created for sure in many
cases. Nothing cares about $serial_device there either.
Current MAKEDEV implementation support more than one device as
parameter. That could reduce the MAKEDEV calls from currently six
to two.

225
TODO.markdown Normal file
View File

@@ -0,0 +1,225 @@
TODO
====
See KNOWN_BUGS.markdown for real bugs.
Bugs to fix and features to add for 4.3
---------------------------------------
Refactor TLS disabling. Seems to be happen twice, once in 20-setup-apt
and once in 10-disable-tls.
Bugs to fix and features to add for 5.0
---------------------------------------
* `xen-create-image` man page overhaul:
* ambiguous option list with regards to parameters
* Set Fail in more situations where the script has clearly failed
i.e.: lvm exists
* Test and support more file system types.
Actually this should be pretty simple now that the parameters are
stored in the configuration hash.
* Setup locales in the hooks?
Currently no locales are set and this causes several domU errors
which appear in the domU's logs.
* Documentation overhaul
Better explain what roles /should be/ used for, and that roles
are examples, and shouldn't cover every single scenario. They
are also easy to write.
* Think again about disk_device checks :
Newer Xen provides `xvda`, older provided `sda`. The current check for
valid values of `disk_device` (used for root device in DomU `/etc/fstab`)
does only allow those values.
This forbids any deployment of LVM/RAID _inside_ DomU, which cannot
be created by xen-tools anyway. So the current check is fine with the
current possibilities of xen-tools, but could become a limitation.
* Is it possible/wanted to "query" xend for default device names?
* Is it possible to create `/dev/mapper` devices with xend conf?
* Can we just avoid to ask for this value and not specify the device
in `/etc/fstab` (and use `/dev/root`, `/dev/by-uuid`, or anything?)
* `xen-create-image --dist=…` / sources.list generation should be more fine-grained
xen-tools should offer the possibility to enable/disable
security/volatile/backports as well as
contrib/non-free/universe/restricted/multiverse for each of them not
only based on defaults plus the Dom0's sources.list
One idea is to allow parameters like
--dist="lenny:main,contrib,non-free;security;volatile:main"
and maybe (if the default will be to include security) to also
allow
--dist="lenny;no-security"
The second idea (by Mathieu Parent) is to have an
`/etc/xen-tools/sources.list.d/` which then contains files like
`lenny.list`, `lenny-server.list`, `karmic.list`, etc. which
defaults to `$dist.list`, but can be also select with
`--sources-list=lenny-server` (which looks for
`./lenny-server.list`, `./lenny-server`,
`/etc/xen-tools/sources.list.d/lenny-server.list` and
`/etc/xen-tools/sources.list.d/lenny-server` in that order).
Third variant is to use `/etc/xen-tools/sources.lists/` instead of
`/etc/xen-tools/sources.list.d/` because that directory is no
runparts-like directory.
* LVM snapshot support as an install source.
* Clean up mounts on `Ctrl-C`, causes error while installing otherwise:
Removing /dev/vg0/acromantula-domu1-disk - since we're forcing the
install Can't remove open logical volume "acromantula-domu1-disk"
this should be a matter of unmounting the mounted volume from /tmp.
* Generic grub support
This will generate a much nicer `menu.lst` as a side effect, as its
currently generated once at install, and is never updated. Installing
a full grub into the domU should update the `menu.lst` every time a
new kernel is installed and will also use the domU distro's `menu.lst`
conform.
* pv-grub support
This is a ways away and will probably start with a `xen-pv-grub`
package.
* Move the hooks directory to `/etc/xen-tools/` to officially allow
added and modified hooks.
* Clean up the hooks directory
We still have a link farm for hooks and a meta link farm for distro
releases created on `make install`. It probably would be better if
we would just have one directory per distro (like with debian) but
without the need to created symlinks on `make install`.
Currently CentOS's `25-setup-kernel` creates an fstab and
`90-make-fstab` does again. It works, but that cries for debugging
hell.
`centos-5/25-setup-kernel` and `centos-6/25-setup-kernel` still
differ and I'm not sure if that's necessary respectively what's the
common denominator.
`80-install-kernel` is not yet merged into one hook script.
Common oneliners for code deduplication in the hooks/ directory:
$ find -L . -not -xtype l -not -type d -not -path '*/common/*' | sort -t / -k3
$ fdupes -r1 . | sort -t / -k3
$ find . -type f | sim_text -ipTt 50 | tac | column -t
* Create users, add ssh pubkeys to `.ssh/authorized_keys`
Still have to think of a good way of doing this. It would be nice
To specify a directory of public keys, parsing the hostnames
parsing the usernames from the ssh comment line.
Potential ideas are to add options to add a given file as
`authorized_keys` (e.g. a users public key) or to just add the Dom0's
`/root/.ssh/authorized_keys` as the DomU's one.
* More generic roles
Deploy a web server or setup ssmtp directly via flag when setting up
the machine. Open to suggestions, should just be some general use-cases
that are fairly common.
* Sections for the xen-tools.conf file
Currently it's really annoying when you are trying to create VMs
on multiple subnets. It would be nice to specify with a flag what
"type" of configuration you want, and a set of options specific to
that flag could be parsed from xen-tools.conf
* Refactor the code for less variants of calling `cp`, `rm`, `mv`, etc.
E.g. always use either `cp()` from `File::Copy` or `/bin/cp`, but
not both. To allow verbose copying, I (Axel) would prefer `/bin/cp`
over `cp();`.
* Parse numerical parameters transparently for the user
The user shouldn't have to know whether he should specify size as
`<size>G` or `<size>Gb` or `<size>`. This should be parsed without
user interaction and rely on a common format.
* `xen-update-image` should mount `/dev/pts` before running apt-get
* `xen-update-image` should have options for using …
* aptitude instead of apt-get
* dist-upgrade instead of upgrade
* Support `cpu_weight` and other features from
http://wiki.xensource.com/xenwiki/CreditScheduler
* Make used Xen toolstack configurable, i.e. via --xen-toolstack=xl
* Code Deduplication / Refactor the code for less code duplication
`bin/x*` currently contain the same or similar code like e.g. in the
function readConfigurationFile. This needs to be cleaned up.
* Unify --debug and --dumpconfig. Likely make --debug exit
gracefully. Document --debug if --dumpconfig is removed.
* Use `Perl::Critic`
Stuff from Steve's TODO list / Generic TODOs
--------------------------------------------
* Write more test cases.
* `xen-delete-image` should unallocate any used IP addresses.
Axel's Break-Backwards-Compatibility Wishlist
---------------------------------------------
* Make empty extension the default
This would ease tab completion and CLI parameter reusage with "xm
create" and friends.
* Check if we can reduce `MAKEDEV` invocations in
`hooks/common/55-create-dev`
`MAKEDEV std` is called in any case. First comment says "Early
termination if we have a couple of common devices present should
speed up installs which use `--copy`/`--tar`" and then "We still
need to make sure the basic devices are present" and calls `MAKEDEV`
more often than otherwise.
Additionally the `55-create-dev` for CentOS/Fedora just created
`console`, `zero` and `null`. `zero` and `null` are part of `MAKEDEV
std`, perhaps can we reduce it to that. `console` is part of
`MAKEDEV generic`.
Additionally the devices `hda`, `sda` and `tty1` may not necessary
in any case, but instead `hvc0` should be created for sure in many
cases. Nothing cares about `$serial_device` there either.
Current `MAKEDEV` implementation support more than one device as
parameter. That could reduce the `MAKEDEV` calls from currently six
to two.
* Uncouple generating auto start symlinks from `--boot`.
Maybe add some `--autostart` or such.
* Maybe replace findBinary with File::Which

File diff suppressed because it is too large Load Diff

View File

@@ -112,7 +112,7 @@ use Env;
use Getopt::Long; use Getopt::Long;
use Pod::Usage; use Pod::Usage;
use Text::Template; use Text::Template;
use Xen::Tools::Common;
# #
@@ -131,7 +131,7 @@ $CONFIG{ 'template' } = '/etc/xen-tools/xm-nfs.tmpl';
# #
# Release number. # Release number.
# #
my $RELEASE = '4.3.1'; my $RELEASE = '4.4~dev';
# store version number away. # store version number away.
@@ -141,7 +141,7 @@ $CONFIG{ 'xen_tools_version' } = $RELEASE;
# #
# Read the global configuration file. # Read the global configuration file.
# #
readConfigurationFile("/etc/xen-tools/xen-tools.conf"); readConfigurationFile("/etc/xen-tools/xen-tools.conf", \%CONFIG);
# #
@@ -170,7 +170,7 @@ if ( -e "/etc/xen/$CONFIG{'hostname'}.cfg" )
# #
if ( $CONFIG{ 'admins' } ) if ( $CONFIG{ 'admins' } )
{ {
setupAdminUsers(); setupAdminUsers(\%CONFIG);
} }
# #
@@ -186,88 +186,6 @@ createNewConfigurationFile();
exit; exit;
=begin doc
Read the specified configuration file, and update our global configuration
hash with the values found in it.
=end doc
=cut
sub readConfigurationFile
{
my ($file) = (@_);
# Don't read the file if it doesn't exist.
return if ( !-e $file );
my $line = "";
open( FILE, "<", $file ) or die "Cannot read file '$file' - $!";
while ( defined( $line = <FILE> ) )
{
chomp $line;
if ( $line =~ s/\\$// )
{
$line .= <FILE>;
redo unless eof(FILE);
}
# Skip lines beginning with comments
next if ( $line =~ /^([ \t]*)\#/ );
# Skip blank lines
next if ( length($line) < 1 );
# Strip trailing comments.
if ( $line =~ /(.*)\#(.*)/ )
{
$line = $1;
}
# Find variable settings
if ( $line =~ /([^=]+)=([^\n]+)/ )
{
my $key = $1;
my $val = $2;
# Strip leading and trailing whitespace.
$key =~ s/^\s+//;
$key =~ s/\s+$//;
$val =~ s/^\s+//;
$val =~ s/\s+$//;
# command expansion?
if ( $val =~ /(.*)`([^`]+)`(.*)/ )
{
# store
my $pre = $1;
my $cmd = $2;
my $post = $3;
# get output
my $output = `$cmd`;
chomp($output);
# build up replacement.
$val = $pre . $output . $post;
}
# Store value.
$CONFIG{ $key } = $val;
}
}
close(FILE);
}
=begin doc =begin doc
Parse the command line arguments this script was given. Parse the command line arguments this script was given.
@@ -324,13 +242,7 @@ sub parseCommandLineArguments
if ($VERSION) if ($VERSION)
{ {
my $REVISION = '$Revision: 1.13 $'; logprint("xen-create-nfs release $RELEASE\n");
if ( $REVISION =~ /1.([0-9.]+) / )
{
$REVISION = $1;
}
logprint("xen-create-nfs release $RELEASE - CVS: $REVISION\n");
exit; exit;
} }
} }
@@ -409,82 +321,6 @@ sub testArguments
=begin doc
This routine is designed to ensure that any users specified with
the --admins flag are setup as administrators of the new instance.
=end doc
=cut
sub setupAdminUsers
{
#
# If we're not root we can't modify users.
#
return if ( $EFFECTIVE_USER_ID != 0 );
#
# If we don't have a sudoers file then we'll also ignore this.
#
return if ( !-e "/etc/sudoers" );
#
# Find the path to the xen-login-shell
#
my $shell = undef;
$shell = "/usr/bin/xen-login-shell" if ( -x "/usr/bin/xen-login-shell" );
$shell = "/usr/local/bin/xen-login-shell"
if ( -x "/usr/bin/local/xen-login-shell" );
return if ( !defined($shell) );
#
# For each user make sure they exist, and setup the
# login shell for them.
#
foreach my $user ( split( /,/, $ENV{ 'admins' } ) )
{
# Strip leading and trailing whitespace.
$user =~ s/^\s+//;
$user =~ s/\s+$//;
# Ignore root
next if ( $user =~ /^root$/i );
# Does the user exist?
if ( getpwnam($user) )
{
# Change shell.
$CONFIG{ 'verbose' } && print "Changing shell for $user: $shell\n";
system( "chsh", "-s", $shell, $user );
}
else
{
# Add a new user.
$CONFIG{ 'verbose' } && print "Adding new user: $user\n";
system( "useradd", "-s", $shell, $user );
}
#
# Add the entry to /etc/sudoers.
#
open( SUDOERS, ">>", "/etc/sudoers" ) or
warn "Failed to add user to sudoers file : $user - $!";
print SUDOERS
"$user ALL = NOPASSWD: /usr/sbin/xm, /usr/bin/xen-create-image\n";
close(SUDOERS);
}
}
=begin doc =begin doc
Create the Xen configuration file for our new Xen guest. Create the Xen configuration file for our new Xen guest.

View File

@@ -24,6 +24,7 @@ xen-delete-image - Delete previously created Xen instances.
Testing options: Testing options:
--test Don't complain if we're not invoked by root. --test Don't complain if we're not invoked by root.
--no-xen-ok Don't complain if xen seems not installed or xend is not running
=cut =cut
@@ -158,6 +159,7 @@ use English;
use Getopt::Long; use Getopt::Long;
use Pod::Usage; use Pod::Usage;
use File::Path; use File::Path;
use Xen::Tools::Common;
# #
@@ -171,16 +173,21 @@ my %CONFIG;
# #
# Release number. # Release number.
# #
my $RELEASE = '4.3.1'; my $RELEASE = '4.4~dev';
#
# Find xen toolstack command
#
$CONFIG{ 'xm' } = findXenToolstack();
# #
# Read the global configuration file if it exists. # Read the global configuration file if it exists.
# #
if ( -e "/etc/xen-tools/xen-tools.conf" ) if ( -e "/etc/xen-tools/xen-tools.conf" )
{ {
readConfigurationFile("/etc/xen-tools/xen-tools.conf"); readConfigurationFile("/etc/xen-tools/xen-tools.conf", \%CONFIG);
} }
@@ -220,7 +227,7 @@ E_O_ROOT
# #
while ( my $name = shift ) while ( my $name = shift )
{ {
if ( !xenRunning($name) ) if ( $CONFIG{ 'no_xen_ok' } or !xenRunning($name, \%CONFIG) )
{ {
deleteXenImage($name); deleteXenImage($name);
} }
@@ -236,7 +243,7 @@ while ( my $name = shift )
my $hosts = $CONFIG{ 'hostname' }; my $hosts = $CONFIG{ 'hostname' };
foreach my $name (@$hosts) foreach my $name (@$hosts)
{ {
if ( !xenRunning($name) ) if ( $CONFIG{ 'no_xen_ok' } or !xenRunning($name, \%CONFIG) )
{ {
deleteXenImage($name); deleteXenImage($name);
} }
@@ -253,81 +260,6 @@ exit 0;
=begin doc
Read the configuration file specified.
=end doc
=cut
sub readConfigurationFile
{
my ($file) = (@_);
open( FILE, "<", $file ) or die "Cannot read file '$file' - $!";
my $line = "";
while ( defined( $line = <FILE> ) )
{
chomp $line;
if ( $line =~ s/\\$// )
{
$line .= <FILE>;
redo unless eof(FILE);
}
# Skip lines beginning with comments
next if ( $line =~ /^([ \t]*)\#/ );
# Skip blank lines
next if ( length($line) < 1 );
# Strip trailing comments.
if ( $line =~ /(.*)\#(.*)/ )
{
$line = $1;
}
# Find variable settings
if ( $line =~ /([^=]+)=([^\n]+)/ )
{
my $key = $1;
my $val = $2;
# Strip leading and trailing whitespace.
$key =~ s/^\s+//;
$key =~ s/\s+$//;
$val =~ s/^\s+//;
$val =~ s/\s+$//;
# command expansion?
if ( $val =~ /(.*)`([^`]+)`(.*)/ )
{
# store
my $pre = $1;
my $cmd = $2;
my $post = $3;
# get output
my $output = `$cmd`;
chomp($output);
# build up replacement.
$val = $pre . $output . $post;
}
# Store value.
$CONFIG{ $key } = $val;
}
}
close(FILE);
}
=begin doc =begin doc
@@ -353,6 +285,7 @@ sub parseCommandLineArguments
"hostname=s@", \$CONFIG{ 'hostname' }, "hostname=s@", \$CONFIG{ 'hostname' },
"test", \$CONFIG{ 'test' }, "test", \$CONFIG{ 'test' },
"verbose", \$CONFIG{ 'verbose' }, "verbose", \$CONFIG{ 'verbose' },
"no-xen-ok", \$CONFIG{ 'no_xen_ok' },
"help", \$HELP, "help", \$HELP,
"manual", \$MANUAL, "manual", \$MANUAL,
"version", \$VERSION "version", \$VERSION
@@ -364,14 +297,7 @@ sub parseCommandLineArguments
if ($VERSION) if ($VERSION)
{ {
my $REVISION = '$Revision: 1.41 $'; print "xen-delete-image release $RELEASE\n";
if ( $REVISION =~ /1.([0-9.]+) / )
{
$REVISION = $1;
}
print "xen-delete-image release $RELEASE - CVS: $REVISION\n";
exit; exit;
} }
@@ -424,33 +350,6 @@ sub checkArguments
=begin doc
Test to see if the given instance is running.
=end doc
=cut
sub xenRunning
{
my ($hostname) = (@_);
my $running = 0;
open( CMD, "xm list $hostname 2>/dev/null |" ) or
die "Failed to run 'xm list $hostname'";
while (<CMD>)
{
my $line = $_;
$running = 1 if ( $line =~ /\Q$hostname\E/ );
}
close(CMD);
return ($running);
}
=begin doc =begin doc
Delete the named image, and the corresponding configuration file Delete the named image, and the corresponding configuration file
@@ -539,7 +438,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"); runCommand("lvremove /dev/$CONFIG{'lvm'}/$hostname-swap --force", \%CONFIG);
} }
} }
@@ -549,7 +448,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"); runCommand("lvremove /dev/$CONFIG{'lvm'}/$hostname-disk --force", \%CONFIG);
} }
} }
@@ -571,8 +470,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"); runCommand("echo Delete : /dev/evms/$hostname-swap | evms", \%CONFIG);
runCommand("echo Delete : $CONFIG{'evms'}/$hostname-swap | evms"); runCommand("echo Delete : $CONFIG{'evms'}/$hostname-swap | evms", \%CONFIG);
} }
} }
@@ -583,8 +482,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"); runCommand("echo Delete : /dev/evms/$hostname-disk | evms", \%CONFIG);
runCommand("echo Delete : $CONFIG{'evms'}/$hostname-disk | evms"); runCommand("echo Delete : $CONFIG{'evms'}/$hostname-disk | evms", \%CONFIG);
} }
} }
@@ -597,66 +496,3 @@ sub deleteXenImage
exit 127; exit 127;
} }
} }
=begin doc
A utility method to run a system command. We will capture the return
value and exit if the command files.
When running verbosely we will also display any command output.
=end doc
=cut
sub runCommand
{
my ($cmd) = (@_);
#
# Header.
#
$CONFIG{ 'verbose' } && print "Executing : $cmd\n";
#
# Hide output unless running with --debug.
#
if ( $CONFIG{ 'verbose' } )
{
#
# Copy stderr to stdout, so we can see it.
#
$cmd .= " 2>&1";
}
else
{
$cmd .= " >/dev/null 2>/dev/null";
}
#
# Run it.
#
my $output = `$cmd`;
if ( $? != 0 )
{
print "Running command '$cmd' failed.\n";
print "Aborting\n";
exit;
}
#
# All done.
#
$CONFIG{ 'verbose' } && print "Output\n";
$CONFIG{ 'verbose' } && print "======\n";
$CONFIG{ 'verbose' } && print $output . "\n";
$CONFIG{ 'verbose' } && print "Finished : $cmd\n";
return ($output);
}

View File

@@ -83,6 +83,7 @@ use English;
use File::Temp qw/ tempdir /; use File::Temp qw/ tempdir /;
use Getopt::Long; use Getopt::Long;
use Pod::Usage; use Pod::Usage;
use Xen::Tools::Common;
# #
@@ -101,14 +102,14 @@ $CONFIG{ 'prefix' } = "/etc/xen";
# #
# Release number. # Release number.
# #
my $RELEASE = '4.3.1'; my $RELEASE = '4.4~dev';
# #
# Read the global configuration file if it exists. # Read the global configuration file if it exists.
# #
readConfigurationFile("/etc/xen-tools/xen-tools.conf"); readConfigurationFile("/etc/xen-tools/xen-tools.conf", \%CONFIG);
# #
@@ -144,83 +145,6 @@ exit;
=begin doc
Read the configuration file specified.
=end doc
=cut
sub readConfigurationFile
{
my ($file) = (@_);
# Don't read the file if it doesn't exist.
return if ( !-e $file );
open( FILE, "<", $file ) or die "Cannot read file '$file' - $!";
while ( defined( my $line = <FILE> ) )
{
chomp $line;
if ( $line =~ s/\\$// )
{
$line .= <FILE>;
redo unless eof(FILE);
}
# Skip lines beginning with comments
next if ( $line =~ /^([ \t]*)\#/ );
# Skip blank lines
next if ( length($line) < 1 );
# Strip trailing comments.
if ( $line =~ /(.*)\#(.*)/ )
{
$line = $1;
}
# Find variable settings
if ( $line =~ /([^=]+)=([^\n]+)/ )
{
my $key = $1;
my $val = $2;
# Strip leading and trailing whitespace.
$key =~ s/^\s+//;
$key =~ s/\s+$//;
$val =~ s/^\s+//;
$val =~ s/\s+$//;
# command expansion?
if ( $val =~ /(.*)`([^`]+)`(.*)/ )
{
# store
my $pre = $1;
my $cmd = $2;
my $post = $3;
# get output
my $output = `$cmd`;
chomp($output);
# build up replacement.
$val = $pre . $output . $post;
}
# Store value.
$CONFIG{ $key } = $val;
}
}
close(FILE);
}
=begin doc =begin doc
Parse the arguments specified upon the command line. Parse the arguments specified upon the command line.
@@ -248,13 +172,7 @@ sub parseCommandLineArguments
if ($VERSION) if ($VERSION)
{ {
my $REVISION = '$Revision: 1.30 $'; print "xen-list-images release $RELEASE\n";
if ( $REVISION =~ /1.([0-9.]+) / )
{
$REVISION = $1;
}
print "xen-list-images release $RELEASE - CVS: $REVISION\n";
exit; exit;
} }
} }

View File

@@ -104,6 +104,7 @@ use Env;
use Getopt::Long; use Getopt::Long;
use Pod::Usage; use Pod::Usage;
use Text::Template; use Text::Template;
use Xen::Tools::Common;
@@ -116,14 +117,19 @@ my %CONFIG;
# #
# Release number. # Release number.
# #
my $RELEASE = '4.3.1'; my $RELEASE = '4.4~dev';
#
# Find xen toolstack command
#
$CONFIG{ 'xm' } = findXenToolstack();
# #
# Read the global configuration file. # Read the global configuration file.
# #
readConfigurationFile("/etc/xen-tools/xen-tools.conf"); readConfigurationFile("/etc/xen-tools/xen-tools.conf", \%CONFIG);
# #
@@ -289,84 +295,6 @@ exit 0;
=begin doc
Read the configuration file specified.
=end doc
=cut
sub readConfigurationFile
{
my ($file) = (@_);
# Don't read the file if it doesn't exist.
return if ( !-e $file );
open( FILE, "<", $file ) or die "Cannot read file '$file' - $!";
my $line = "";
while ( defined( $line = <FILE> ) )
{
chomp $line;
if ( $line =~ s/\\$// )
{
$line .= <FILE>;
redo unless eof(FILE);
}
# Skip lines beginning with comments
next if ( $line =~ /^([ \t]*)\#/ );
# Skip blank lines
next if ( length($line) < 1 );
# Strip trailing comments.
if ( $line =~ /(.*)\#(.*)/ )
{
$line = $1;
}
# Find variable settings
if ( $line =~ /([^=]+)=([^\n]+)/ )
{
my $key = $1;
my $val = $2;
# Strip leading and trailing whitespace.
$key =~ s/^\s+//;
$key =~ s/\s+$//;
$val =~ s/^\s+//;
$val =~ s/\s+$//;
# command expansion?
if ( $val =~ /(.*)`([^`]+)`(.*)/ )
{
# store
my $pre = $1;
my $cmd = $2;
my $post = $3;
# get output
my $output = `$cmd`;
chomp($output);
# build up replacement.
$val = $pre . $output . $post;
}
# Store value.
$CONFIG{ $key } = $val;
}
}
close(FILE);
}
=begin doc =begin doc
Parse the command line arguments this script was given. Parse the command line arguments this script was given.
@@ -482,7 +410,7 @@ EOF
# #
# Make sure the guest isn't running # Make sure the guest isn't running
# #
if ( xenRunning( $CONFIG{ 'hostname' } ) ) if ( xenRunning( $CONFIG{ 'hostname' }, \%CONFIG ) )
{ {
print "The guest $CONFIG{'hostname'} appears to be running!\n"; print "The guest $CONFIG{'hostname'} appears to be running!\n";
exit 1; exit 1;
@@ -523,31 +451,3 @@ EOF
$CONFIG{ 'add' } = $1; $CONFIG{ 'add' } = $1;
} }
} }
=begin doc
Test to see if the given instance is running.
=end doc
=cut
sub xenRunning
{
my ($hostname) = (@_);
my $running = 0;
open( CMD, "xm list $hostname 2>/dev/null |" ) or
die "Failed to run 'xm list $hostname'";
while (<CMD>)
{
my $line = $_;
$running = 1 if ( $line =~ /\Q$hostname\E/ );
}
close(CMD);
return ($running);
}

View File

@@ -107,6 +107,7 @@ use File::Temp qw/ tempdir /;
use File::Copy qw/ mv cp /; use File::Copy qw/ mv cp /;
use Getopt::Long; use Getopt::Long;
use Pod::Usage; use Pod::Usage;
use Xen::Tools::Common;
# #
@@ -120,7 +121,13 @@ my %CONFIG;
# #
# Release number. # Release number.
# #
my $RELEASE = '4.3.1'; my $RELEASE = '4.4~dev';
#
# Find xen toolstack command
#
$CONFIG{ 'xm' } = findXenToolstack();
# #
@@ -128,7 +135,7 @@ my $RELEASE = '4.3.1';
# #
if ( -e "/etc/xen-tools/xen-tools.conf" ) if ( -e "/etc/xen-tools/xen-tools.conf" )
{ {
readConfigurationFile("/etc/xen-tools/xen-tools.conf"); readConfigurationFile("/etc/xen-tools/xen-tools.conf", \%CONFIG);
} }
@@ -168,7 +175,7 @@ E_O_ROOT
# #
while ( my $name = shift ) while ( my $name = shift )
{ {
if ( !xenRunning($name) ) if ( !xenRunning($name, \%CONFIG) )
{ {
updateXenImage($name); updateXenImage($name);
} }
@@ -331,110 +338,6 @@ sub updateXenImage
=begin doc
Test to see if the given instance is running.
=end doc
=cut
sub xenRunning
{
my ($hostname) = (@_);
my $running = 0;
open( CMD, "xm list 2>/dev/null |" ) or
die "Failed to run 'xm list $hostname'";
while (<CMD>)
{
my $line = $_;
$running = 1 if ( $line =~ /\Q$hostname\E/ );
}
close(CMD);
return ($running);
}
=begin doc
Read the configuration file specified.
=end doc
=cut
sub readConfigurationFile
{
my ($file) = (@_);
open( FILE, "<", $file ) or die "Cannot read file '$file' - $!";
my $line = "";
while ( defined( $line = <FILE> ) )
{
chomp $line;
if ( $line =~ s/\\$// )
{
$line .= <FILE>;
redo unless eof(FILE);
}
# Skip lines beginning with comments
next if ( $line =~ /^([ \t]*)\#/ );
# Skip blank lines
next if ( length($line) < 1 );
# Strip trailing comments.
if ( $line =~ /(.*)\#(.*)/ )
{
$line = $1;
}
# Find variable settings
if ( $line =~ /([^=]+)=([^\n]+)/ )
{
my $key = $1;
my $val = $2;
# Strip leading and trailing whitespace.
$key =~ s/^\s+//;
$key =~ s/\s+$//;
$val =~ s/^\s+//;
$val =~ s/\s+$//;
# command expansion?
if ( $val =~ /(.*)`([^`]+)`(.*)/ )
{
# store
my $pre = $1;
my $cmd = $2;
my $post = $3;
# get output
my $output = `$cmd`;
chomp($output);
# build up replacement.
$val = $pre . $output . $post;
}
# Store value.
$CONFIG{ $key } = $val;
}
}
close(FILE);
}
=begin doc =begin doc
Parse the arguments specified upon the command line. Parse the arguments specified upon the command line.
@@ -463,13 +366,7 @@ sub parseCommandLineArguments
if ($VERSION) if ($VERSION)
{ {
my $REVISION = '$Revision: 1.29 $'; print "xen-update-image release $RELEASE\n";
if ( $REVISION =~ /1.([0-9.]+) / )
{
$REVISION = $1;
}
print "xen-update-image release $RELEASE - CVS: $REVISION\n";
exit; exit;
} }

View File

@@ -156,7 +156,7 @@ $CONFIG{ 'extension' } = '.cfg';
# #
# Release number. # Release number.
# #
my $RELEASE = '4.3.1'; my $RELEASE = '4.4~dev';
@@ -177,7 +177,7 @@ checkArguments();
# #
if ( $ENV{ 'admins' } ) if ( $ENV{ 'admins' } )
{ {
setupAdminUsers(); setupAdminUsers(\%CONFIG);
} }
@@ -229,13 +229,7 @@ sub parseCommandLineArguments
if ($VERSION) if ($VERSION)
{ {
my $REVISION = '$Revision: 1.47 $'; print "xt-create-xen-config release $RELEASE\n";
if ( $REVISION =~ /1.([0-9.]+) / )
{
$REVISION = $1;
}
print "xt-create-xen-config release $RELEASE - CVS: $REVISION\n";
exit; exit;
} }
} }
@@ -375,7 +369,7 @@ sub createXenConfig
# #
# The memory size: Convert Gb -> Mb. # The memory size: Convert Gb -> Mb.
# #
if ( $ENV{ 'memory' } =~ /^(\d+)Gb.*$/i ) if ( $ENV{ 'memory' } =~ /^(\d+)Gb?.*$/i )
{ {
$ENV{ 'memory' } = $1 * 1024; $ENV{ 'memory' } = $1 * 1024;
} }
@@ -383,7 +377,7 @@ sub createXenConfig
# #
# Remove any trailing Mb. # Remove any trailing Mb.
# #
if ( $ENV{ 'memory' } =~ /^(\d+)Mb.*$/i ) if ( $ENV{ 'memory' } =~ /^(\d+)Mb?.*$/i )
{ {
$ENV{ 'memory' } = $1; $ENV{ 'memory' } = $1;
} }
@@ -470,80 +464,3 @@ sub createXenConfig
close(FILE); close(FILE);
} }
=begin doc
This routine is designed to ensure that any users specified with
the --admins flag are setup as administrators of the new instance.
=end doc
=cut
sub setupAdminUsers
{
#
# If we're not root we can't modify users.
#
return if ( $EFFECTIVE_USER_ID != 0 );
#
# If we don't have a sudoers file then we'll also ignore this.
#
return if ( !-e "/etc/sudoers" );
#
# Find the path to the xen-login-shell
#
my $shell = undef;
$shell = "/usr/bin/xen-login-shell" if ( -x "/usr/bin/xen-login-shell" );
$shell = "/usr/local/bin/xen-login-shell"
if ( -x "/usr/bin/local/xen-login-shell" );
return if ( !defined($shell) );
#
# For each user make sure they exist, and setup the
# login shell for them.
#
foreach my $user ( split( /,/, $ENV{ 'admins' } ) )
{
# Strip leading and trailing whitespace.
$user =~ s/^\s+//;
$user =~ s/\s+$//;
# Ignore root
next if ( $user =~ /^root$/i );
# Does the user exist?
if ( getpwnam($user) )
{
# Change shell.
$CONFIG{ 'verbose' } && print "Changing shell for $user: $shell\n";
system( "chsh", "-s", $shell, $user );
}
else
{
# Add a new user.
$CONFIG{ 'verbose' } && print "Adding new user: $user\n";
system( "useradd", "-s", $shell, $user );
}
#
# Add the entry to /etc/sudoers.
#
open( SUDOERS, ">>", "/etc/sudoers" ) or
warn "Failed to add user to sudoers file : $user - $!";
print SUDOERS
"$user ALL = NOPASSWD: /usr/sbin/xm, /usr/bin/xen-create-image\n";
close(SUDOERS);
}
}

View File

@@ -98,7 +98,7 @@ my %CONFIG;
# #
# Release number. # Release number.
# #
my $RELEASE = '4.3.1'; my $RELEASE = '4.4~dev';
@@ -159,13 +159,7 @@ sub parseCommandLineArguments
if ($VERSION) if ($VERSION)
{ {
my $REVISION = '$Revision: 1.33 $'; print "xt-customize-image release $RELEASE\n";
if ( $REVISION =~ /1.([0-9.]+) / )
{
$REVISION = $1;
}
print "xt-customize-image release $RELEASE - CVS: $REVISION\n";
exit; exit;
} }
} }

View File

@@ -81,7 +81,7 @@ use strict;
# #
# Release number. # Release number.
# #
my $RELEASE = '4.3.1'; my $RELEASE = '4.4~dev';
# Init # Init
my $mirror = ''; my $mirror = '';

View File

@@ -108,6 +108,7 @@ use Env;
use File::Copy; use File::Copy;
use Getopt::Long; use Getopt::Long;
use Pod::Usage; use Pod::Usage;
use Xen::Tools::Common;
# #
@@ -118,7 +119,7 @@ my %CONFIG;
# #
# Release number. # Release number.
# #
my $RELEASE = '4.3.1'; my $RELEASE = '4.4~dev';
# #
@@ -156,7 +157,7 @@ my %dispatch = (
# #
# Read the global configuration file. # Read the global configuration file.
# #
readConfigurationFile("/etc/xen-tools/xen-tools.conf"); readConfigurationFile("/etc/xen-tools/xen-tools.conf", \%CONFIG);
# #
@@ -179,7 +180,7 @@ if ( $CONFIG{ 'config' } )
} }
# Read the file, if it exists. # Read the file, if it exists.
readConfigurationFile($path) if ( -e $path ); readConfigurationFile($path, \%CONFIG) if ( -e $path );
} }
@@ -280,87 +281,6 @@ else
=begin doc
Read the specified configuration file, and update our global configuration
hash with the values found in it.
=end doc
=cut
sub readConfigurationFile
{
my ($file) = (@_);
# Don't read the file if it doesn't exist.
return if ( !-e $file );
my $line = "";
open( FILE, "<", $file ) or die "Cannot read file '$file' - $!";
while ( defined( $line = <FILE> ) )
{
chomp $line;
if ( $line =~ s/\\$// )
{
$line .= <FILE>;
redo unless eof(FILE);
}
# Skip lines beginning with comments
next if ( $line =~ /^([ \t]*)\#/ );
# Skip blank lines
next if ( length($line) < 1 );
# Strip trailing comments.
if ( $line =~ /(.*)\#(.*)/ )
{
$line = $1;
}
# Find variable settings
if ( $line =~ /([^=]+)=([^\n]+)/ )
{
my $key = $1;
my $val = $2;
# Strip leading and trailing whitespace.
$key =~ s/^\s+//;
$key =~ s/\s+$//;
$val =~ s/^\s+//;
$val =~ s/\s+$//;
# command expansion?
if ( $val =~ /(.*)`([^`]+)`(.*)/ )
{
# store
my $pre = $1;
my $cmd = $2;
my $post = $3;
# get output
my $output = `$cmd`;
chomp($output);
# build up replacement.
$val = $pre . $output . $post;
}
# Store value.
$CONFIG{ $key } = $val;
}
}
close(FILE);
}
=begin doc =begin doc
Parse the command line arguments this script was given. Parse the command line arguments this script was given.
@@ -411,13 +331,7 @@ sub parseCommandLineArguments
if ($VERSION) if ($VERSION)
{ {
my $REVISION = '$Revision: 1.65 $'; print "xt-install-image release $RELEASE\n";
if ( $REVISION =~ /1.([0-9.]+) / )
{
$REVISION = $1;
}
print "xt-install-image release $RELEASE - CVS: $REVISION\n";
exit; exit;
} }
} }
@@ -553,53 +467,6 @@ EOT
=begin doc
A utility method to run a system command. We will capture the return
value and exit if the command fails.
When running verbosely we will also display any command output.
=end doc
=cut
sub runCommand
{
my ($cmd) = (@_);
#
# Command start.
#
$CONFIG{ 'verbose' } && print "Executing : $cmd\n";
#
# Copy stderr to stdout, so we can see it, and make sure we log it.
#
$cmd .= " 2>&1 | tee --append /var/log/xen-tools/$CONFIG{'hostname'}.log";
#
# Run it.
#
my $output = `$cmd`;
if ( $? != 0 )
{
print "Running command '$cmd' failed.\n";
print "Aborting\n";
exit 127;
}
#
# Command finished.
#
$CONFIG{ 'verbose' } && print "Finished : $cmd\n";
return ($output);
}
=begin doc =begin doc
This function will copy all the .deb files from one directory This function will copy all the .deb files from one directory
@@ -685,7 +552,7 @@ sub do_copy
# #
# Run the copy command. # Run the copy command.
# #
runCommand($cmd); runCommand($cmd, \%CONFIG);
} }
@@ -736,7 +603,7 @@ sub do_debootstrap
} }
$cachedir = $xtcache; $cachedir = $xtcache;
} }
runCommand("mkdir -p $CONFIG{'location'}/var/cache/apt/archives"); runCommand("mkdir -p $CONFIG{'location'}/var/cache/apt/archives", \%CONFIG);
copyDebFiles( "$cachedir", copyDebFiles( "$cachedir",
"$CONFIG{'location'}/var/cache/apt/archives" ); "$CONFIG{'location'}/var/cache/apt/archives" );
print("Done\n"); print("Done\n");
@@ -777,7 +644,7 @@ sub do_debootstrap
# #
# Run the command. # Run the command.
# #
runCommand($command); runCommand($command, \%CONFIG);
# #
@@ -848,7 +715,7 @@ sub do_rinse
$command .= " --verbose"; $command .= " --verbose";
} }
runCommand($command); runCommand($command, \%CONFIG);
} }
@@ -891,7 +758,7 @@ sub do_rpmstrap
# The command we're going to run. # The command we're going to run.
# #
my $command = "rpmstrap $EXTRA $CONFIG{'dist'} $CONFIG{'location'} $mirror"; my $command = "rpmstrap $EXTRA $CONFIG{'dist'} $CONFIG{'location'} $mirror";
runCommand($command); runCommand($command, \%CONFIG);
} }
@@ -925,5 +792,5 @@ sub do_tar
# #
# Run a command to copy an installed system into the new root. # Run a command to copy an installed system into the new root.
# #
runCommand("cd $CONFIG{'location'} && $cmd"); runCommand("cd $CONFIG{'location'} && $cmd", \%CONFIG);
} }

23
debian/changelog vendored
View File

@@ -1,3 +1,26 @@
xen-tools (4.4~dev-1) UNRELEASED; urgency=low
* New upstream release
- Code deduplication to unify the xen-*-image scripts
- Fix symbolic link hooks/centos-6/15-setup-arch (Closes: #690299)
- 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)
- 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.
- Default DomUs to use the noop scheduler (Closes: #693131)
- Remove CVS revisions from --version output
- Preliminary support for Debian Jessie and Ubuntu Raring
- Preliminary support for xl toolstack
- xen-create-image: Consistently use runCommand() instead of system()
* Add debian/gbp.conf to be able to to build xen-tools with
git-buildpackage.
* Install (manually generated) upstream ChangeLog only if it
exists. Allows automatic builds from the git repository.
-- Axel Beckert <abe@debian.org> Tue, 13 Nov 2012 23:37:54 +0100
xen-tools (4.3.1-1) unstable; urgency=low xen-tools (4.3.1-1) unstable; urgency=low
* Remove t/modules.t in upstream's t/Makefile instead of debian/rules' * Remove t/modules.t in upstream's t/Makefile instead of debian/rules'

10
debian/docs vendored
View File

@@ -1,7 +1,7 @@
AUTHORS AUTHORS
README README.markdown
SUPPORT SUPPORT.markdown
BUGS BUGS.markdown
TODO TODO.markdown
KNOWN_BUGS KNOWN_BUGS.markdown
NEWS NEWS

3
debian/gbp.conf vendored Normal file
View File

@@ -0,0 +1,3 @@
[DEFAULT]
upstream-tag=release-%(version)s
debian-tag=debian-%(version)s

2
debian/rules vendored
View File

@@ -43,7 +43,7 @@ binary-indep: build install
dh_testroot dh_testroot
dh_install dh_install
dh_installexamples debian/examples/setup-kernel-initrd debian/examples/update-modules dh_installexamples debian/examples/setup-kernel-initrd debian/examples/update-modules
dh_installchangelogs ChangeLog [ ! -e ChangeLog ] || dh_installchangelogs ChangeLog
dh_installdocs dh_installdocs
dh_compress dh_compress
dh_fixperms dh_fixperms

View File

@@ -266,6 +266,7 @@ mirror = `xt-guess-suite-and-mirror --mirror`
# mirror_lenny = http://archive.debian.org/debian # mirror_lenny = http://archive.debian.org/debian
# mirror_squeeze = http://cdn.debian.net/debian # mirror_squeeze = http://cdn.debian.net/debian
# mirror_wheezy = http://cdn.debian.net/debian # mirror_wheezy = http://cdn.debian.net/debian
# mirror_jessie = http://cdn.debian.net/debian
# mirror_sid = http://cdn.debian.net/debian # mirror_sid = http://cdn.debian.net/debian
# mirror_dapper = http://old-releases.ubuntu.com/ubuntu # mirror_dapper = http://old-releases.ubuntu.com/ubuntu
# mirror_edgy = http://old-releases.ubuntu.com/ubuntu # mirror_edgy = http://old-releases.ubuntu.com/ubuntu
@@ -277,10 +278,11 @@ mirror = `xt-guess-suite-and-mirror --mirror`
# mirror_karmic = http://old-releases.ubuntu.com/ubuntu # mirror_karmic = http://old-releases.ubuntu.com/ubuntu
# mirror_lucid = http://archive.ubuntu.com/ubuntu # mirror_lucid = http://archive.ubuntu.com/ubuntu
# mirror_maverick = http://old-releases.ubuntu.com/ubuntu # mirror_maverick = http://old-releases.ubuntu.com/ubuntu
# mirror_natty = http://archive.ubuntu.com/ubuntu # mirror_natty = http://old-releases.ubuntu.com/ubuntu
# mirror_oneiric = http://archive.ubuntu.com/ubuntu # mirror_oneiric = http://archive.ubuntu.com/ubuntu
# mirror_precise = http://archive.ubuntu.com/ubuntu # mirror_precise = http://archive.ubuntu.com/ubuntu
# mirror_quantal = http://archive.ubuntu.com/ubuntu # mirror_quantal = http://archive.ubuntu.com/ubuntu
# mirror_raring = http://archive.ubuntu.com/ubuntu
# If this is defined it will be used by debootstrap, and configured as the # If this is defined it will be used by debootstrap, and configured as the
# proxy for the guest # proxy for the guest

View File

@@ -8,7 +8,8 @@
# #
{ if ( ( $kernel ) && ( !defined($pygrub)) ) { if ( ( $kernel ) && ( !defined($pygrub)) )
{ {
$OUT.= "kernel = '$kernel'"; $OUT .= "kernel = '$kernel'\n";
$OUT .= "extra = 'elevator=noop'";
} }
} }
{ if ( ( $initrd ) && ( !defined($pygrub)) ) { if ( ( $initrd ) && ( !defined($pygrub)) )

View File

@@ -66,7 +66,7 @@ cat > ${prefix}/boot/grub/menu.lst << EOF
default=0 default=0
timeout=5 timeout=5
title CentOS ($KERNELVERSION) title CentOS ($KERNELVERSION)
kernel /boot/vmlinuz-$KERNELVERSION xen_pv_hvm=enable kernel /boot/vmlinuz-$KERNELVERSION xen_pv_hvm=enable elevator=noop
initrd /boot/initrd-$KERNELVERSION.img initrd /boot/initrd-$KERNELVERSION.img
EOF EOF

View File

@@ -1 +1 @@
../common/15-disable-hwclock ../common/15-setup-arch

View File

@@ -66,7 +66,7 @@ cat > ${prefix}/boot/grub/menu.lst << EOF
default=0 default=0
timeout=5 timeout=5
title CentOS ($KERNELVERSION) title CentOS ($KERNELVERSION)
kernel /boot/vmlinuz-$KERNELVERSION kernel /boot/vmlinuz-$KERNELVERSION elevator=noop
initrd /boot/initramfs-$KERNELVERSION.img initrd /boot/initramfs-$KERNELVERSION.img
EOF EOF

View File

@@ -110,12 +110,12 @@ timeout 2
title $DOMU_ISSUE title $DOMU_ISSUE
root (hd0,0) root (hd0,0)
kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro elevator=noop
initrd /boot/$DOMU_RAMDISK initrd /boot/$DOMU_RAMDISK
title $DOMU_ISSUE (Single-User) title $DOMU_ISSUE (Single-User)
root (hd0,0) root (hd0,0)
kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro single kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro single elevator=noop
initrd /boot/$DOMU_RAMDISK initrd /boot/$DOMU_RAMDISK
E_O_MENU E_O_MENU

View File

@@ -85,12 +85,12 @@ timeout 2
title $DOMU_ISSUE title $DOMU_ISSUE
root (hd0,0) root (hd0,0)
kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro elevator=noop
initrd /boot/$DOMU_RAMDISK initrd /boot/$DOMU_RAMDISK
title $DOMU_ISSUE (Single-User) title $DOMU_ISSUE (Single-User)
root (hd0,0) root (hd0,0)
kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro single kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro single elevator=noop
initrd /boot/$DOMU_RAMDISK initrd /boot/$DOMU_RAMDISK
E_O_MENU E_O_MENU

View File

@@ -75,12 +75,12 @@ timeout 2
title $DOMU_ISSUE title $DOMU_ISSUE
root (hd0,0) root (hd0,0)
kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro elevator=noop
initrd /boot/$DOMU_RAMDISK initrd /boot/$DOMU_RAMDISK
title $DOMU_ISSUE (Single-User) title $DOMU_ISSUE (Single-User)
root (hd0,0) root (hd0,0)
kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro single kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro single elevator=noop
initrd /boot/$DOMU_RAMDISK initrd /boot/$DOMU_RAMDISK
E_O_MENU E_O_MENU

View File

@@ -61,12 +61,12 @@ timeout 2
title $DOMU_ISSUE title $DOMU_ISSUE
root (hd0,0) root (hd0,0)
kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro elevator=noop
initrd /boot/$DOMU_RAMDISK initrd /boot/$DOMU_RAMDISK
title $DOMU_ISSUE (Single-User) title $DOMU_ISSUE (Single-User)
root (hd0,0) root (hd0,0)
kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro single kernel /boot/$DOMU_KERNEL root=/dev/xvda2 ro single elevator=noop
initrd /boot/$DOMU_RAMDISK initrd /boot/$DOMU_RAMDISK
E_O_MENU E_O_MENU

437
lib/Xen/Tools/Common.pm Normal file
View File

@@ -0,0 +1,437 @@
# -*- perl -*
package Xen::Tools::Common;
=head1 NAME
Xen::Tools::Common - Common funtions used in xen-tools' Perl scripts
=head1 SYNOPSIS
use Xen::Tools::Common;
=cut
use warnings;
use strict;
use Exporter 'import';
use vars qw(@EXPORT_OK @EXPORT);
use English;
@EXPORT = qw(readConfigurationFile xenRunning runCommand setupAdminUsers
findXenToolstack findBinary
logprint_with_config logonly_with_config fail_with_config);
=head1 FUNCTIONS
=head2 readConfigurationFile
=begin doc
Read the specified configuration file, and update our global configuration
hash with the values found in it.
=end doc
=cut
sub readConfigurationFile ($$)
{
my ($file, $CONFIG) = (@_);
# Don't read the file if it doesn't exist.
return if ( !-e $file );
my $line = "";
open( FILE, "<", $file ) or
fail_with_config("Cannot read file '$file' - $!", $CONFIG);
while ( defined( $line = <FILE> ) )
{
chomp $line;
if ( $line =~ s/\\$// )
{
$line .= <FILE>;
redo unless eof(FILE);
}
# Skip lines beginning with comments
next if ( $line =~ /^([ \t]*)\#/ );
# Skip blank lines
next if ( length($line) < 1 );
# Strip trailing comments.
if ( $line =~ /(.*)\#(.*)/ )
{
$line = $1;
}
# Find variable settings
if ( $line =~ /([^=]+)=([^\n]+)/ )
{
my $key = $1;
my $val = $2;
# Strip leading and trailing whitespace.
$key =~ s/^\s+//;
$key =~ s/\s+$//;
$val =~ s/^\s+//;
$val =~ s/\s+$//;
# command expansion?
if ( $val =~ /(.*)`([^`]+)`(.*)/ )
{
# store
my $pre = $1;
my $cmd = $2;
my $post = $3;
# get output
my $output = `$cmd`;
chomp($output);
# build up replacement.
$val = $pre . $output . $post;
}
# Store value.
$CONFIG->{ $key } = $val;
}
}
close(FILE);
}
=head2 xenRunning
=begin doc
Test to see if the given instance is running.
=end doc
=cut
sub xenRunning ($$)
{
my ($hostname, $CONFIG) = (@_);
my $running = 0;
die "Couldn't determine Xen toolstack" unless $CONFIG->{'xm'};
open( CMD, $CONFIG->{'xm'}." list $hostname 2>/dev/null |" ) or
fail_with_config("Failed to run '".$CONFIG->{'xm'}." list $hostname'", $CONFIG);
while (<CMD>)
{
my $line = $_;
$running = 1 if ( $line =~ /\Q$hostname\E/ );
}
close(CMD);
return ($running);
}
=head2 findBinary
=begin doc
Find the location of the specified binary on the curent user's PATH.
Return undef if the named binary isn't found.
=end doc
=cut
sub findBinary
{
my ($bin) = (@_);
# strip any path which might be present.
$bin = $2 if ( $bin =~ /(.*)[\/\\](.*)/ );
foreach my $entry ( split( /:/, $ENV{ 'PATH' } ) )
{
# guess of location.
my $guess = $entry . "/" . $bin;
# return it if it exists and is executable
return $guess if ( -e $guess && -x $guess );
}
return undef;
}
=head2 findXenToolstack
=begin doc
Find the right Xen toolstack. On Debian and derivatives there's a
script which tells you about the current toolstack.
=end doc
=cut
sub findXenToolstack
{
my $helper = '/usr/lib/xen-common/bin/xen-toolstack';
if (-x $helper) {
my $toolstack = `$helper`;
chomp($toolstack);
return $toolstack if $toolstack;
}
my $xm = findBinary('xm');
if ($xm and system("$xm list >/dev/null 2>/dev/null") == 0) {
return $xm;
}
my $xl = findBinary('xl');
if ($xl and system("$xl list >/dev/null 2>/dev/null") == 0) {
return $xl;
}
return undef;
}
=head2 runCommand
=begin doc
A utility method to run a system command. We will capture the return
value and exit if the command files.
When running verbosely we will also display any command output once
it has finished.
=end doc
=cut
sub runCommand ($$)
{
my ($cmd, $CONFIG) = (@_);
#
# Set a local if we don't have one.
#
$ENV{ 'LC_ALL' } = "C" unless ( $ENV{ 'LC_ALL' } );
#
# Header.
#
if ($CONFIG->{ 'verbose' }) {
logprint_with_config("Executing : $cmd\n", $CONFIG);
}
#
# Copy stderr to stdout, so we can see it, and make sure we log it.
#
$cmd .= " 2>&1";
#
# Run it.
#
my $rcopen = open(CMD, '-|', $cmd);
if (!defined($rcopen)) {
logprint_with_config("Starting command '$cmd' failed: $!\n", $CONFIG);
logprint_with_config("Aborting\n", $CONFIG);
print "See /var/log/xen-tools/".$CONFIG->{'hostname'}.".log for details\n";
$CONFIG->{'FAIL'} = 1;
exit 127;
}
while (my $line = <CMD>) {
if ($CONFIG->{ 'verbose' }) {
logprint_with_config($line, $CONFIG);
} else {
logonly_with_config($line, $CONFIG);
}
}
my $rcclose = close(CMD);
if ($CONFIG->{ 'verbose' }) {
logprint_with_config("Finished : $cmd\n", $CONFIG);
}
if (!$rcclose)
{
logprint_with_config("Running command '$cmd' failed with exit code $?.\n", $CONFIG);
logprint_with_config("Aborting\n", $CONFIG);
print "See /var/log/xen-tools/".$CONFIG->{'hostname'}.".log for details\n";
$CONFIG->{'FAIL'} = 1;
exit 127;
}
}
=head2 setupAdminUsers (xen-shell helper)
=begin doc
This routine is designed to ensure that any users specified with
the --admins flag are setup as administrators of the new instance.
=end doc
=cut
sub setupAdminUsers ($)
{
my $CONFIG = (@_);
#
# If we're not root we can't modify users.
#
return if ( $EFFECTIVE_USER_ID != 0 );
#
# If we don't have a sudoers file then we'll also ignore this.
#
return if ( !-e "/etc/sudoers" );
#
# Find the path to the xen-login-shell
#
my $shell = undef;
$shell = "/usr/bin/xen-login-shell" if ( -x "/usr/bin/xen-login-shell" );
$shell = "/usr/local/bin/xen-login-shell"
if ( -x "/usr/bin/local/xen-login-shell" );
return if ( !defined($shell) );
#
# For each user make sure they exist, and setup the
# login shell for them.
#
foreach my $user ( split( /,/, $ENV{ 'admins' } ) )
{
# Strip leading and trailing whitespace.
$user =~ s/^\s+//;
$user =~ s/\s+$//;
# Ignore root
next if ( $user =~ /^root$/i );
# Does the user exist?
if ( getpwnam($user) )
{
# Change shell.
if ($CONFIG->{ 'verbose' }) {
logprint_with_config("Changing shell for $user: $shell\n", $CONFIG);
}
system( "chsh", "-s", $shell, $user );
}
else
{
# Add a new user.
if ($CONFIG->{ 'verbose' }) {
logprint_with_config("Adding new user: $user\n", $CONFIG);
}
system( "useradd", "-s", $shell, $user );
}
#
# Add the entry to /etc/sudoers.
#
open( SUDOERS, ">>", "/etc/sudoers" ) or
warn "Failed to add user to sudoers file : $user - $!";
print SUDOERS
"$user ALL = NOPASSWD: /usr/sbin/xm, /usr/sbin/xl, /usr/bin/xen-create-image\n";
close(SUDOERS);
}
}
=head2 fail_with_config
=begin doc
Properly set $CONFIG{FAIL} on die
=end doc
=cut
sub fail_with_config ($$)
{
my ($text, $CONFIG) = (@_);
logprint_with_config($text, $CONFIG);
$CONFIG->{'FAIL'} = 1;
exit 127;
}
=head2 logonly_with_config
=begin doc
Print the given string to the logfile.
=end doc
=cut
sub logonly_with_config ($$)
{
my ($text, $CONFIG) = (@_);
if ( $CONFIG->{ 'hostname' } )
{
open( LOGFILE, '>>', '/var/log/xen-tools/'.$CONFIG->{'hostname'}.'.log' ) or
return;
print LOGFILE $text;
close(LOGFILE);
}
}
=head2 logprint_with_config
=begin doc
Print the given string both to our screen, and to the logfile.
=end doc
=cut
sub logprint_with_config ($$)
{
my ($text, $CONFIG) = (@_);
print $text;
logonly_with_config($text, $CONFIG);
}
=head1 AUTHORS
Steve Kemp, http://www.steve.org.uk/
Axel Beckert, http://noone.org/abe/
Dmitry Nedospasov, http://nedos.net/
Stéphane Jourdois
Merged from several scripts by Axel Beckert.
=cut
return 1;

View File

@@ -9,7 +9,6 @@ misc/
xen-tools - Bash completion code for our commands. xen-tools - Bash completion code for our commands.
xen-tools.spec - File to build an RPM of the xen-tools pacakge. xen-tools.spec - File to build an RPM of the xen-tools pacakge.
xm - Bash completion code for the Xen 'xm' command.
Steve Steve
-- --

View File

@@ -8,7 +8,7 @@
# #
use strict; use strict;
use Test::More qw( no_plan ); use Test::More;
# #
# Open and parse the xen-tools.conf configuration file. # Open and parse the xen-tools.conf configuration file.
@@ -51,7 +51,7 @@ foreach my $key ( sort keys %OPTIONS )
is( $found, 1 , " Found documentation for '$key'" ); is( $found, 1 , " Found documentation for '$key'" );
} }
done_testing();
=head2 parseConfigFile =head2 parseConfigFile
@@ -120,8 +120,6 @@ sub parseConfigFile
} }
=head2 readFile =head2 readFile
Read a named file and return an array of its contents. Read a named file and return an array of its contents.

View File

@@ -12,7 +12,7 @@
use strict; use strict;
use File::Find; use File::Find;
use Test::More qw( no_plan ); use Test::More;
# #
@@ -26,6 +26,7 @@ foreach my $file ( sort( glob "./bin/*-*" ) )
testFile( $file ); testFile( $file );
} }
done_testing();
# #
# Check that the given file implements all the option processing it # Check that the given file implements all the option processing it
@@ -41,7 +42,7 @@ sub testFile
# #
# Run the file with "--help" and capture the output. # Run the file with "--help" and capture the output.
# #
my $output = `$file --help`; my $output = `perl -Ilib $file --help`;
# #
# Parse out the options we accept # Parse out the options we accept

View File

@@ -8,7 +8,7 @@
use strict; use strict;
use Test::More qw( no_plan ); use Test::More;
use File::Temp; use File::Temp;
@@ -32,7 +32,7 @@ foreach my $dir ( glob( "hooks/*" ) )
} }
} }
done_testing();
# #
# If the given distribution has the following two files test them: # If the given distribution has the following two files test them:

View File

@@ -8,7 +8,7 @@
use strict; use strict;
use Test::More qw( no_plan ); use Test::More;
use File::Temp; use File::Temp;
@@ -33,7 +33,7 @@ foreach my $dir ( glob( "hooks/*" ) )
} }
} }
done_testing();
# #

View File

@@ -7,7 +7,7 @@
# #
use strict; use strict;
use Test::More 'no_plan', skip_all => '/etc/inittab not present'; use Test::More;
use File::Temp; use File::Temp;
use File::Copy; use File::Copy;
@@ -41,6 +41,7 @@ SKIP: {
} # SKIP } # SKIP
done_testing();
sub testHook sub testHook
{ {

View File

@@ -15,10 +15,6 @@ if ( $Config::Config{archname} =~ /64/ )
{ {
plan skip_all => "This test will fail upon 64 bit systems" ; plan skip_all => "This test will fail upon 64 bit systems" ;
} }
else
{
plan no_plan;
}
# #
# Rather than having a hardwired list of distributions to test # Rather than having a hardwired list of distributions to test
@@ -38,7 +34,7 @@ foreach my $dir ( glob( "hooks/*" ) )
} }
} }
done_testing();
# #

View File

@@ -7,7 +7,7 @@
# #
use strict; use strict;
use Test::More qw( no_plan ); use Test::More;
# #
@@ -28,7 +28,7 @@ foreach my $dir ( glob( "hooks/*" ) )
} }
} }
done_testing();
sub testDistroHooks sub testDistroHooks
{ {

View File

@@ -9,7 +9,7 @@
use strict; use strict;
use File::Find; use File::Find;
use Test::More qw( no_plan ); use Test::More;
# #
@@ -18,7 +18,7 @@ use Test::More qw( no_plan );
# #
find( { wanted => \&checkFile, no_chdir => 1 }, '.' ); find( { wanted => \&checkFile, no_chdir => 1 }, '.' );
done_testing();
# #
# Check a file. # Check a file.

View File

@@ -11,7 +11,7 @@
use strict; use strict;
use File::Find; use File::Find;
use Test::More qw/ no_plan /; use Test::More;
eval "use Moose"; eval "use Moose";
plan skip_all => "Moose required for testing Perl syntax" plan skip_all => "Moose required for testing Perl syntax"
@@ -24,6 +24,8 @@ plan skip_all => "Moose required for testing Perl syntax"
# #
find( { wanted => \&checkFile, no_chdir => 1 }, '.' ); find( { wanted => \&checkFile, no_chdir => 1 }, '.' );
done_testing();
# #
# Check a file. # Check a file.
# #
@@ -81,7 +83,7 @@ sub checkFile
# use strict "vars"; # use strict "vars";
# use strict "subs"; # use strict "subs";
# #
my $retval = system( "perl -Mstrict=subs -Mstrict=vars -c $file 2>/dev/null >/dev/null" ); my $retval = system( "perl -Mstrict=subs -Mstrict=vars -Ilib -c $file 2>/dev/null >/dev/null" );
is( $retval, 0, "Perl file passes our syntax check: $file" ); is( $retval, 0, "Perl file passes our syntax check: $file" );
} }

View File

@@ -9,7 +9,7 @@
use strict; use strict;
use Test::More qw( no_plan ); use Test::More;
# #
@@ -30,7 +30,7 @@ foreach my $dir ( glob( "hooks/*" ) )
} }
} }
done_testing();
=head2 testPlugins =head2 testPlugins

View File

@@ -8,7 +8,7 @@
# #
use strict; use strict;
use Test::More qw( no_plan ); use Test::More;
foreach my $file ( glob( "bin/*-*" ) ) foreach my $file ( glob( "bin/*-*" ) )
{ {
@@ -30,3 +30,4 @@ foreach my $file ( glob( "bin/*-*" ) )
} }
} }
done_testing();

View File

@@ -15,7 +15,7 @@
use strict; use strict;
use File::Find; use File::Find;
use Test::More qw( no_plan ); use Test::More;
# #
@@ -24,7 +24,7 @@ use Test::More qw( no_plan );
# #
find( { wanted => \&checkFile, no_chdir => 1 }, '.' ); find( { wanted => \&checkFile, no_chdir => 1 }, '.' );
done_testing();
# #
# Check a file. # Check a file.

View File

@@ -6,7 +6,7 @@
# -- # --
# #
use Test::More qw( no_plan ); use Test::More;
# #
@@ -44,3 +44,4 @@ foreach my $file ( @optional )
} }
} }
done_testing();

View File

@@ -10,7 +10,7 @@
use strict; use strict;
use File::Find; use File::Find;
use Test::More qw( no_plan ); use Test::More;
# #
@@ -23,7 +23,7 @@ $dir = "./hooks" if ( -d "./hooks" );
ok( defined( $dir ), "Found hook directory" ); ok( defined( $dir ), "Found hook directory" );
find( { wanted => \&checkFile, no_chdir => 1 }, $dir ); find( { wanted => \&checkFile, no_chdir => 1 }, $dir );
done_testing();
# #
# Check a file; if it is a shell script. # Check a file; if it is a shell script.

View File

@@ -9,7 +9,7 @@
use strict; use strict;
use File::Find; use File::Find;
use Test::More qw( no_plan ); use Test::More;
# #
@@ -18,7 +18,7 @@ use Test::More qw( no_plan );
# #
find( { wanted => \&checkFile, no_chdir => 1 }, '.' ); find( { wanted => \&checkFile, no_chdir => 1 }, '.' );
done_testing();
# #
# Check a file. # Check a file.

View File

@@ -9,7 +9,7 @@
use strict; use strict;
use File::Find; use File::Find;
use Test::More qw( no_plan ); use Test::More;
# #
@@ -37,6 +37,7 @@ foreach my $file (sort( glob ( $dir . "*" ) ) )
checkFile( $file ); checkFile( $file );
} }
done_testing();
# #
# Check a file. # Check a file.

View File

@@ -9,7 +9,7 @@
use strict; use strict;
use Test::More qw( no_plan ); use Test::More;
use File::Temp; use File::Temp;
@@ -75,7 +75,7 @@ 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.
# #
`./bin/xen-delete-image --test --dir=$dir $hostname`; `perl -I./lib -I../lib ./bin/xen-delete-image --test --no-xen-ok --dir=$dir $hostname`;
# #
@@ -91,3 +91,5 @@ ok( ! -e $domains . "/" . $hostname . "/" . "swap.img",
# #
ok( ! -d $domains . "/" . $hostname, ok( ! -d $domains . "/" . $hostname,
"The hostname directory was removed" ); "The hostname directory was removed" );
done_testing();

View File

@@ -10,7 +10,7 @@
use strict; use strict;
use Test::More qw( no_plan ); use Test::More;
use File::Temp; use File::Temp;
@@ -26,7 +26,7 @@ testRandomInstance( "bar.my.flat", 1 );
testRandomInstance( "baz.my.flat", 0 ); testRandomInstance( "baz.my.flat", 0 );
testRandomInstance( "baz.my.flat", 1 ); testRandomInstance( "baz.my.flat", 1 );
done_testing();
=head2 testRandomInstance =head2 testRandomInstance
@@ -98,7 +98,7 @@ EOS
# Now run the xen-list-images script to make sure we can read # Now run the xen-list-images script to make sure we can read
# the relevant details back from it. # the relevant details back from it.
# #
my $cmd = "./bin/xen-list-images --test=$dir"; my $cmd = "perl -I./lib -I../lib ./bin/xen-list-images --test=$dir";
my $output = `$cmd`; my $output = `$cmd`;
ok( defined( $output ) && length( $output ), "Runing the list command produced some output" ); ok( defined( $output ) && length( $output ), "Runing the list command produced some output" );

View File

@@ -9,7 +9,7 @@
use strict; use strict;
use Test::More qw( no_plan ); use Test::More;
use File::Temp; use File::Temp;
@@ -107,7 +107,7 @@ noMentionOf( "phy:",
done_testing();