* [PATCH OSSTEST v2] cs-adjust-flight: Add jobs-rename command which applies a perlop to job names
@ 2016-01-19 12:47 Ian Campbell
2016-01-19 14:25 ` Ian Jackson
0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2016-01-19 12:47 UTC (permalink / raw)
To: ian.jackson, xen-devel; +Cc: Ian Campbell
My intention was to allow creation of adhoc jobs based on a template
but modified e.g. to enable/disable XSM with a sequence something
like:
./cs-adjust-flight $flight copy-jobs $template test-foo-xsm
./cs-adjust-flight $flight jobs-rename test-foo-xsm 's/-xsm$//'
./cs-adjust-flight $flight runvar-set $job enable_xsm false
./cs-adjust-flight ... update %buildjob
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: s/job-rename/jobs-rename/
I left job-status alone.
---
cs-adjust-flight | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/cs-adjust-flight b/cs-adjust-flight
index a72cd88..04f5a7e 100755
--- a/cs-adjust-flight
+++ b/cs-adjust-flight
@@ -18,6 +18,7 @@
# intended-blessing <intended-blessing>
# branch-set <new-branch>
# job-status <job-spec>
+# jobs-rename <job-spec> <perl-expr>
#
# <foo-spec>:
# <foo-name>
@@ -371,6 +372,29 @@ END
});
}
+sub change__jobs_rename {
+ die unless @changes >= 2;
+ my $jobs = shift @changes;
+ my $perlop = shift @changes;
+
+ my $jobq = $dbh_tests->prepare(<<END);
+ UPDATE jobs
+ SET job = ?
+ WHERE flight = ? AND job = ?
+END
+ my $runvarq = $dbh_tests->prepare(<<END);
+ UPDATE runvars
+ SET job = ?
+ WHERE flight = ? AND job = ?
+END
+ for_jobs($dstflight, $jobs, sub {
+ my ($oldjob) = @_;
+ my $newjob = perlop_value ($oldjob, '', $perlop, $oldjob);
+ print "$oldjob renamed to $newjob\n";
+ $jobq->execute($newjob, $dstflight, $oldjob);
+ $runvarq->execute($newjob, $dstflight, $oldjob);
+ })
+}
sub changes () {
debug("CHANGES...\n");
--
2.6.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH OSSTEST v2] cs-adjust-flight: Add jobs-rename command which applies a perlop to job names
2016-01-19 12:47 [PATCH OSSTEST v2] cs-adjust-flight: Add jobs-rename command which applies a perlop to job names Ian Campbell
@ 2016-01-19 14:25 ` Ian Jackson
2016-01-19 14:36 ` Ian Campbell
0 siblings, 1 reply; 4+ messages in thread
From: Ian Jackson @ 2016-01-19 14:25 UTC (permalink / raw)
To: Ian Campbell; +Cc: xen-devel
Ian Campbell writes ("[PATCH OSSTEST v2] cs-adjust-flight: Add jobs-rename command which applies a perlop to job names"):
> My intention was to allow creation of adhoc jobs based on a template
> but modified e.g. to enable/disable XSM with a sequence something
> like:
...
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
I know I acked this, and my next observations don't mean we shouldn't
apply it as-is, but:
> + UPDATE jobs
> + SET job = ?
> + WHERE flight = ? AND job = ?
> +END
This can be applied to flights in intended blessing `play' in
blessings later than `constructing', or via `running:F' to running
flights.
And if that happens, there might be entries in the steps table which
ought also to be renamed. If you don't rename them you will trip the
foreign key constraint.
I think a similar problem exists with jobs_del.
Note that this constraint is INITIALLY IMMEDIATE. If we were to make
it INITIALLY DEFERRED then this code would become dangerous, because
./cs-adjust-flight F jobs-rename x 's/x/y/' copy-jobs G x
would leave F.x containing the steps from the old x but the
recipe and runvars from G.x. But I don't think INITIALLY DEFERRED is
a good default for constraints so this is probably not relevant.
Ian.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH OSSTEST v2] cs-adjust-flight: Add jobs-rename command which applies a perlop to job names
2016-01-19 14:25 ` Ian Jackson
@ 2016-01-19 14:36 ` Ian Campbell
[not found] ` <22174.19392.695718.990474@mariner.uk.xensource.com>
0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2016-01-19 14:36 UTC (permalink / raw)
To: Ian Jackson; +Cc: xen-devel
On Tue, 2016-01-19 at 14:25 +0000, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH OSSTEST v2] cs-adjust-flight: Add jobs-
> rename command which applies a perlop to job names"):
> > My intention was to allow creation of adhoc jobs based on a template
> > but modified e.g. to enable/disable XSM with a sequence something
> > like:
> ...
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
>
> I know I acked this, and my next observations don't mean we shouldn't
> apply it as-is, but:
>
> > + UPDATE jobs
> > + SET job = ?
> > + WHERE flight = ? AND job = ?
> > +END
>
> This can be applied to flights in intended blessing `play' in
> blessings later than `constructing', or via `running:F' to running
> flights.
>
> And if that happens, there might be entries in the steps table which
> ought also to be renamed. If you don't rename them you will trip the
> foreign key constraint.
But fail immediately in this invocation of cs-adjust-flight with a
(hopefully) comprehensible SQL error spew?
Or is that the distinction between INNTIALLY IMMEDIATE vs DEFERRED you were
trying to get at?
Having stuffed the flight in this way would it have effects elsewhere (i.e.
on production flights) or do you just get to keep both pieces of this
particular flight?
>
> I think a similar problem exists with jobs_del.
>
> Note that this constraint is INITIALLY IMMEDIATE. If we were to make
> it INITIALLY DEFERRED then this code would become dangerous, because
> ./cs-adjust-flight F jobs-rename x 's/x/y/' copy-jobs G x
> would leave F.x containing the steps from the old x but the
> recipe and runvars from G.x. But I don't think INITIALLY DEFERRED is
> a good default for constraints so this is probably not relevant.
>
> Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-19 14:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-19 12:47 [PATCH OSSTEST v2] cs-adjust-flight: Add jobs-rename command which applies a perlop to job names Ian Campbell
2016-01-19 14:25 ` Ian Jackson
2016-01-19 14:36 ` Ian Campbell
[not found] ` <22174.19392.695718.990474@mariner.uk.xensource.com>
2016-01-19 14:58 ` Ian Campbell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.