From 2c020323f6c984bc0c2835c9805afcda1907e9d6 Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Mon, 28 Oct 2013 22:28:40 +0100 Subject: [PATCH] Refactoring: xt-create-xen-config: Use s/// to strip trailing MB size suffixes --- bin/xt-create-xen-config | 10 ++-------- debian/changelog | 2 ++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/bin/xt-create-xen-config b/bin/xt-create-xen-config index df8d0a7..a47a741 100755 --- a/bin/xt-create-xen-config +++ b/bin/xt-create-xen-config @@ -369,10 +369,7 @@ sub createXenConfig # # Remove any trailing Mb. # - if ( $ENV{ 'memory' } =~ /^(\d+)Mb?.*$/i ) - { - $ENV{ 'memory' } = $1; - } + $ENV{ 'memory' } =~ s/^(\d+)Mb?.*$/$1/i; # # The maxmem size: Convert Gb -> Mb. @@ -387,10 +384,7 @@ sub createXenConfig # # Remove any trailing Mb. # - if ( $ENV{ 'maxmem' } =~ /^(\d+)Mb?.*$/i ) - { - $ENV{ 'maxmem' } = $1; - } + $ENV{ 'maxmem' } =~ s/^(\d+)Mb?.*$/$1/i; } # diff --git a/debian/changelog b/debian/changelog index 088bebd..7d482d4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -30,6 +30,8 @@ xen-tools (4.4~dev-1) UNRELEASED; urgency=low * Abort early and with proper error message if "xen-delete-image --test" is not used with "--dir". (Closes: #704878) * xen-delete-image: Exit with return code != 0 in all error cases. + * Refactoring: xt-create-xen-config: Use s/// to strip trailing MB size + suffixes. * Bump Standards-Version to 3.9.5 (no changes). -- Axel Beckert Fri, 23 Aug 2013 21:13:07 +0200