Assemble Xen NIC parameters into a dictionary

... instead of a string. This reduces the chance of programmer errors
and also eliminates the need to include comma separators everywhere.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Add a script for setting up the metad NIC for Xen

The script does the bare minimum required to set up the interface during
instance creation. The rest of the process is carried out by the ifup-os
script.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Use tools/vif-ganeti-metad when setting up Xen metad NIC

... and skip the setup used for regular NICs.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Check for all NICs when looking for a free metad NIC name

With Xen, the interfaces aren't set in 'tuntap' mode so 'ip tuntap list'
doesn't show them.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Let drbd disks resync during cluster verify

Commit 9b0e86e issues an error during cluster verify if the status
of DRBD is degraded and if the local disk is not UpToDate.

Still in case of a newly created instance or a newly attached disk with
--no-wait-for-sync, if a cluster verify runs it will report errors
for the instance's disks that are syncing.

This patch does the following:

  - Adds a new local disk state namely LDS_SYNC.

  - Thinks of a drbd device that is syncing as degraded.

  - During cluster verify, if the device is degraded, the local disk
    status is checked and if it is ok or syncing it prints a warning
    instead of an error.

  - Updates the order of lds to: ok < syncing < unknown < faulty

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Do not hard-code python path

...in our automatically generated top-level python files.
Instead use the automatically detected python path.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Fix python shebang line in tools as well

While most of our top-level python scripts used to be generated
in the Makefile already, the scripts under tools used to be
"ready to use". However, in our current situation where the
python 2 interpreter is called different on different platforms
we still need to fix the shebang line. This patch achieves this
without moving source files around.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Merge branch 'stable-2.10' into stable-2.11

* stable-2.10
  Fix python shebang line in tools as well
  Do not hard-code python path

Conflicts:
	Makefile.am (trivial)

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Niklas Hambuechen <niklash@google.com>
Merge branch 'stable-2.11' into stable-2.12

* stable-2.11
  (no changes)

* stable-2.10
  Fix python shebang line in tools as well
  Do not hard-code python path

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Fixing handling of diskless instances

There were several checks that `all(...)` disks were of a certain type.
This leads to (often) wrong behaviour: `all([])` is true, so diskless
instances are all kinds of types. This fixes the issue by introducing
the helper functions AllDisksOfType and AnyDisksOfType.

Signed-off-by: Aaron Karper <akarper@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Merge branch 'stable-2.12' into stable-2.13

* stable-2.12
  Check for all NICs when looking for a free metad NIC name
  Use tools/vif-ganeti-metad when setting up Xen metad NIC
  Add a script for setting up the metad NIC for Xen
  Assemble Xen NIC parameters into a dictionary

* stable-2.10
  Fix python shebang line in tools as well
  Do not hard-code python path

Conflicts:
	Makefile.am - take additions from both versions

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Merge branch 'stable-2.13' into master

* stable-2.13
  Let drbd disks resync during cluster verify

* stable-2.12
  Check for all NICs when looking for a free metad NIC name
  Use tools/vif-ganeti-metad when setting up Xen metad NIC
  Add a script for setting up the metad NIC for Xen
  Assemble Xen NIC parameters into a dictionary

* stable-2.10
  Fix python shebang line in tools as well
  Do not hard-code python path

No conflicts.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Fix outdated comment

Ganeti.WConfD.Core has nothing to do with HTools.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
THH: Remove unused varNameE function

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Tests: Add forgotten HTools.ExtLoader test

Found by cabal.

Signed-off-by: Niklas Hambuechen <niklash@google.com>