Split cluster.py

cluster.py is nearly 4000 lines long and consists of two independent
parts: on one hand there is everything related to verifying the cluster
and there is everything else.

This change moves everything from cmdlib/cluster.py to either
cmdlib/cluster/__init__.py or cmdlib/cluster/verify.py.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Reduce maximal module size

This patch reduces the max-module-size of the project to 3600, which is
slightly larger than the currently largest module (baring backend.py,
which got a free pass): config.py

In an efford to reduce the module size to something more reasonable, the
next person to hit the wall will find a nice reminder: Please reduce the
maximal module size further when possible.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Tests: Fix bad bad alignment style

Fixes an accident when formatting a record.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Add prefix for WConfD livelock file name

WConfD will also need a livelock to request locks in its
own name, e.g., when providing short-lived locks.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Aaron Karper <akarper@google.com>
Move unpacking of config-change to a separate function

In this way, the logic of determining whether the configuration needs
to be distributed, as well as the implicit serial numb can be shared
with other functions.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Aaron Karper <akarper@google.com>
Support config-changes with temporary ConfigLock

Support changes of the configuration with a temporarily acquired
configuration lock. This can be used to support requests to directly
change parts of the configuration.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Aaron Karper <akarper@google.com>
Extend modifyConfig to also modify TempResState

Extend the modifyConfig function to also support modifications
of the state of temporary reservations.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Aaron Karper <akarper@google.com>
Extend config modification to depend on TempRes

Extend modifyConfigWithLock so that the config modification
may also depend on the state of the temporary reservations.
This is needed, e.g., to commit temporary IP reservations.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Aaron Karper <akarper@google.com>
Make WConfD export a function to add an instance

This function handles all the configuration modifications
necessary: it adds the instance to the list of instances,
drops the DRBD minor reservations, and commits the temporary
IPs.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Aaron Karper <akarper@google.com>
Add instances to the configuration directly via WConfD

Make jobs adding instances do so by means of the corresponding
WConfD function. In this way, no long-lived config lock has to
be acquired.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Aaron Karper <akarper@google.com>
Ingore "Use import/export shortcut"

We occasionally reexport modules to keep interfaces stable, most prominently
in Ganeti.Objects. To keep the export statement readable it is helpful to
explicitly name all the modules reexported. This lint warning would make this
impossible.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Fix typo in error in bootstrap

Signed-off-by: Aaron Karper <akarper@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>