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

[Xen-devel] [PATCH OSSTEST v2 1/5] ms-planner: Propagate a booking's Job to the plan



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 there Job.
- When retrieving the plan (cmd: get-plan), so it would be available
  for logging etc (I don't think this is currently used)

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@xxxxxxxxxx>
---
 README.planner |  2 ++
 ms-planner     | 10 +++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/README.planner b/README.planner
index ec4dce8..73e97ea 100644
--- a/README.planner
+++ b/README.planner
@@ -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
diff --git a/ms-planner b/ms-planner
index 1dd01a9..02a5464 100755
--- a/ms-planner
+++ b/ms-planner
@@ -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) : ()),
                @_,
            };
        };
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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