]> xenbits.xensource.com Git - osstest.git/commitdiff
Manual allocation: Provide JobInfo in mg-blockage
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 8 Sep 2015 10:30:29 +0000 (11:30 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 8 Sep 2015 10:31:08 +0000 (11:31 +0100)
Supply most of the information about our allocations in JobInfo,
rather than Xinfo.  And, correspondingly, rename all the variables
`xinfo' to `info'.

Supply only the supplied hostname as the Xinfo.  This is slightly
redundant but it does at least tell us what came out of the db.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
v2: New patch
v3: Refreshed so no longer needs to incidentally fix `joinfo'.

mg-blockage

index 0cad6d20e6cabdeed878e6f9a9c1bd68629c5d46..90547a588363305c3d38b6ae22714eb748119771 100755 (executable)
@@ -14,7 +14,7 @@ csreadconfig();
 die unless @ARGV==3 || @ARGV==4;
 die if $ARGV[0] =~ m/^=/;
 
-our ($start,$end,$hostflag,$mxinfo) = @ARGV;
+our ($start,$end,$hostflag,$minfo) = @ARGV;
 
 sub parsedate ($) {
     open D, "-|", qw(date +%s -d), @_ or die $!;
@@ -24,13 +24,13 @@ sub parsedate ($) {
     return $r;
 }
 
-my $basexinfo = manual_allocation_base_jobinfo();
-my $xinfo = "blockage $basexinfo [$start .. $end]";
-$xinfo .= " $mxinfo" if defined $mxinfo;
+my $baseinfo = manual_allocation_base_jobinfo();
+my $info = "blockage $baseinfo [$start .. $end]";
+$info .= " $minfo" if defined $minfo;
 
 $start = parsedate $start;
 $end   = parsedate $end;
-print $xinfo, "\n" or die $!;
+print $info, "\n" or die $!;
 
 die unless $end > $start;
 
@@ -38,7 +38,7 @@ sub min { (sort @_)[0]; }
 sub max { (reverse sort @_)[0]; }
 
 sub plan () {
-    alloc_resources(sub {
+    alloc_resources(JobInfo => $info, sub {
        my ($plan, $mayalloc) = @_;
 
        my $now = time;
@@ -72,7 +72,7 @@ END
                foreach (my $ix=0; $ix<$avail; $ix++) {
                    my $booking =  {
                        Reso => $res->{restype}.' '.$res->{resname},
-                       Xinfo => $xinfo,
+                       Xinfo => $host,
                        Start => $bookstart - $now,
                        End => $bookend - $now,
                    };