Allow QA asserts to produce more messages

This patch adds a tiny helper function that allows error messages
output by the QA asserts to be prefixed with whatever the user
supplies.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Add messages about skipped QA disk template tests

When disk templates were ignored in the QA, no messages were emitted,
in contrast to pretty much all tests. To make it easier to see why
a test was not executed, this patch performs a minor refactoring and
adds some output for the templates.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Fix list-drbd QA test

The list-drbd QA test assumed falsely that no instance has more than
one disk. This can happen, and this patch accounts for it.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Update installation guide wrt to DRBD version

This patch updates the supported DRBD version number to
8.4.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Update NEWS for 2.9.6

Describe all the changes to Ganeti made since the
2.9.5 release. Also set the release date.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Revision bump for 2.9.6

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Merge branch 'stable-2.9' into stable-2.10

* stable-2.9
  Allow QA asserts to produce more messages
  Add messages about skipped QA disk template tests
  Fix list-drbd QA test
  Update installation guide wrt to DRBD version
  Update NEWS for 2.9.6
  Revision bump for 2.9.6

Conflicts:
	NEWS - Combined both news files
	configure.ac - Took the 2.10 version numbers

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Fix request flooding of noded during disk sync

If a user manually pauses the DRBD sync, Ganeti started to poll the node
daemon without any waiting between request. This caused heavy load on
the node. This patch fixes this by waiting at least 5 secondes between
two polls if no sensible estimate for the remaining sync time could be
made.

Fixes issue 792

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Account for NODE_RES lock in opportunistic locking

This patch extends the opportunistic locking to take both the
NODE_RES and NODE locks into account when selecting nodes to be used
by the iallocator.

Signed-off-by: Gerard Oskamp <gjo@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
QMP: make QmpConnection act as a context manager

This will allow automatic connection and socket cleanup on command
completion.

We also repeat the Qmp tests using the context manager. For this to be
feasible, we move the test scenario to class variables and modify
QmpStub to not consume its script.

Signed-off-by: Apollon Oikonomopoulos <apoikos@gmail.com>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
Fix typos in comments

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Derive Ord for LockRequests

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Add data structure for lock waiting

To avoid jobs polling on locks, and also to ensure that the
most important of the waiting jobs obtains a lock, add a
data structure to keep track of who is waiting for which locks.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Add functions to update locks in a waiting structure

Add functions to update the lock allocation structure and also
compute all the consequences of the update, if it succeeds. Optionally,
requests that cannot be fulfilled immediately, it can be added to
the pendig requests.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Export the underlying allocation from a waiting structure

...so that all kind of diagnostic tasks can be carried out without
duplicating the functionality on the waiting structure. Note that
we still do not export the constructor so that we can change the
implementation without breaking the interface.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Export the set of pending owners

...as the question of who has pending requests is an import
part of the data structure.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Export the test locks for testing

As lock waiting is also based on locking, export the
test lock/owner structure, so that the tests for lock
waiting can use them.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Verify locks can't be updated while having a pending request

Add a verify first sanity check for lock waiting: a user that has a pending
request cannot modify his locks. This patch also brings in the necessary
infra structure for having arbitrary waiting structures.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Verify that unfulfilled requests lead to pending requests

Verify that an owner has a pending request after a waiting request
not fullfilled immediately.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Add a function to remove a pending request

Add a function that allows an owner to remove a pending request
it might have. Besides useful for testing, this will also be
needed to clean up the resources for dead owners.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>