|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4/8] mg-allocate: Provide --stdout-output
This prints RESTYPE/RESNAME/SHAREIX to stdout, after allocation is
successful (outside the db retry loop). This means that a
programmatic caller can now tell what was allocated, even if the spec
was complex.
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
mg-allocate | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mg-allocate b/mg-allocate
index f895af2..287823a 100755
--- a/mg-allocate
+++ b/mg-allocate
@@ -93,6 +93,7 @@ our $donate_spec;
our $donate_taskid;
our @steal_specs;
our %steal_taskids;
+our $stdout_output;
sub alloc_prep () {
$tid= findtask();
@@ -329,6 +330,7 @@ END
}
return ($ok, { Allocate => $allocate,
Shareix => $got_shareix,
+ Report => "$restype/$resname/$got_shareix",
Info => "$resname ($restype/$resname/$got_shareix)"
});
}
@@ -352,6 +354,10 @@ sub loggot {
"DEALLOCATED").
": ".$_->{Info})
foreach @got;
+ if ($stdout_output) {
+ print $_->{Report}, "\n" or die $!
+ foreach @got;
+ }
}
sub execute (;$) {
@@ -515,6 +521,8 @@ while (@ARGV && $ARGV[0] =~ m/^[-0-9]/) {
} elsif (s/^--steal$/-/) {
die "--steal needs task\n" unless @ARGV;
push @steal_specs, shift @ARGV;
+ } elsif (s/^--stdout-output$/-/) {
+ $stdout_output = 1;
} else {
die "bad option \`$_'";
}
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |