diff --git a/KNOWN_BUGS.markdown b/KNOWN_BUGS.markdown index 88ba793..ca3aae2 100644 --- a/KNOWN_BUGS.markdown +++ b/KNOWN_BUGS.markdown @@ -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 ----------------------- diff --git a/bin/xen-create-image b/bin/xen-create-image index 4ab27c7..eae810a 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -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 diff --git a/debian/changelog b/debian/changelog index 8fc3cab..108cd71 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/debian/control b/debian/control index c8f3024..cfbfda5 100644 --- a/debian/control +++ b/debian/control @@ -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,