diff --git a/TODO.markdown b/TODO.markdown index 033ccf0..131c3ed 100644 --- a/TODO.markdown +++ b/TODO.markdown @@ -171,9 +171,6 @@ Bugs to fix and features to add for 5.0 * Make used Xen toolstack configurable, i.e. via --xen-toolstack=xl -* Support Xen xl toolstack elsewhere than xen-create-image. Needs code - deduplication as mentioned below. - * Code Deduplication / Refactor the code for less code duplication `bin/x*` currently contain the same or similar code like e.g. in the diff --git a/bin/xen-delete-image b/bin/xen-delete-image index 81c6895..5f11d75 100755 --- a/bin/xen-delete-image +++ b/bin/xen-delete-image @@ -221,7 +221,7 @@ E_O_ROOT # while ( my $name = shift ) { - if ( !xenRunning($name) ) + if ( !xenRunning($name, \%CONFIG) ) { deleteXenImage($name); } @@ -237,7 +237,7 @@ while ( my $name = shift ) my $hosts = $CONFIG{ 'hostname' }; foreach my $name (@$hosts) { - if ( !xenRunning($name) ) + if ( !xenRunning($name, \%CONFIG) ) { deleteXenImage($name); } diff --git a/bin/xen-resize-guest b/bin/xen-resize-guest index c9c41d8..c7d093e 100755 --- a/bin/xen-resize-guest +++ b/bin/xen-resize-guest @@ -405,7 +405,7 @@ EOF # # 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"; exit 1; diff --git a/bin/xen-update-image b/bin/xen-update-image index 5f875ae..8e8f57f 100755 --- a/bin/xen-update-image +++ b/bin/xen-update-image @@ -169,7 +169,7 @@ E_O_ROOT # while ( my $name = shift ) { - if ( !xenRunning($name) ) + if ( !xenRunning($name, \%CONFIG) ) { updateXenImage($name); } diff --git a/debian/changelog b/debian/changelog index 9e59237..73bf18f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,7 +11,7 @@ xen-tools (4.3.1+dev-1) UNRELEASED; urgency=low - 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 only so far) + - 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. diff --git a/lib/Xen/Tools/Common.pm b/lib/Xen/Tools/Common.pm index a68da0b..48482d7 100644 --- a/lib/Xen/Tools/Common.pm +++ b/lib/Xen/Tools/Common.pm @@ -116,14 +116,16 @@ sub readConfigurationFile ($$) =cut -sub xenRunning ($) +sub xenRunning ($$) { - my ($hostname) = (@_); + my ($hostname, $CONFIG) = (@_); my $running = 0; - open( CMD, "xm list $hostname 2>/dev/null |" ) or - die "Failed to run 'xm list $hostname'"; + die "Couldn't determine Xen toolstack" unless $CONFIG->{'xm'}; + + open( CMD, $CONFIG->{'xm'}." list $hostname 2>/dev/null |" ) or + die "Failed to run '".$CONFIG->{'xm'}." list $hostname'"; while () { my $line = $_;