1
0
mirror of synced 2026-02-03 06:50:26 +00:00

Pass --yes to lvcreate only if LVM version is 2.02.99 or higher

Fixes regression introduced with 4.5 by the fix for #754517. The
regression has been reported upstream at
http://xen-tools.org/pipermail/xen-tools-discuss/2015-January/001079.html

Uses Sort::Versions for that. So add a new (build-)dependency on
libsort-versions-perl in the Debian package.
This commit is contained in:
Axel Beckert
2015-07-03 19:06:16 +02:00
parent d49f4568fc
commit 4434acc7d9
4 changed files with 34 additions and 11 deletions

View File

@@ -1,16 +1,6 @@
KNOWN BUGS in xen-tools
=======================
Bugs to fix before next release
-------------------------------
* Older versions of LVM don't understand `--yes` while newer versions
require it. The fix for the latter
([Debian bug report 754517](https://bugs.debian.org/754517))
introduced a regression with older LVM versions, e.g. on Debian 7
Wheezy. There's likely an LVM version check and an according switch
necessary.
Bugs to fix rather soon
-----------------------

View File

@@ -806,6 +806,7 @@ use Data::Validate::IP qw/ is_ipv4 /;
use Data::Validate::Domain qw/ is_hostname /;
use Term::UI;
use Term::ReadLine;
use Sort::Versions;
use Xen::Tools::Common;
@@ -3047,6 +3048,31 @@ sub createLVMBits
}
}
#
# For the calls to lvcreate below, we first need to check for the
# version of LVM running as their have been incompatible API
# changes somewhere between "2.02.95(2) (2012-03-06)" in Debian 7
# Wheezy and "2.02.111(2) (2014-09-01)" in Debian 8 Jessie. *sigh*
#
# See https://bugs.debian.org/754517
#
# I currently assume that all LVM version starting with 2.02.99
# should be fine with passing --yes as that version has an
# upstream changelog entry "Accept --yes in all commands so test
# scripts can be simpler".
#
# Assumes --yes is necessary if the LVM version can't be parsed.
my $lvm_needs_yes = 1;
my $lvm_version_output = `lvm version`;
if ($lvm_version_output =~ /^\s*LVM\s*version:\s*(\d[.\d]*)[\s(]/) {
my $lvm_version = $1;
my $no_yes_below_version = '2.02.99';
$lvm_needs_yes =
versioncmp($lvm_version, $no_yes_below_version) >= 0;
}
foreach my $partition (@PARTITIONS)
{
my $disk = $CONFIG{ 'hostname' } . '-' . $partition->{ 'name' };
@@ -3062,7 +3088,9 @@ sub createLVMBits
# The commands to create the volume.
#
my $disk_cmd =
"lvcreate $CONFIG{'lvm'} --yes -L $partition->{'size'} -n $disk";
"lvcreate $CONFIG{'lvm'} ".
($lvm_needs_yes ? '--yes' : '').
" -L $partition->{'size'} -n $disk";
#
# Create the volume

3
debian/changelog vendored
View File

@@ -29,6 +29,9 @@ xen-tools (4.5+dev-1) UNRELEASED; urgency=medium
+ Split off hardcoded release code names list and default mirrors in
xen-create-image into separate configuration file which are parsed
before the default settings or command-line options are set.
+ Pass --yes to lvcreate only if LVM version is 2.02.99 or
higher. Fixes regression introduced with 4.5 by the fix for #754517.
- Add new (build-)dependency on libsort-versions-perl.
* Update Vcs-* headers as Gitorious will close its doors in June.
* Recommend debian-archive-keyring (for installing Debian DomUs on
derivatives) and ubuntu-archive-keyring (for installing Ubuntu DomUs

2
debian/control vendored
View File

@@ -12,6 +12,7 @@ Build-Depends: debhelper (>= 9~),
libfile-which-perl,
liblog-message-perl | perl (<< 5.17.0),
libterm-ui-perl | perl (<< 5.17.0),
libsort-versions-perl,
libtest-notabs-perl,
libtest-pod-coverage-perl,
libtest-pod-perl,
@@ -30,6 +31,7 @@ Depends: debootstrap | cdebootstrap,
libdata-validate-uri-perl,
libfile-slurp-perl,
libfile-which-perl,
libsort-versions-perl,
libterm-ui-perl | perl (<< 5.17.0),
libtext-template-perl,
openssh-client,