From: Ian Jackson Date: Mon, 4 Oct 2021 16:44:48 +0000 (+0100) Subject: mg-allocate: Add --dry-run mode X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7f22e28f7e2e57496f1e0cbf6a7023238c40b901;p=osstest.git mg-allocate: Add --dry-run mode Signed-off-by: Ian Jackson --- diff --git a/mg-allocate b/mg-allocate index 8eca59e..7dc2c76 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 # Run as the task (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();