]> xenbits.xensource.com Git - osstest.git/commitdiff
ms-planner: Propagate a booking's Job to the plan
authorIan Campbell <ian.campbell@citrix.com>
Wed, 1 Apr 2015 16:55:12 +0000 (17:55 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 7 Sep 2015 16:43:46 +0000 (17:43 +0100)
This needs to be done in several places:

- When booking resources (cmd: book-resources), to initially propagate
  from the booking (e.g. from ts-hosts-allocate-Executive's input).
- On reset (cmd: reset) so that the Events corresponding to actual
  allocations retain their Job.
- When retrieving the plan (cmd: get-plan), so it would be available
  for logging etc.

The Job is added by a following patch "ts-hosts-allocate-Executive:
Add the requesting Job to the booking".

This patch has been deployed on the Cambridge instance for testing
with no ill-effects.

cmd_reset does not include a ->Job for jobs which are "(preparing)",
corresponding to a job which is going to use a shared host which is
currently being installed by another job. I was unable to figure out a
way to include these.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
README.planner
ms-planner

index ec4dce824e1303c5ebefb82a5b934ce49be4c1c3..73e97ea02d72d3d5f6b908efb6c888c5cc93060f 100644 (file)
@@ -213,6 +213,7 @@ Plan is:
                        End     abs planned end time, *
                                 omitted for rogue tasks
                        Live    boolean, for reporting purposes only
+                       Job     flight.job which made the allocation
 
        Events
                map from
@@ -231,6 +232,7 @@ Plan is:
                                                Shareix
                                                Task
                                                Live
+                       Job     flight.job which made the allocation
 
        * = internal to plan
        ** = computed by launder_check_plan
index 1dd01a95ba829a61f1e06759faf46f0054551698..02a5464c670ab5919b3259516fefaece1a4abcba 100755 (executable)
@@ -350,16 +350,19 @@ END
                      Shareix => $shareix,
                      Live => $alloc->{Live},
                     );
-        
+
+       my $job = $alloc->{Job};
        push @{ $plan->{Events}{$reso} }, {
            Time => $alloc->{Start},
            Info => $alloc->{Info},
+           ($job ? (Job => $job) : ()),
            Type => Start,
            ($share ? (Share => { %$share }) : ()),
            Allocated => { @ealloc },
        }, {
            Time => $end_exptd,
            Info => $alloc->{Info},
+           ($job ? (Job => $job) : ()),
            Type => End,
            ($share ? (Share => { %$share }) : ()),
            Allocated => { @ealloc },
@@ -385,10 +388,12 @@ sub cmd_get_plan () {
        my @jevts;
        foreach my $evt (@$evts) {
            my $share= $evt->{Share};
+           my $job= $evt->{Job};
            push @jevts, {
                Time => $evt->{Time} - $plan->{Start},
                Type => $evt->{Type},
                Avail => $evt->{Avail},
+               ($job ? (Job => $job) : ()),
                ($share ? (Share => $share) : ()),
            };
        }
@@ -450,6 +455,7 @@ sub cmd_book_resources () {
        my $starttime= parse_reltime2abs($jbook->{Start});
        my $endtime= parse_reltime2abs($jbook->{End});
        my $reso= parse_reso($jbook->{Reso});
+       my $job= $jbook->{Job};
 
        die unless $starttime < $endtime;
 
@@ -483,6 +489,7 @@ sub cmd_book_resources () {
                 Start => $starttime,
                 End => $endtime,
                 Live => 1,
+                ($job ? (Job => $job) : ()),
             };
        }
 
@@ -491,6 +498,7 @@ sub cmd_book_resources () {
                Info => $info,
                (@share ? (Share => { @share }) : ()),
                (@alloc ? (Allocated => { @alloc }) : ()),
+               ($job ? (Job => $job) : ()),
                @_,
            };
        };