[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OSSTEST PATCH 4/6] mg-allocate: Add --dry-run mode



Signed-off-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
---
 mg-allocate | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/mg-allocate b/mg-allocate
index 8eca59e2c..7dc2c7650 100755
--- a/mg-allocate
+++ b/mg-allocate
@@ -26,6 +26,8 @@
 #   -U             allocate with high priority (makes sense with
 #                  specified duration only)
 #
+#   --dry-run      Do not actually allocate, just check feasibility.
+#
 #   --as <task-spec>
 #                  Run as the task <task-spec> (rather than looking
 #                  at OSSTEST_TASK).  Allocation will allocate
@@ -93,6 +95,7 @@ $|=1;
 
 our $tid;
 our %magictask;
+our $dry_run;
 our $list_only;
 our $donate_spec;
 our $donate_taskid;
@@ -536,6 +539,8 @@ while (@ARGV && $ARGV[0] =~ m/^[-0-9]/) {
         } elsif (s/^\-l/-/ || s/^--list$/--/) {
            $list_only++;
            die "-l may be repeated only thrice\n" if $list_only > 3;
+        } elsif (s/^--dry-run$/-/) {
+           $dry_run= 1;
         } elsif (s/^--as$/-/) {
            die "--as needs task\n" unless @ARGV;
            $ENV{OSSTEST_TASK} = shift @ARGV;
@@ -653,7 +658,9 @@ sub precheck () {
     execute(1);
 }
 
-if ($duration) {
+if ($dry_run) {
+    precheck();
+} elsif ($duration) {
     die "--donate and --steal are incompatible with the planning system\n"
         if @steal_specs || defined $donate_spec;
     precheck();
-- 
2.20.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.