]> xenbits.xensource.com Git - osstest.git/commitdiff
mg-allocate: Add --dry-run mode
authorIan Jackson <iwj@xenproject.org>
Mon, 4 Oct 2021 16:44:48 +0000 (17:44 +0100)
committerIan Jackson <iwj@xenproject.org>
Mon, 4 Oct 2021 16:49:48 +0000 (17:49 +0100)
Signed-off-by: Ian Jackson <iwj@xenproject.org>
mg-allocate

index 8eca59e2c5e95a6330ed34f1a5d135aac0a41727..7dc2c7650863f0d9ccd3f612671cd89650febbc3 100755 (executable)
@@ -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();