use the Python interpreter from env

use the Python interpreter which has been set via PYTHON env-var at
configure time

Signed-off-by: Neal Oakey <neal.oakey@googlemail.com>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Add a 'with' context for running tests with paused watcher

The context is responsible for stopping and re-starting the watcher for
the corresponding block of code.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Run the EPO tests with watcher turned off

Otherwise the watcher might restart instances just after the EPO,
failing the test.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Fix check for sphinx-build from python2-sphinx

if using python2-sphinx '/usr/bin/sphinx-build2 --version' prints
"Sphinx (sphinx-build2) 1.2.3" which didn't match the regex

Signed-off-by: Neal Oakey <neal.oakey@googlemail.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Replace 'DISKLESS' check w/ 'not inst.disks'

The disk templates are going away for the instances, so the new
definition of being diskless is to be actually without any disks
attached.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Remove duplication for DiskTemplate/StorageType mapping

Currently both Ganeti.Constants and Ganeti.Types define the mapping of
disk templates and storage types independently. This change automates
the generation of the mapping in Ganeti.Constants.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Use @wraps for withLockedLU

This change enables tools like 'nose2' to execute only one single test
method, which is a great help when debugging. Plus using wraps is good
style for a wrapper.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Cleanup some haskell code

Use Applicative in disk type parsing

remove unnecessary lambda in THH code

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Update doc: show relation DiskTemplate <-> DiskLogicalId

The relation between the two is simple, but undocumented, which would
lead to problems with new people working on this.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Refactor cmdlib.instance.LUInstanceSetParam#CheckPrereq

The method got out of hand (350 lines with 50+ local variables), this
patch gets it back under control.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Make ComputeIPolicySpecViolation take multiple disk types

This requires all callers to provide all disk types of the instance
checked. If that isn't possible, the singleton list can be used. The
function checks that assertion.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Avoid using instance disk template in cmdlib.cluster

This patch removes the usages of the instance's disk_template object in
the cmdlib.cluster file. This is independent of other refactors.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Avoid using instance disk template in cmdlib.group

This patch removes the uses of the instance's disk_template to classify
instances and uses the disk's device types instead.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Avoid using disk template in cmdlib.instance_migration

This patch removes the dependency on the instance disk_template from
cmdlib.instance_migration and replaces it with the disk types.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Avoid using disk template in cmdlib.instance_storage

Remove dependency on instance disk_template in cmdlib.instance_storage
to only depend on the disk type.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Avoid using instance disk template in cmdlib.node

Remove dependency on instance disk_template and replace it with disk
type in the package cmdlib.node.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Avoid using instance disk template in cmdlib.instance

Remove dependency on instance disk_template and replace it with disk
type in the package cmdlib.instance.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Add option to NodeSshRemoveKey to clear public keys

This patch adds an option to the NodeSshRemoveKey function
of backend.py to clear a nodes' public_key_file. This
will be used when removing a node and later also when
making a master_capable node not master_capable anymore.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Clear a node's 'authorized_keys' file before readding it

This patch makes sure that when a node is readded, it's
'authorized_keys' file is cleared from old Ganeti keys
before it is added again. Note that keys which were not
added by Ganeti before, will be left untouched.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Document --no-node-setup option in man page

This patch documents the '--no-node-setup' option of
'gnt-node add', which prevents Ganeti from touching and
distributing the SSH keys of the new node. It also prevents
any manipulation of the 'authorized_keys' files of Ganeti.

This option has been around for some time, but was so far
not documented in the man page.

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