]> xenbits.xensource.com Git - people/iwj/osstest.git/log
people/iwj/osstest.git
8 years agonetboot: Change pxe to netboot in comments, docs and messages
Ian Jackson [Tue, 17 Jan 2017 18:16:35 +0000 (18:16 +0000)]
netboot: Change pxe to netboot in comments, docs and messages

UEFI grub netbooting is not PXE.  Indeed PXE is a BIOS thing only.

No functional change other than to messages.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agonetboot: Rename pxeboot functions
Ian Jackson [Tue, 17 Jan 2017 18:13:29 +0000 (18:13 +0000)]
netboot: Rename pxeboot functions

 git-ls-files | xargs perl -i~ -pe 's/\bsetup_pxeboot_/setup_netboot_/g'
 git-ls-files | xargs perl -i~ -pe 's/\bsetup_pxelinux_/setup_netboot_/g'

No functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agonetboot: Rework interface to host_netboot_file (was host_pxefile)
Ian Jackson [Tue, 17 Jan 2017 18:01:16 +0000 (18:01 +0000)]
netboot: Rework interface to host_netboot_file (was host_pxefile)

* Now it takes the tail of the template key (currently, normally
  `Templates') rather than the whole of it (`PxeTemplates'); the
  `Pxe' part is implied.

* Now it normally returns the whole path, including PxeDir, which the
  caller is no longer expected to prepend.  In any case, it supplies
  the dir value.

* Rename it.

* All call sites adjusted.

Overall, no functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agopxe templates: Do defaulting outside host_pxefile
Ian Jackson [Tue, 17 Jan 2017 17:31:15 +0000 (17:31 +0000)]
pxe templates: Do defaulting outside host_pxefile

host_pxefile now returns undef if the specified $templatekey is not
configured, rather than defaulting to the plain PxeTemplates.

This is going to useful because we want host_pxefile not to hardcode
the default: with netgrub, the settings are all different.

If $templatekey is 'PxeTemplates' then this only has any effect if the
PxeTempltes is not defined - ie, a broken case.

There is one place where $templatekey is not 'PxeTemplates', in
mg-hosts.  The defaulting to the value of PxeTemplates now occurs there.

So, overall, no functional change in non-broken cases.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agod-i grub: Extend UEFI workaround to stretch
Ian Jackson [Tue, 17 Jan 2017 15:16:17 +0000 (15:16 +0000)]
d-i grub: Extend UEFI workaround to stretch

Debian bug #789798 remains open.  I have pinged the blocking bug in
grub2, #792547.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agod-i: Cope if .ssh already exists (in /target/root/ and also /home/...)
Ian Jackson [Tue, 17 Jan 2017 15:13:40 +0000 (15:13 +0000)]
d-i: Cope if .ssh already exists (in /target/root/ and also /home/...)

Use mkdir -p in both cases.  Otherwise these late_commands may fail.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agobackports handling: Cope with dtbs in subdirs
Ian Jackson [Tue, 17 Jan 2017 15:29:31 +0000 (15:29 +0000)]
backports handling: Cope with dtbs in subdirs

Some of the arm64 kernels have backports in subdirectories.  So use a
find rune instead of a plain mv.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agobackports handling: Make backports initramfs-tools optional
Ian Jackson [Fri, 16 Dec 2016 18:22:42 +0000 (18:22 +0000)]
backports handling: Make backports initramfs-tools optional

If mg-debian-installer-update decided not to provide an initramfs.deb,
just skip that.

No functional change with earlier d-i fetches produced by existing
versions of mg-debian-installer-update.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agobackports handling: Refactor kernel deb handling
Ian Jackson [Tue, 17 Jan 2017 15:08:21 +0000 (15:08 +0000)]
backports handling: Refactor kernel deb handling

Introduce private function $kdeb->().  No functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agomg-debian-installer-update: backports: Provide crypto
Ian Jackson [Thu, 19 Jan 2017 19:49:00 +0000 (19:49 +0000)]
mg-debian-installer-update: backports: Provide crypto

Filesystem drivers now refer to this.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agomg-debian-installer-update: backports: Add modules for EFI
Ian Jackson [Thu, 19 Jan 2017 19:48:19 +0000 (19:48 +0000)]
mg-debian-installer-update: backports: Add modules for EFI

UEFI uses vfat for the boot partiton.
This also means we need some charset modules.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agomg-debian-installer-update: backports: Provide pps and ptp
Ian Jackson [Tue, 17 Jan 2017 15:02:09 +0000 (15:02 +0000)]
mg-debian-installer-update: backports: Provide pps and ptp

Our ARM64 softiron boxes need these to find their network and disks.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agomg-debian-installer-update: Log our version into our output
Ian Jackson [Thu, 19 Jan 2017 19:47:16 +0000 (19:47 +0000)]
mg-debian-installer-update: Log our version into our output

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agomg-debian-installer-update: Print working directory to stderr
Ian Jackson [Tue, 17 Jan 2017 15:01:59 +0000 (15:01 +0000)]
mg-debian-installer-update: Print working directory to stderr

No other change

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agomg-debian-installer-update: Break out default setting of src=
Ian Jackson [Wed, 4 Jan 2017 17:37:44 +0000 (17:37 +0000)]
mg-debian-installer-update: Break out default setting of src=

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agots-host-install: NTP not honoured bug remains
Ian Jackson [Wed, 4 Jan 2017 18:23:30 +0000 (18:23 +0000)]
ts-host-install: NTP not honoured bug remains

Debian #778564 remains open.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agots-host-install: Expect "pool" in ntp.conf, not only "server"
Ian Jackson [Wed, 4 Jan 2017 18:22:51 +0000 (18:22 +0000)]
ts-host-install: Expect "pool" in ntp.conf, not only "server"

This is helpful for playing around with stretch, which seems to use
this option by default.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agoSerial console: honour LinuxSerialConsole in bootloader setup
Ian Jackson [Tue, 3 Jan 2017 15:52:33 +0000 (15:52 +0000)]
Serial console: honour LinuxSerialConsole in bootloader setup

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agotimeouts: Honour TimeoutFactor host property
Ian Jackson [Fri, 20 Jan 2017 11:57:27 +0000 (11:57 +0000)]
timeouts: Honour TimeoutFactor host property

This gives us a single place to say that a host is particularly slow.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agotimeouts: Call target_adjust_timeout for all build commands
Ian Jackson [Fri, 20 Jan 2017 11:55:53 +0000 (11:55 +0000)]
timeouts: Call target_adjust_timeout for all build commands

Currently this has no real effect, because the only place where a
timeout factor is specified is nested L1s and we do not run build
commands on those.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agotimeouts: Refactor target_adjust_timeout to have $adjust->(), and log
Ian Jackson [Fri, 20 Jan 2017 11:54:34 +0000 (11:54 +0000)]
timeouts: Refactor target_adjust_timeout to have $adjust->(), and log

If a timeout is adjusted, print a log message.  We are going to want
to reuse this logic in a moment.

Do the defaulting in $adjust->() rather than passing 1 as a default
to the lookup functions, which is slightly neater.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agoproduction-config-*: Update TftpDiVersion_jessie
Ian Jackson [Mon, 16 Jan 2017 17:33:55 +0000 (17:33 +0000)]
production-config-*: Update TftpDiVersion_jessie

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agocrontab: Add linux-linux again
Ian Jackson [Mon, 16 Jan 2017 11:35:20 +0000 (11:35 +0000)]
crontab: Add linux-linux again

Partially revert
  6ae3447b773d87a9794446fcdd2a11ada6b88c0b
  crontab: Drop linux-mingo-tip-master linux-next linux-linus

Conflicts:
crontab

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agots-xen-install: Pass `noreboot' to Xen
Ian Jackson [Thu, 22 Dec 2016 13:43:01 +0000 (13:43 +0000)]
ts-xen-install: Pass `noreboot' to Xen

This prevents Xen from rebooting the host, if Xen crashes.

This reboot serves no function in osstest, since a crashed host will
be automatically power cycled to recover it.  (Firstly, during log
collection, a renewed attempt to boot from the hard disk; then, during
the next test, netboot to wipe the machine to reinstall it.)

But the reboot does make logs more confusing, and we suspect that the
reboot loops which can occur (eg if the version of Xen and Linux being
tested always crashes on boot) might be implicated in our test boxes
occasionally forgetting their boot order.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agodb retry: Retry on $dbh->state eq ''
Ian Jackson [Tue, 20 Dec 2016 18:20:35 +0000 (18:20 +0000)]
db retry: Retry on $dbh->state eq ''

This is supposed to represent success.  But now that _need_retry is
only called within a HandleError hook, we know there has been a
failure.

Retry such failures, in the hope that they are stochastic.  If they
aren't, we will fail eventually when we run out of retries.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agodb retry: Use HandleError and exceptions to detect when to retry
Ian Jackson [Tue, 20 Dec 2016 17:15:26 +0000 (17:15 +0000)]
db retry: Use HandleError and exceptions to detect when to retry

It appears that sometimes, $dbh->state could be overwritten before
$mjobdb->need_retry got to run.  $dbh->err and $@ would still be
right.  I have not been able to explain this; I suspect that there is
something exciting going on in the eval exception trapping.

To try to isolate the problem, I developed this different approach: we
use the HandleError database handle feature, to cause all the
retriable errors to be thrown as a dedicated exception class.
We can then simply test ref $@.  (We don't care about subclassing
here.  And we don't want isa because $@ might just be a string.)
This is, in general, more reliable, as it cannot treat any other
failures as db retry failures.

Osstest::Executive and Osstest::JobDB::Executive become slightly more
intertwined with this patch.

Sadly this does not seem to completely eliminate the problem.  It does
allow us to present clearer evidence of problems in the underlying
DBI, DBD or PostgreSQL layers...

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agodb retry: Break out Osstest::Executive::JobDB::_need_retry
Ian Jackson [Tue, 20 Dec 2016 17:12:13 +0000 (17:12 +0000)]
db retry: Break out Osstest::Executive::JobDB::_need_retry

We are going to want to reorganise this.  As prep work, break the $dbh
state checking (and the corresponding comment) into a separate sub.

No functional changel.

(There is still an anomaly: need_retry passes it $dbh_tests, not the
$dbh it got from the caller.  This will go away shortly.)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agodb retry: Document $@ as an implicit parameter to need_retry
Ian Jackson [Tue, 20 Dec 2016 17:09:09 +0000 (17:09 +0000)]
db retry: Document $@ as an implicit parameter to need_retry

There are only two call sites and neither trashes $@ right now.
We are going to use a more exception-friendly style.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agodb retry, bisect: Cache build reuse investigations
Ian Jackson [Tue, 20 Dec 2016 17:29:57 +0000 (17:29 +0000)]
db retry, bisect: Cache build reuse investigations

If we previously searched for builds to reuse, trust our previous
answers.  We will only have seen data from committed transactions and
we will only have looked at jobs in completed flights, which won't
have changed.

So any previously reuseable build is still reuseable.  (Unless its
stash check failed, in which case we might want to search again if we
do a db retry.)  We don't care much about missing any
recently-finished jobs - there is a much bigger and unavoidable race
there anyway, where multiple bisections on different branches may
choose to pointlessly rebuild the same thing at the same time.

Not doing this search over and over again is important because it is a
very wide ranging search, which will often cause database transaction
serialisation errors.  Without some caching here, we may never
converge.

In principle we could do this another way: we could make a readonly
transaction which did all the searching.  But that's a more awkward
way to organise the code because our search uses a temporary table
which we then construct the flight from.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agodb retry, bisection: Reset %jobs_created on db retry
Ian Jackson [Tue, 20 Dec 2016 17:21:16 +0000 (17:21 +0000)]
db retry, bisection: Reset %jobs_created on db retry

%jobs_created is used for memoisation while populating the destination
flight.  We need to reset it when we restart flight construction,
because those jobs were created in the discarded transaction.

Otherwise we could create a flight with missing jobs.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agocs-bisection-step: Do not acquire the repo lock
Ian Jackson [Tue, 20 Dec 2016 17:07:11 +0000 (17:07 +0000)]
cs-bisection-step: Do not acquire the repo lock

This is only required to avoid a lock inversion between the repo lock
and database table locks, but we have no explicit database table locks
any more.

We do not want to hold the repo lock for an extended period,
particularly when we are running a database retry loop.

In practice, currently, cs-bisection-step always fails with a database
serialisation error.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agomg-schema-test-database: Wrap some withtest psql_do in subshells
Ian Jackson [Mon, 12 Dec 2016 13:21:53 +0000 (13:21 +0000)]
mg-schema-test-database: Wrap some withtest psql_do in subshells

Otherwise it takes effect for the rest of the script, which is not
what is wanted !  As it happens, there are no accesses to the real db
after this point, so this bug is latent.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agomg-schema-test-database: Revamp sequence handling
Ian Jackson [Mon, 12 Dec 2016 13:18:29 +0000 (13:18 +0000)]
mg-schema-test-database: Revamp sequence handling

The initial value (at creation time) of a sequence appears in the
schema, but is not of any consequence.  To avoid the schema diff check
failing in databases created in a slightly different way, it is
necessary to copy the actual original initial sequence value for each
sequence.

Replace the sequence handling code with a setup which, for each
sequence, copies the START WITH and calculates a fresh RESTART WITH.

This replaces both the unconditional copy (done with pgdump) and the
special calculation of the next flight number.  Now all sequences have
the "bump the number somewhat" treatment, which seems nice.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agoExecutive database: stub out use of LOCK TABLES
Ian Jackson [Wed, 30 Nov 2016 13:58:56 +0000 (13:58 +0000)]
Executive database: stub out use of LOCK TABLES

We want to improve database performance, and one of the problems is
excessive locking.  Postgresql now has predictate locking, and we
have, we think, eliminated all the places that do not handle a
database transaction failure.  So we can rely on optimistic
concurrency.

So, eliminate all uses of LOCK TABLES.

However, I'm not quite sure that all of the above is actually true -
particularly, with relation to our own error handling.  So, we want to
leave ourselves an escape hatch and an easy reversion path.

The approach adopted is to change the semantics of the transaction
support routines (one in Perl, and one in Tcl) so that the meaning of
all the existing call sites is changed to "do not lock any tables".

But the facility for table locking is retained and any call sites
which still need locking or fixing can use a new parameter format to
say they actually want the locking.

Hopefully this will turn out to be unnecessary.  In that case, in due
course, we can strip out all the locking machinery, abolish all the
corresponding parameters, and so on.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agosg-check-tested: Use database transaction
Ian Jackson [Fri, 9 Dec 2016 19:14:46 +0000 (19:14 +0000)]
sg-check-tested: Use database transaction

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agosg-check-tested: Lift work into new `search' sub, and indirect output
Ian Jackson [Fri, 9 Dec 2016 19:08:14 +0000 (19:08 +0000)]
sg-check-tested: Lift work into new `search' sub, and indirect output

* Replace open-coded prints to stdout with calls to new `ouput' sub
* Move main body into new `search' sub
* Exit from `search' with `return' rather than `exit 0'

Overall, no functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agoDatabase: Introduce db_readonly_report
Ian Jackson [Fri, 9 Dec 2016 19:07:10 +0000 (19:07 +0000)]
Database: Introduce db_readonly_report

According to the PostgreSQL docs, this can improve the performance
implications of long-running read-only transactions.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agosg-execute-flight: Lift db work into retry loop
Ian Jackson [Fri, 9 Dec 2016 18:53:14 +0000 (18:53 +0000)]
sg-execute-flight: Lift db work into retry loop

* Open $mro.new at the start of the loop, rather than during
  argument parsing.   So if we retry, it gets rewritten.
* Move the stdout output to the end of the script.

We tolerate that the html is moved into place even though we might be
about to rewrite it.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agoExecutive database: Handle database transaction retry in resourcecall
Ian Jackson [Fri, 9 Dec 2016 17:03:10 +0000 (17:03 +0000)]
Executive database: Handle database transaction retry in resourcecall

Previously, call failures of $resourcecall were fatal.  But it might
fail due to a need for db retry.  In that case, simply rethrow the
exception for handling by db_retry.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agotcl: Abolish with-db in favour of transaction
Ian Jackson [Mon, 5 Dec 2016 15:18:57 +0000 (15:18 +0000)]
tcl: Abolish with-db in favour of transaction

Everything needs to be in a proper transaction, with retries.

Replace the one call site which does an ad hoc BEGIN/COMMIT with a
call to transaction.  The body here is already idempotent, so making
it be a loop body is fine.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agotcl: JobDB-Executive: Use transaction in prepare
Ian Jackson [Mon, 5 Dec 2016 15:41:20 +0000 (15:41 +0000)]
tcl: JobDB-Executive: Use transaction in prepare

We need to call job-set-status-unlocked, and avoid calling with-db in
job-set-status-unlocked.

That avoids a nested call to transaction.  There are now no callers of
job-set-status-unlocked outside transaction.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agotcl: sg-execute-flight: Reorganise check to use a transaction
Ian Jackson [Mon, 5 Dec 2016 15:33:40 +0000 (15:33 +0000)]
tcl: sg-execute-flight: Reorganise check to use a transaction

We are going to remove the locking.  with-db is going to have to go.

Make this a transaction retry loop.  That means moving the
non-idempotent parts out of the transaction loop.

The changed control flow means that:

* If we are done, the 2nd query is now run uselessly.  It ought not
  to find any jobs because no jobs ought to become queued during
  the transaction.  So this is harmless.

* Just for clarity, we calculate nrunning again after the transaction.
  Only nqueued is an output from the transaction, formally.  Of course
  the transaction can update running but that is not in the database.

* We have to bless the flight outside the transaction, or we are
  creating (and mishandling) reentrant transactions.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agoExecutive database: set isolation level in Perl
Ian Jackson [Wed, 30 Nov 2016 13:59:01 +0000 (13:59 +0000)]
Executive database: set isolation level in Perl

The Perl was lacking SET TRANSACTION ISOLATION LEVEL SERIALIZABLE,
which is sadly not the default.  Currently that does not matter
because of all the table locking, but we are about to abolish that.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agoPostgreSQL db: Retry transactions on constraint failures
Ian Jackson [Fri, 9 Dec 2016 18:11:36 +0000 (18:11 +0000)]
PostgreSQL db: Retry transactions on constraint failures

This is unfortunate but appears to be necessary.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: pgsql-hackers@postgresql.org
8 years agotcl: JobDB-Executive: Print better message on transaction rollback, earlier
Ian Jackson [Wed, 7 Dec 2016 13:30:10 +0000 (13:30 +0000)]
tcl: JobDB-Executive: Print better message on transaction rollback, earlier

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agotcl: JobDB-Executive: Do not crash due to ROLLBACK on transaction retry
Ian Jackson [Wed, 7 Dec 2016 13:23:52 +0000 (13:23 +0000)]
tcl: JobDB-Executive: Do not crash due to ROLLBACK on transaction retry

If the transaction fails, we have called db-close by the time we
discover it's for retry, so the dbh may be closed (depending whether
we have a persistent dbh).

So run ROLLBACK only if dbopen indicates that the db connection is
still open.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agoExecutive database: Handle 40001 "SERIALIZATION FAILURE" too
Ian Jackson [Fri, 2 Dec 2016 16:19:57 +0000 (16:19 +0000)]
Executive database: Handle 40001 "SERIALIZATION FAILURE" too

This can happen if the locks are removed, which we are about to do.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agoms-queuedaemon: Fix ms-reportuptime and queuedaemon `uptime' command
Ian Jackson [Tue, 6 Dec 2016 11:18:43 +0000 (11:18 +0000)]
ms-queuedaemon: Fix ms-reportuptime and queuedaemon `uptime' command

Fix ms-reportuptime to source daemonlib the right way, avoiding
  couldn't read file "daemonlib.tcl": no such file or directory

Fix ms-queueaemon to use jobdb::transaction, avoiding
  ERROR invalid command name "transaction"

This was broken a long time ago.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agocr-for-branches: Branch Xen 4.8
Ian Jackson [Fri, 2 Dec 2016 11:59:04 +0000 (11:59 +0000)]
cr-for-branches: Branch Xen 4.8

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorumprun: Be more optimistic in allows
Ian Jackson [Tue, 29 Nov 2016 16:57:50 +0000 (16:57 +0000)]
rumprun: Be more optimistic in allows

The old rumpuserxen allow file (which wants to override the global
ignore for the xenstorels.repeat failure) was no longer effective
because the branch name (in the filename) was out of date.  Fix that.

Also no longer ignore one-off xenstorels failures in the primary
branches.  The failure probability seems really very low now.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agostandalone: Fix sg-run-job job-check-escaped-steps
Ian Jackson [Wed, 16 Nov 2016 14:10:18 +0000 (14:10 +0000)]
standalone: Fix sg-run-job job-check-escaped-steps

Avoids this crash, at the end of the job:
  expected boolean value but got ""

Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorump build tests: Disable a lot of unwanted Xen things at configure time
Ian Jackson [Fri, 4 Nov 2016 19:00:02 +0000 (19:00 +0000)]
rump build tests: Disable a lot of unwanted Xen things at configure time

Amongst other things, we disable rombios which requires lzma.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorump build tests: Introduce ts-xen-build-rump
Ian Jackson [Fri, 4 Nov 2016 18:58:44 +0000 (18:58 +0000)]
rump build tests: Introduce ts-xen-build-rump

We are going to want to pass a whole slew of options to configure, and
hence to ts-xen-build.  I think putting that in sg-run-job is
undesirable.

So, split out the ts-xen-build invocation into its own script.
Explicitly set the testid so that it does not change.

No significant functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agots-xen-build: Support passing arguments to configure
Ian Jackson [Fri, 4 Nov 2016 18:54:48 +0000 (18:54 +0000)]
ts-xen-build: Support passing arguments to configure

No functional change with existing callers.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agots-xen-build: Enable CONFIG_VERBOSE_DEBUG
Ian Jackson [Tue, 8 Nov 2016 15:07:36 +0000 (15:07 +0000)]
ts-xen-build: Enable CONFIG_VERBOSE_DEBUG

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agots-xen-build: Enable CONFIG_EXPERT
Ian Jackson [Tue, 8 Nov 2016 15:06:12 +0000 (15:06 +0000)]
ts-xen-build: Enable CONFIG_EXPERT

This requires an environment variable set in the build environment,
too.  (There is an argument amongst hypervisor maintainers about
whether this requirement in xen.git is a good idea; but, nevertheless,
it is currently there in several existing trees, so we need to set
it.)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoBuildSupport: Honour $buildcmd_global_prefix
Ian Jackson [Tue, 8 Nov 2016 15:03:58 +0000 (15:03 +0000)]
BuildSupport: Honour $buildcmd_global_prefix

This will make life more convenient in a moment.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agoxtf: Always boot with loglvl=all guest_loglvl=all
Ian Jackson [Mon, 7 Nov 2016 12:03:45 +0000 (12:03 +0000)]
xtf: Always boot with loglvl=all guest_loglvl=all

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agots-xen-build: set CONFIG_DEBUG for KConfig
Wei Liu [Tue, 1 Nov 2016 18:05:04 +0000 (18:05 +0000)]
ts-xen-build: set CONFIG_DEBUG for KConfig

Starting from Xen 4.8 the hypervisor debug build is controlled by
Kconfig. Set it correctly in xen/.config.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agostandalone-reset: Check for TftpPxeDir
Konrad Rzeszutek Wilk [Wed, 26 Oct 2016 18:51:45 +0000 (14:51 -0400)]
standalone-reset: Check for TftpPxeDir

While patch: "README: Mention the / requirement in Tftp[Pxe|Tmp]Dir"
we should also double-check that the directory actually exists.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agostandalong-reset: Use the $suite when recreating soft links.
Konrad Rzeszutek Wilk [Wed, 26 Oct 2016 18:14:08 +0000 (14:14 -0400)]
standalong-reset: Use the $suite when recreating soft links.

Commit ef3a6f2162ced5cfeb08b437315b69ad1ddbc5ed:
"Add -$suite suffix to TftpDiVersion in code"
forgot to include the $suite parameter when re-linking
current-$suite against the <date>-$suite.

Specifically after we have downloaded the debian files the
$TftpDir has:

 konrad konrad 4096 paź 26 13:29 2016-10-26-jessi
 konrad konrad   17 paź 26 13:29 current-jessie -> 2016-10-26-jessi

we end up removing the symlink (current-jessie) and then
recreating it as:

 konrad konrad 4096 paź 26 13:29 2016-10-26-jessi
 konrad konrad   10 paź 26 13:29 current-jessie -> 2016-10-2

which is wrong as there is no '2016-10-2' directory.

The patch is to add the $suite in the linking.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agoREADME: Mention the / requirement in Tftp[Tmp|Pxe]Dir
Konrad Rzeszutek Wilk [Wed, 26 Oct 2016 18:14:09 +0000 (14:14 -0400)]
README: Mention the / requirement in Tftp[Tmp|Pxe]Dir

That is the / should be part of the directory name. Otherwise
we get strange files such as: pxelinux.cfgC0A86A3C
in the TftpPath directory.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
v2: Slightly improved wording.

8 years agoDhcpWatch: Print what is wrong with the line.
Konrad Rzeszutek Wilk [Wed, 26 Oct 2016 18:14:07 +0000 (14:14 -0400)]
DhcpWatch: Print what is wrong with the line.

If the user forgot to include 'dhcp3' on the parameter
line point out the error to the user.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: Still print out the arguments to the constructor, hopefully
    non-confusingly.

8 years agots-coverity-upload: Honour HttpProxy (or CoverityHttpProxy)
Ian Jackson [Wed, 19 Oct 2016 13:00:15 +0000 (13:00 +0000)]
ts-coverity-upload: Honour HttpProxy (or CoverityHttpProxy)

In the Xen Project colo, we do not grant our hosts (including the
controller) general internet access.

We did have the IP address of scan.coverity.com configured in our
firewall.  But Coverity use a CDN now and the IP address is not even
slightly stable any more.

Using the squid works (using CONNECT).  So do that.

I have not been able to test this end-to-end, since I didn't want to
do a real upload.  However I have c&p the command line that
ts-coverity-upload now attempts, and modified it slightly, and
verified that it then manages to get the appropriate 401 error from
scan.coverity.com.

Deployment note: Sites doing Coverity uploads who have an http proxy
configured but which do not want to use it for these uploads need to
set the config option CoverityHttpProxy to the empty value.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoREADME: Be less confusing about Tftp settings
Ian Jackson [Mon, 17 Oct 2016 14:01:07 +0000 (15:01 +0100)]
README: Be less confusing about Tftp settings

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
v2: Give the scope-free version as the basic explanation

8 years agoREADME: Document Webspace* parameters better
Ian Jackson [Mon, 17 Oct 2016 13:53:34 +0000 (14:53 +0100)]
README: Document Webspace* parameters better

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
8 years agoREADME: Also mention other requirements. wip.konrad-fixes
Konrad Rzeszutek Wilk [Tue, 18 Oct 2016 14:56:27 +0000 (10:56 -0400)]
README: Also mention other requirements.

Mainly dctrl-grep which is in the dctrl-tools.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Marcos Matsunaga <Marcos.Matsunaga@oracle.com>
8 years agomgi-common: Support empty (unset) HttpProxy properly
Ian Jackson [Tue, 18 Oct 2016 15:46:20 +0000 (16:46 +0100)]
mgi-common: Support empty (unset) HttpProxy properly

mg_update_proxy ends up being set to the empty string so the {...:+-x}
form is needed to expand only non-empty values to `-x'.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Marcos Matsunaga <Marcos.Matsunaga@oracle.com>
8 years agostandlone-reset: mkdir some directories
Ian Jackson [Tue, 18 Oct 2016 15:22:33 +0000 (16:22 +0100)]
standlone-reset: mkdir some directories

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Marcos Matsunaga <Marcos.Matsunaga@oracle.com>
8 years agostandalone-reset: Fix when TftpDiVersion not set in config
Ian Jackson [Tue, 18 Oct 2016 14:50:16 +0000 (15:50 +0100)]
standalone-reset: Fix when TftpDiVersion not set in config

In b8134c7fa60d "mg-debian-installer-update: Print the correct value
for TftpDiVersion", the output of mg-debian-installer-update was
changed to be a config fragment.  But standalone-reset expected it to
be just the date value, and was not updated.

Update it now.  And leave a comment in mg-debian-installer-update to
stop this happening again.

CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Marcos Matsunaga <Marcos.Matsunaga@oracle.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agosupport check: Style improvements - rename _check_for_command
Ian Jackson [Fri, 14 Oct 2016 14:37:11 +0000 (15:37 +0100)]
support check: Style improvements - rename _check_for_command

Put an underscore in front.  This is not a public method.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agosupport check: Style improvements - general
Ian Jackson [Fri, 14 Oct 2016 14:35:31 +0000 (15:35 +0100)]
support check: Style improvements - general

Many of these functions are quite verbose - otiose, even.

No substantial change.  Some redundant log messages go away.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agosupport check: Reverse sense of return values
Ian Jackson [Fri, 14 Oct 2016 14:33:03 +0000 (15:33 +0100)]
support check: Reverse sense of return values

The toolstack()->check_blah functions would return an exit status.
This is very confusing.  Instead, have them return a booleanish value
representing the support status: ie, truthy if supported.

No functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agosupport check: Provide helper function to print nice log message
Ian Jackson [Fri, 14 Oct 2016 14:24:45 +0000 (15:24 +0100)]
support check: Provide helper function to print nice log message

Makes ts-migrate-support-check and ts-saverestore-support-check
slightly clearer.

This function takes $yes, which is truthish if the feature is
supported.  We are going to replace use of exit status truth values in
the various check functions in just a moment.

No functional change other than to log output.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agolibvirt: Check /capabilities/host/migration_features/live for live migration
Ian Jackson [Thu, 6 Oct 2016 16:38:29 +0000 (17:38 +0100)]
libvirt: Check /capabilities/host/migration_features/live for live migration

libvirt is capable of advertising this separately from
/capabilities/host/migration_features, so if save/restore is supported
but live migration is not, this will do the right thing.

We would have preferred libvirt to advertise
  /capabilities/host/migration_features/save
or something, but it doesn't right now, so we continue to use
  /capabilities/host/migration_features
to detect save/restore support.

If libvirt changes its feature presentation, then at some future point
we should change osstest too.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Martin Kletzander <mkletzan@redhat.com>
CC: Jim Fehlig <jfehlig@suse.com>
---
v3: Call correct function name.

8 years agolibvirt: Do not attempt save/restore when migration not advertised
Ian Jackson [Tue, 4 Oct 2016 16:24:17 +0000 (17:24 +0100)]
libvirt: Do not attempt save/restore when migration not advertised

Currently, osstest wrongly thinks that ARM can do save/restore,
because `virsh help' does mention the save command (on all
architectures).

So, additionally, check the virth capabilities xpath
   /capabilities/host/migration_features
to try to see whether this host supports migration.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Julien Grall <julien.grall@arm.com>
CC: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
v3: Removed questioning and uncertain remarks from commit message,
    following appropriate confirmation from libvirt folks.
    Get sense of conditional combination right.

8 years agolibvirt: Check migration capabilities using proper XML parser
Ian Jackson [Tue, 4 Oct 2016 16:15:55 +0000 (17:15 +0100)]
libvirt: Check migration capabilities using proper XML parser

Do not grep the virsh capabilities output (!)  Instead, parse the XML
using perl's XML modules and look for the specific feature flag using
an XPATH pattern.

AFAICT from looking at the XML, that's

    <capabilities>
      <host>
<migration_features>
  <live/>

But the original code does not test for <live/>.

Xen could in principle (and is expected to, in the future, on ARM)
support save/restore but not live migration.  Currently it supports
neither on ARM.  libvirt's capabilities system does in principle
capture this distinction, but only in an adhoc way.

For now, this osstest commit has no ultimate functional change (with
libvirt output as it currently appears on our real hosts).

Deployment note: Requires libxml-libxml-perl to be installed.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Julien Grall <julien.grall@arm.com>
CC: Jim Fehlig <jfehlig@suse.com>
---
v3: Mention newly-required Perl libraries in README and commit message
    Get answers and syntax right (!)

8 years agomake-flight: XTF: honour $bfi (ie build flight)
Ian Jackson [Thu, 6 Oct 2016 18:39:02 +0000 (19:39 +0100)]
make-flight: XTF: honour $bfi (ie build flight)

If make-flight is run with a $buildflight argument, it does not create
any build jobs.  The test jobs are supposed to refer to the build jobs.

This was not done correctly for the XTF tests.  Add the missing ${bfi}.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorump kernels: Build with RUMP_DEV_XEN_DEBUG and filter out debug messages
Ian Jackson [Fri, 7 Oct 2016 15:43:54 +0000 (16:43 +0100)]
rump kernels: Build with RUMP_DEV_XEN_DEBUG and filter out debug messages

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agomake-flight: Honour $bfi (build flight) for rump tests
Ian Jackson [Thu, 6 Oct 2016 18:36:37 +0000 (19:36 +0100)]
make-flight: Honour $bfi (build flight) for rump tests

A quick search suggests there are other a similar bugs...

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorump kernels: Install binutils on test box
Ian Jackson [Thu, 6 Oct 2016 18:11:09 +0000 (19:11 +0100)]
rump kernels: Install binutils on test box

The `rumprun' tool needs `readelf' which is in binutils.

This introduces a new test step, which is idempotent.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorump kernels: Adjust indentation in run-job/test-rumprun
Ian Jackson [Thu, 6 Oct 2016 18:09:33 +0000 (19:09 +0100)]
rump kernels: Adjust indentation in run-job/test-rumprun

Whitespace change only.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorumprun: Disable unwanted builds
Ian Jackson [Thu, 6 Oct 2016 12:03:34 +0000 (13:03 +0100)]
rumprun: Disable unwanted builds

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorumprun: xenstorels: Better new regexps for finding output
Ian Jackson [Wed, 5 Oct 2016 15:10:48 +0000 (16:10 +0100)]
rumprun: xenstorels: Better new regexps for finding output

There is no need to match the _exit.  We can match the main return as
before, provided we tolerate the way it now says
   main() of "program" returned 0

This is an update to ea13503bc853 "rumprun: xenstorels: New regexps
for finding output" (which was insufficient to get the xenstorels test
to pass).

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agoTestSupport: guest_unprepare_disk: Make a no-op for guests with no Lvdev
Ian Jackson [Wed, 5 Oct 2016 15:07:53 +0000 (16:07 +0100)]
TestSupport: guest_unprepare_disk: Make a no-op for guests with no Lvdev

