Fix Xen instance state

For some strange reason, Xen once printed 'rb----' which does not make
any sense because an instance cannot be both running and blocked.
Fortunately, for Ganeti 'running' or 'blocked' is the same as
'running'.

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Sample logrotate conf breaks permissions with split users

The sample logrotate configuration file
(doc/examples/ganeti.logrotate) contains the following line

  create 640 root root

which is fine if Ganeti if configured without split users.  However,
this will change permissions and ownership of log files if Ganeti is
configured with split users enabled.  By removing this line, logrotate
will preserve the permissions of the logfiles when rotating the logs.

This fixes issue 789.

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Postpone 2.10.3 release to Wednesday, 16th

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Document spindles in the hbal man page

When spindles were introduced as a resource, they were also
used in the computation of the cluster metric. Document this.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Jose Lopes <jabolopes@google.com>
Fix 'gnt-cluster' and 'gnt-node list-storage' outputs

* Update table for 'gnt-node list-storage'
* Add newline between description and the actual command in 'gnt-cluster version'

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Export extractExTags and updateExclTags

...from the htools Loader. These functions are needed when
parsing the requested instance of an allocator request.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Jose Lopes <jabolopes@google.com>
Set exclusion tags correctly in requested instance

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Jose Lopes <jabolopes@google.com>
Merge branch 'stable-2.9' into stable-2.10

* stable-2.9
  Set exclusion tags correctly in requested instance
  Export extractExTags and updateExclTags
  Document spindles in the hbal man page
  Sample logrotate conf breaks permissions with split users

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Jose A. Lopes <jabolopes@google.com>
Merge branch 'stable-2.10' into stable-2.11

* stable-2.10
  Fix 'gnt-cluster' and 'gnt-node list-storage' outputs
  Postpone 2.10.3 release to Wednesday, 16th

* stable-2.9
  Set exclusion tags correctly in requested instance
  Export extractExTags and updateExclTags
  Document spindles in the hbal man page
  Sample logrotate conf breaks permissions with split users
  Fix 'gnt-cluster' and 'gnt-node list-storage' outputs

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Prepare NEWS file for release of 2.11.0

Preparing the NEWS file for the release of 2.11.0
tomorrow.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Jose Lopes <jabolopes@google.com>
Revision bump for 2.11.0

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Jose Lopes <jabolopes@google.com>
Add a RunWithLocks QA utility function

This patch adds a QA utility function that acquires a set of locks, and
attempts to run a given function with the locks in place. Should the
given function block, this function does not detect this - later
patches will address the issue.

An example of its use is provided by having the move-instance test
modified to use it.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

(cherry picked from commit 343c9ed28a48e0056cade771046fdc6b046aed7d)

Conflicts:
	qa/qa_rapi.py (didn't backport changes to this file)
Track if a QA test was blocked by locks

This patch adds threading to the RunWithTests function, allowing one
thread to execute the QA test, and the other to monitor if it is being
blocked by locks set up during the test. If it is, terminate the
blocking job, and let the QA continue, reporting the test failure at
the very end.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

(cherry picked from commit 34c5ec6c78aa164eebb4ad6cfc14b38e81aad8ec)
Add an expected block option to RunWithLocks

To compensate for the cases where a QA test is supposed to block when
a lock is present, add an additional option showing whether blocking is
supposed to happen or not.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

(cherry picked from commit 57efdaf53a4d40a39befaa7e9a5ce9ff72063523)

Conflicts:
	qa/qa_rapi.py (didn't backport changes to this file)
Wait for delay to provide interruption information

The RunWithLocks test assumed that gnt-debug delay would have the info
needed for interruption ready immediately after being run, and in some
situations this is not the case. This patch makes the test more patient
and forgiving by retrying a number of times.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

(cherry picked from commit fbab1c76fbf3e84aeb82ed28be7d30a491de3718)
Add an exception-trapping thread class

To have better control over threads, this patch adds a helper Thread
subclass which captures any exceptions occurring for later use.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

(cherry picked from commit e677d5e8e1c0ea7ef24e78f9ae842c9371449a77)
Clean up RunWithLocks

This patch cleans RunWithLocks up a little bit by reducing the number
of delay function terminations, and using the QAThread class to ensure
exceptions are thrown at the right time and in the right place.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

(cherry picked from commit 9558c2a4fc9eee309d56a6a84cc2a5935054dd1e)
Fix invocation of GetCommandOutput in QA

The cherry-picked function _GetOutputFromMaster() calls
GetCommandOutput() with parameters only present in newer Ganeti
branches. Remove those parameters as they cause errors in stable-2.10.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Clarify default setting of 'metavg'

This fixes issue 810, suggesting to clarify where the
default for 'metavg' comes from.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Fix --shared-file-storage-dir option of gnt-cluster modify

While all infrastructure to make shared-file storage
runtime-configurable was already submitted, the actual
setting of the path was forgotten. This patch fixes it.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>