In tiered allocation, cut non-promising shrinking tries

The heuristics for tiered allocation has been improved in that it
chooses to shrink such a resource next where by shrinking only this
resource a valid allocation can be made, if such a resource exists.
In order to decide whether such a resource exists, all potential
sizes of this resource are verified. We can improve performance by
cutting, as soon a potential allocation of an instance is no longer
blocked on this resource.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Add confd user to masterd group

The server.pem file is 0440 (materd_uid, masterd_gid) and cannot be
accessed by confd.

This patch contains a workaround for 2.8.0~beta1 (adding conf to the
masterd group in the user setup tool, and remembering the users to
actually execute that tool while upgrading).

This partially fixes Issue 292.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Check DRBD status in cluster verify

If the status of DRBD disks is degraded or in a faulty state, issue an
error in cluster verify.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Adapt VCluster script to current situation

vcluster-setup is adapted to the current Ganeti command line arguments.
Also, a bug for diskless instances in qa_instance is fixed.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Add support to migration_mode in fake HV

The fake hypervisor pretends to support migration, but did not support
the migration_mode parameter yet. As this parameter is required during
instance migrations, support for it is added in this patch.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Skip Xen monitoring QA for non-Xen clusters

Instead of asserting that the Xen instance status collector fails for
non-Xen clusters just skip the test completely.
Otherwise QA would fail for non-Xen hypervisors if Xen happens to be
installed on the cluster as well.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Merge branch 'stable-2.8' into master

* stable-2.8
  In tiered allocation, cut non-promising shrinking tries
  Add confd user to masterd group

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
Fix instance add for missing node specs

Don't pass None to cfg.GetNodeNames. Instead, only resolve the node
names if it's sure that the UUID list is valid.

This fixes issue 495.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Fix testGetHvDefaults testcase

The introduction of the migration_mode parameter to the fake hypervisor
broke the testGetHvDefaults. This patch fixes this by taking the default
parameters of the fake hypervisor into account.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Fix wrong assert

An assert wrongly verified that the node name instead of the node UUID
is in the set of locked nodes. This patch fixes this.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Node-UUID related cleanup

Some variables which hold node UUID's are renamed to reflect their
indent better.
Use cfg.GetNodeName(uuid) instead of cfg.GetNodeInfo(uuid).name where
appropriate.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Index instances by their UUID

No longer index instances by their name but by their UUID in the cluster
config. This change changes large parts of the code, as the following
adjustments were necessary:
 * Change the index key to UUID in the configuration and the
   ConfigWriter, including all methods.
 * External interfaces (command line interface, IAllocator interface,
   hook scripts, etc.) are kept stable.
 * Instance UUID's are resolved in ExpandNames and then stored in the
   OpCode. This allows to check for instance renames if the OpCode is
   reloaded after a cluster restart. This check is currently only done
   for single instance parameters.
 * Instance locking unfortunately can't use instances UUID as
   identifiers. The reasons is that new instances (which have no UUID
   yet) have to be locked as well, so the instance name is used.
 * Variable names are renamed to follow the following pattern:
   - Suffix is 'inst' or 'insts': Variable holds Instance objects
   - Suffix is 'name' or 'names': Variable holds Instance names
   - Suffix is 'uuid' or 'uuids': Variable holds Instance UUID's
 * Tests are adapted.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Convert instance indices to UUIDs in configuration

cfgupgrade replaces the occurences of instance names (where they are
used as index) with the instance UUID.

It also supports the inverse replacement, so downgrades are
supported too.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Add gnt-node migrate to QA

Make it possible to optionally run gnt-node migrate during QA.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>