This includes some rump kernel tests.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorump kernels: Provide networking test
Ian Jackson [Wed, 5 Oct 2016 14:09:49 +0000 (15:09 +0100)]
rump kernels: Provide networking test

Introduce our own version of `nc -e echo', to replace the removed rump
kernel WOPR test (which we were using to check that networking
worked).

This test program works when compiled on Linux too.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorump kernels: Provide proper DHCP instructions to rumprun
Ian Jackson [Wed, 5 Oct 2016 14:07:57 +0000 (15:07 +0100)]
rump kernels: Provide proper DHCP instructions to rumprun

Otherwise we just get an unconfigured network interface.  (Requesting
DHCP used to be implicit.)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorump kernels: ts-rumprun-bake: Do not tolerate errors
Ian Jackson [Wed, 5 Oct 2016 14:06:14 +0000 (15:06 +0100)]
rump kernels: ts-rumprun-bake: Do not tolerate errors

If we skip due to missing the input pieces, make the warning noiser.

If we think we have all the input pieces, bomb out if they don't seem
to contain the right bits, or if rumpbake fails.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorump kernels: Specify toolstack for rumprun demo to be rumprun
Ian Jackson [Wed, 5 Oct 2016 13:41:20 +0000 (14:41 +0100)]
rump kernels: Specify toolstack for rumprun demo to be rumprun

This causes ts-guest-start to use rumprun, rather than xl.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorump kernels: Provide rumprun toolstack
Ian Jackson [Wed, 5 Oct 2016 13:43:34 +0000 (14:43 +0100)]
rump kernels: Provide rumprun toolstack

This is suitable as a guest-specific toolstack: it defers to xl for
everything other than guest creation.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agoSupport guest-specific "toolstack" for guest creation
Ian Jackson [Wed, 5 Oct 2016 13:39:11 +0000 (14:39 +0100)]
Support guest-specific "toolstack" for guest creation

Some guests need creation in a special way.  For example, rump kernels
are ideally started with rumprun.  Honour a guest var which specifies
a toolstack name.

Osstest::TestSupport::toolstack now takes an optional $gho so it can
do this lookup when appropriate.

After creation the guest is necessarily managed with the toolstack for
the host, so we honour this (ie we pass the $gho) only for create.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agoBuildSupport: builddirsprops: Clean up each builddir
Ian Jackson [Wed, 5 Oct 2016 13:37:08 +0000 (14:37 +0100)]
BuildSupport: builddirsprops: Clean up each builddir

This makes prepbuilddirs work if it is run a second time for the same
builddirs, which is useful for ad-hoc testing.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agorump-test-net: setsockopt V6ONLY off
Ian Jackson [Thu, 29 Sep 2016 12:57:05 +0000 (13:57 +0100)]
rump-test-net: setsockopt V6ONLY off

NetBSD (unlike Linux) has the V6ONLY socket option turned on by
default.  So to work in the rump kernel environment when tested with
IPv4 we need to adjust this setting.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agorump-test-net: New test program
Ian Jackson [Thu, 29 Sep 2016 10:36:23 +0000 (11:36 +0100)]
rump-test-net: New test program

The rump kernel WOPR test is no more, so we reimplement it.  This test
program simply listens on a TCP socket and says hi when you connect to
it.  It's a portable program.  So far, this has been tested on Linux,
but not in the rump environment.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agomg-allocate: Provide command line way to list allocated resources
Ian Jackson [Thu, 6 Oct 2016 15:49:28 +0000 (16:49 +0100)]
mg-allocate: Provide command line way to list allocated resources

Freely shareable resources don't appear in the plan, and the plan is
not always immediately updated, and is generally not always a
convenient interface.  Provide a command line way to list allocated
resources.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agoExecutive: Break out task_spec_desc (no functional change)
Ian Jackson [Thu, 6 Oct 2016 15:48:53 +0000 (16:48 +0100)]
Executive: Break out task_spec_desc (no functional change)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agosg-report-flight: Avoid some warnings when reporting unexecuted jobs
Ian Jackson [Thu, 6 Oct 2016 12:10:20 +0000 (13:10 +0100)]
sg-report-flight: Avoid some warnings when reporting unexecuted jobs

If no steps in a job are executed, there can be a failure with a
synthetic step row, containing a stepno of ''.  This causes a perl
warning when compared with <=>:
  Argument "" isn't numeric in numeric comparison (<=>) at ./sg-report-flight line 774.

Fix this by replacing falseish values with 0.

Bug introduced in 0e09a8b00ec6 "sg-report-flight: Report earlier,
earlier step failures".

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
8 years agohost allocation: Fix duration estimate to not include host allocation
Ian Jackson [Tue, 4 Oct 2016 18:09:18 +0000 (18:09 +0000)]
host allocation: Fix duration estimate to not include host allocation

In 720f08cb9052 "Executive: Previous duration estimator: use overall
time, not sum of steps" we introduced a bug: the condition to exclude
the host allocation time is now not effective if there are any steps
before host allocation.  Usually there are.

This means that the host allocation duration estimator has been
including the host allocation time from previous jobs, which is quite
wrong.

Fix this by subtracting the maximum duration of any host allocation
step.  Hopefully there will only be one.

If any host allocation runs concurrently with other steps (including
other host allocations) then this will start to give wrong answers.
But there are other reasons why we wouldn't want to do that.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: Fix sql syntax.

8 years agohost allocation: Dedupe "other hosts" flights in duration estimation
Ian Jackson [Tue, 4 Oct 2016 18:02:33 +0000 (18:02 +0000)]
host allocation: Dedupe "other hosts" flights in duration estimation

The old query would return one row for each step in each relevant
flight.  But we are really only interested in the flight.

Group by the flight and sort on max(finished).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
8 years agohost allocation: Pass a debug function in find_recent_duration
Ian Jackson [Tue, 4 Oct 2016 17:23:23 +0000 (17:23 +0000)]
host allocation: Pass a debug function in find_recent_duration

We provide only a commented-out debug print.  This produces more
copius output than is desirable even to a compressed debug log.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>