ganeti-local
11 years agoSupport DRBD 8.4.3 command syntax
Thomas Thrainer [Thu, 2 May 2013 15:10:32 +0000 (17:10 +0200)]
Support DRBD 8.4.3 command syntax

DRBD 8.4.3 does not support specifying volume ids directly while
creating the meta device. It requires a slightly different syntax (using
flex-external as volume id) which is fortunately also supported by (at
least) DRBD 8.4.2.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoMerge branch 'stable-2.8' into master
Bernardo Dal Seno [Mon, 29 Apr 2013 16:48:52 +0000 (18:48 +0200)]
Merge branch 'stable-2.8' into master

* stable-2.8: (42 commits)
  Add shelltests for hspace allocation
  hspace: Handle multiple ipolicy specs
  QA: Test multiple instance specs
  QA: Handle multiple instance specs
  Unit test for cli.FormatPolicyInfo()
  Add command-line support for multiple specs in ipolicy
  Add multiple min/max specs in instance policy
  Separate checks for std spec compliance
  QA: Transpose instance specs
  Improve check for  "unreleased" versions in NEWS
  Update documentation for text format
  Add missing fields in htools text-backend documentation
  cfgupgrade: Remove enabled_disk_templates on downgrade
  Reason trail implementation for "start"
  Reason trail implementation for "shutdown"
  QA: More tests for instance policies in groups
  QA: Split function to set and parse instance policies
  QA: Update tests for new ipolicy specs command-line options
  Add unit tests for cfgupgrade with a real configuration
  Split functions in cfupgrade unit tests
  ...

Conflicts:
        lib/backend.py
        lib/bdev.py
        man/gnt-cluster.rst

lib/bdev.py was renamed to lib/block/bdev.py in master, so I've manually
applied the bc3427b7 commit to the new file. The other two are
straightforward conflicts.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoCleanup DRBD 8.4 devices properly during QA
Thomas Thrainer [Mon, 29 Apr 2013 11:51:29 +0000 (13:51 +0200)]
Cleanup DRBD 8.4 devices properly during QA

QA cleans up DRBD 8.4 devices via drbdsetup, which currently only worked
for DRBD 8.3. This (rather ugly) command makes sure that DRBD 8.4
devices are cleaned up as well.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAdd command generator for DRBD 8.4
Thomas Thrainer [Mon, 29 Apr 2013 11:51:28 +0000 (13:51 +0200)]
Add command generator for DRBD 8.4

The DRBD84CmdGenerator class, which generates commands suited for DRBD
8.4, is added. A common baseclass for DRBD83CmdGenerator and
DRBD84CmdGenerator is introduced as well.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAdd test for version dispatching code
Thomas Thrainer [Mon, 29 Apr 2013 12:02:39 +0000 (14:02 +0200)]
Add test for version dispatching code

Based on the version of DRBD (as reported through /proc/drbd), the DRBD8
class chooses helper objects which adapt for the differences between
DRBD <= 8.3 and DRBD 8.4. This new test verifies that the proper objects
are created.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAdd dependency on python-mock
Thomas Thrainer [Mon, 29 Apr 2013 11:51:27 +0000 (13:51 +0200)]
Add dependency on python-mock

Python Mock (http://www.voidspace.org.uk/python/mock/) is a mocking
library for Python. It is included in the standard Python distribution
as of Python 3.3, but has been around for quite a while. Debian unstable
contains a version we require.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoExtract DRBD related tests
Thomas Thrainer [Mon, 29 Apr 2013 11:51:26 +0000 (13:51 +0200)]
Extract DRBD related tests

As the DRBD code was extracted from bdev.py, the corresponding tests
should as well be extracted into their own file. That's what this patch
performs.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoExtract command generation logic from DRBD8
Thomas Thrainer [Mon, 29 Apr 2013 11:51:25 +0000 (13:51 +0200)]
Extract command generation logic from DRBD8

In order to easily support the DRBD 8.4 command syntax, this patch
extracts all command generation logic (i.e. where calls to `drbdsetup`
are assembled) into a new class DRBD83CmdGenerator.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoUse DRBD84ShowInfo based on DRBD version
Thomas Thrainer [Mon, 29 Apr 2013 11:51:24 +0000 (13:51 +0200)]
Use DRBD84ShowInfo based on DRBD version

Now the DRBD8 class actually checks which version of DRBD is running on
the system and chooses the right class to parse the `drbdsetup show`
output.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAdd `drbdsetup show` parser for DRBD 8.4
Thomas Thrainer [Mon, 29 Apr 2013 11:51:24 +0000 (13:51 +0200)]
Add `drbdsetup show` parser for DRBD 8.4

Common functionality between the DRBD 8.3 and DRBD 8.4 parser has been
extracted into BaseShowInfo. A test which verifies the behaviour is
included, but the DRBD84ShowInfo class is not yet used within the DRBD8
class.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoExtract DRBD info parsing into drbd_info.py
Thomas Thrainer [Mon, 29 Apr 2013 11:51:23 +0000 (13:51 +0200)]
Extract DRBD info parsing into drbd_info.py

Parsing the status (/proc/drbd) and `drbdsetup show` output takes quite
a bit of code, which has to be augmented by even more with the DRBD 8.4
support. So extract all the related classes into their own file.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoExtract DRBD8ShowInfo class
Thomas Thrainer [Mon, 29 Apr 2013 11:51:22 +0000 (13:51 +0200)]
Extract DRBD8ShowInfo class

This class parses the `drbdsetup show` output and represents it in an
easily accessible format. It got extracted so that 1) the DRBD8 class
can focus more on DRBD logic rather than parsing and 2) it's easier to
adapt the parser to new formats.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAdd test for DRBD 8.4 /proc/drbd parsing
Thomas Thrainer [Mon, 29 Apr 2013 11:51:21 +0000 (13:51 +0200)]
Add test for DRBD 8.4 /proc/drbd parsing

The current parser already supports the output of DRBD 8.4 /proc/drbd,
so add tests which actually verify this behaviour.
Note that the empty lines in proc_drbd84.txt are actually present in the
output of DRBD 8.4, they always appear when minors are not contiguous.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAdd test for empty version in /proc/drbd
Thomas Thrainer [Mon, 29 Apr 2013 11:51:21 +0000 (13:51 +0200)]
Add test for empty version in /proc/drbd

The previous patch removed a (rather implicit) test for /proc/drbd not
containing a version line. This adds an explicit test for this case.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoRename _JoinProcDataPerMinor to _JoinLinesPerMinor
Thomas Thrainer [Mon, 29 Apr 2013 11:51:20 +0000 (13:51 +0200)]
Rename _JoinProcDataPerMinor to _JoinLinesPerMinor

In the new context of the DRBD8Info class, the name
_JoinProcDataPerMinor doesn't fit any more. _JoinLinesPerMinor reflects
more precisely what's done, and doesn't imply that the data comes from
/proc/drbd.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoExtract /proc/drbd parsing code into DRBD8Info
Thomas Thrainer [Mon, 29 Apr 2013 11:51:19 +0000 (13:51 +0200)]
Extract /proc/drbd parsing code into DRBD8Info

As the DRBD8 class got bigger due to the previous merge of BaseDRBD, now
parts of it are ripped out into DRBD8Info. This new class parses
/proc/drbd and exposes the information in an easily accessible way. This
allowed to simplify some methods in DRBD8 and do make the tests more
concise.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoRemove BaseDRBD
Thomas Thrainer [Wed, 24 Apr 2013 14:59:11 +0000 (16:59 +0200)]
Remove BaseDRBD

BaseDRBD was probably useful when DRBD 0.7 and DRBD 8 were supported.
However, there is only one subclass of BaseDRBD remaining (DRBD8), and
the separation of responsibilities between those two classes was rather
randomly chosen.

The unification into one class also eases the introduction of
DRBD 8.4 support, as the responsibilities of the class(es) will be
distributed anew.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoRename _MassageProcData to _JoinProcDataPerMinor
Thomas Thrainer [Wed, 24 Apr 2013 14:59:04 +0000 (16:59 +0200)]
Rename _MassageProcData to _JoinProcDataPerMinor

That's what the method actually does, so there is no reason why we
should use a funny but unreadable name.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAdd shelltests for hspace allocation
Bernardo Dal Seno [Wed, 24 Apr 2013 01:15:14 +0000 (03:15 +0200)]
Add shelltests for hspace allocation

Both tiered and standard allocations are tested, with a single and a double
min/max instance specification.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agohspace: Handle multiple ipolicy specs
Bernardo Dal Seno [Tue, 23 Apr 2013 21:11:01 +0000 (23:11 +0200)]
hspace: Handle multiple ipolicy specs

With tiered allocation, hspace uses all the max specs in turn as the
initial instance spec.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoQA: Test multiple instance specs
Bernardo Dal Seno [Tue, 23 Apr 2013 14:37:41 +0000 (16:37 +0200)]
QA: Test multiple instance specs

The test of the interaction between policy and instances is extended.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoQA: Handle multiple instance specs
Bernardo Dal Seno [Mon, 22 Apr 2013 23:24:25 +0000 (01:24 +0200)]
QA: Handle multiple instance specs

Existing tests are updated to cope with the new instance specs format.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoUnit test for cli.FormatPolicyInfo()
Bernardo Dal Seno [Mon, 22 Apr 2013 14:59:58 +0000 (16:59 +0200)]
Unit test for cli.FormatPolicyInfo()

We try to parse the string obtained by formatting a policy, and see if we
get the same policy.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd command-line support for multiple specs in ipolicy
Bernardo Dal Seno [Mon, 15 Apr 2013 23:24:22 +0000 (01:24 +0200)]
Add command-line support for multiple specs in ipolicy

Command line options accept multiple min/max specifications in instance
policies. The output of show-ispecs-cmd is updated accordingly.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd multiple min/max specs in instance policy
Bernardo Dal Seno [Mon, 15 Apr 2013 09:03:38 +0000 (11:03 +0200)]
Add multiple min/max specs in instance policy

Now instance policies can contain more than one min/max specs.  This is the
main element of the "Constrained instance sizes" section in the
"Partitioned Ganeti" design doc.

This is a big patch, but changing the type of a configuration item requires
to change all the code that handles it.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoSeparate checks for std spec compliance
Bernardo Dal Seno [Tue, 16 Apr 2013 11:49:48 +0000 (13:49 +0200)]
Separate checks for std spec compliance

This is needed to be able to validate the std spec against multiple min/max
spec pairs (appearing in next patches).

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoQA: Transpose instance specs
Bernardo Dal Seno [Mon, 22 Apr 2013 23:21:01 +0000 (01:21 +0200)]
QA: Transpose instance specs

The format used to store instance specs in QA is changed to better handle
multiple instance specs, a feature contained in the following patches.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoMake DEFAULT_ENABLED_DISK_TEMPLATES a list
Helga Velroyen [Fri, 26 Apr 2013 13:59:33 +0000 (15:59 +0200)]
Make DEFAULT_ENABLED_DISK_TEMPLATES a list

This patch makes the constant DEFAULT_ENABLED_DISK_TEMPLATES
a list instead of a set, because the order of the elements actually matters
as the first one is planned to be the default disk template for instance
creation. Also, this constant is always used like a list and thus providing it
as a set complicates the code that uses it.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoDocument the --drbd-usermode-helper in man gnt-cluster
Helga Velroyen [Fri, 12 Apr 2013 20:21:08 +0000 (22:21 +0200)]
Document the --drbd-usermode-helper in man gnt-cluster

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoNEWS: removal of --no-lvm-storage
Helga Velroyen [Fri, 12 Apr 2013 20:24:05 +0000 (22:24 +0200)]
NEWS: removal of --no-lvm-storage

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoRemove '--no-lvm-storage' from 'gnt-cluster' man page
Helga Velroyen [Fri, 12 Apr 2013 20:15:35 +0000 (22:15 +0200)]
Remove '--no-lvm-storage' from 'gnt-cluster' man page

This updates the man page of 'gnt-cluster' regarding the
removal of the '--no-lvm-storage'.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoFix lint error in cmdlib
Helga Velroyen [Fri, 26 Apr 2013 14:07:09 +0000 (16:07 +0200)]
Fix lint error in cmdlib

Was accidentally introduced by commit 912737ba.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agognt-cluster modify/init: deprecate --no-lvm-storage
Helga Velroyen [Tue, 2 Apr 2013 11:16:46 +0000 (13:16 +0200)]
gnt-cluster modify/init: deprecate --no-lvm-storage

This patch does three things:

1. It deprecates the option '--no-lvm-storage' of 'gnt-cluster modify'
and 'gnt-cluster init'. Technically, it is not fully removed, but kept in order
to warn the user that it is no longer supported and that she should use
--enabled-disk-templates instead.

2. The consistency check between '--no-lvm-storage' and '--vg-name' is replaced
by checks between '--enabled-disk-templates' and '--vg-name'. There are these
cases:
- vg name, lvm disk template enabled = ok
- no vg name, lvm disk template enabled = error
- vg name, no lvm enabled = warning
- no vg name, no lvm enabled = ok
I added quite a lot of tests for all these and the transitions from each case
to another to the QA.

3. The check whether or not the volume group is available on all nodes is now
done only in these cases:
- the volume group name gets set and lvm is already enabled
- lvm is getting enabled and the volume group was set before

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoUtility functions for storage
Helga Velroyen [Tue, 2 Apr 2013 13:20:47 +0000 (15:20 +0200)]
Utility functions for storage

This patch add a couple of utility functions dealing with
storage types and disk templates.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoMerge branch 'stable-2.7' into stable-2.8
Guido Trotter [Thu, 25 Apr 2013 10:25:50 +0000 (12:25 +0200)]
Merge branch 'stable-2.7' into stable-2.8

This fixes the problem with the distcheck-release target failing needlessly.

* stable-2.7:
  Improve check for  "unreleased" versions in NEWS

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

11 years agoImprove check for "unreleased" versions in NEWS
Guido Trotter [Thu, 25 Apr 2013 08:37:29 +0000 (10:37 +0200)]
Improve check for  "unreleased" versions in NEWS

Currently this is checked only when distcheck-release is called.
Check it in check-news instead, for all versions before the "current"
one (as defined by configure.ac)

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoUpdate documentation for text format
Klaus Aehlig [Thu, 25 Apr 2013 08:31:48 +0000 (10:31 +0200)]
Update documentation for text format

In commit 000ca91a the text format was extended to also include
information about the master node. This commit updates the
htools man page to reflect this change.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoMerge branch 'stable-2.7' into stable-2.8
Klaus Aehlig [Wed, 24 Apr 2013 16:30:26 +0000 (18:30 +0200)]
Merge branch 'stable-2.7' into stable-2.8

Conflicts:
NEWS
doc/rapi.rst

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd missing fields in htools text-backend documentation
Bernardo Dal Seno [Wed, 24 Apr 2013 12:40:35 +0000 (14:40 +0200)]
Add missing fields in htools text-backend documentation

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

11 years agocfgupgrade: Remove enabled_disk_templates on downgrade
Bernardo Dal Seno [Wed, 24 Apr 2013 14:08:10 +0000 (16:08 +0200)]
cfgupgrade: Remove enabled_disk_templates on downgrade

Remove enabled_disk_templates instead of the deprecated
enabled_storage_types.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoReason trail implementation for "start"
Michele Tartara [Tue, 23 Apr 2013 11:38:44 +0000 (13:38 +0200)]
Reason trail implementation for "start"

Opcode-specific implementation of the reason trail for the instance
startup operation.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoReason trail implementation for "shutdown"
Michele Tartara [Mon, 22 Apr 2013 15:26:29 +0000 (15:26 +0000)]
Reason trail implementation for "shutdown"

Opcode-specific implementation of the reason trail for the instance shutdown
operation.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoQA: More tests for instance policies in groups
Bernardo Dal Seno [Fri, 12 Apr 2013 13:53:24 +0000 (15:53 +0200)]
QA: More tests for instance policies in groups

Instance policies are changed and checked for changes.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoQA: Split function to set and parse instance policies
Bernardo Dal Seno [Fri, 12 Apr 2013 08:22:35 +0000 (10:22 +0200)]
QA: Split function to set and parse instance policies

The main parts, moved to qa_util, will be used for node groups too.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoQA: Update tests for new ipolicy specs command-line options
Bernardo Dal Seno [Mon, 4 Mar 2013 23:30:33 +0000 (00:30 +0100)]
QA: Update tests for new ipolicy specs command-line options

The old command-line options weren't working any more. Utility functions
are updated, and broken tests are removed (new tests are coming in the
following patches).

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd unit tests for cfgupgrade with a real configuration
Bernardo Dal Seno [Mon, 15 Apr 2013 09:52:04 +0000 (11:52 +0200)]
Add unit tests for cfgupgrade with a real configuration

Test upgrade and downgrade from a realistic 2.7 configuration.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoSplit functions in cfupgrade unit tests
Bernardo Dal Seno [Wed, 10 Apr 2013 23:06:24 +0000 (01:06 +0200)]
Split functions in cfupgrade unit tests

This makes easier to test real configurations.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agocfgupgrade: Limit specs in ipolicy are always complete
Bernardo Dal Seno [Mon, 8 Apr 2013 18:42:59 +0000 (20:42 +0200)]
cfgupgrade: Limit specs in ipolicy are always complete

Partial specs are filled with cluster defaults.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoLimit specs in ipolicy command lines are always complete
Bernardo Dal Seno [Mon, 8 Apr 2013 18:40:40 +0000 (20:40 +0200)]
Limit specs in ipolicy command lines are always complete

Command line options are brought in line with the specs change of previous
patch. Old options are still allowed in gnt-cluster init, where the
semantic will remain non-ambiguous even after introducing multiple specs.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoLimit specs in instance policies are always complete
Bernardo Dal Seno [Mon, 8 Apr 2013 18:36:34 +0000 (20:36 +0200)]
Limit specs in instance policies are always complete

Specs used to specify limits in instance policies are always complete, even
at group level (only the whole limit set can be overridden). This is in
preparation for introducing multiple limits.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoRefactor tests in ipolicy validation
Bernardo Dal Seno [Tue, 9 Apr 2013 15:37:00 +0000 (17:37 +0200)]
Refactor tests in ipolicy validation

This makes the code more modular, in preparation for the following patches.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoQA for --ipolicy-xxx-specs and show-ispecs-cmd
Bernardo Dal Seno [Fri, 5 Apr 2013 15:56:41 +0000 (17:56 +0200)]
QA for --ipolicy-xxx-specs and show-ispecs-cmd

The tests check the interactions between the two commands.

Also refactored group QA code to separate tests about ipolicy, as those
tests are going to grow in complexity.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd command to print ipolicy options
Bernardo Dal Seno [Thu, 4 Apr 2013 20:30:59 +0000 (22:30 +0200)]
Add command to print ipolicy options

The output of this command can be used to create an exact copy of the
current instance policy specs. The command could be expanded to print all
the options used to create a group or the cluster.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd --ipolicy-xxx-specs options
Bernardo Dal Seno [Mon, 11 Mar 2013 14:12:21 +0000 (15:12 +0100)]
Add --ipolicy-xxx-specs options

These options allow to specify whole instance policy specs. This is needed
for the upcoming changes that tend to threat specs as monolithic objects.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoNew CLI input type: list of key/value pairs
Bernardo Dal Seno [Wed, 6 Mar 2013 12:03:44 +0000 (13:03 +0100)]
New CLI input type: list of key/value pairs

This will be used for the new instance specs options.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAllow "default" as a value for ipolicy templates
Bernardo Dal Seno [Mon, 8 Apr 2013 17:59:25 +0000 (19:59 +0200)]
Allow "default" as a value for ipolicy templates

Previously the string value was being corrupted.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoDocument all --ipolicy-... options
Bernardo Dal Seno [Fri, 5 Apr 2013 12:48:26 +0000 (14:48 +0200)]
Document all --ipolicy-... options

They were missing from the man pages.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoExtract DRBD-related classes into block/drbd.py
Thomas Thrainer [Tue, 23 Apr 2013 12:04:23 +0000 (14:04 +0200)]
Extract DRBD-related classes into block/drbd.py

This is in preparation to introducing support for DRBD8.4.
base.py had to be extracted as well in order to avoid cylic imports
between bdev.py and drbd.py. It now contains the BlockDev class and
utility functions needed by bdev.py and drbd.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoMove lib/bdev.py to lib/block/bdev.py
Thomas Thrainer [Tue, 23 Apr 2013 12:04:22 +0000 (14:04 +0200)]
Move lib/bdev.py to lib/block/bdev.py

That's in preparation of extracting DRBD related code from bdev.py. As
bdev.py is already rather long, new features will require to split it
into more manageable pieces. That's why it's moved in an own directory.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoFix a few unclear sentences in gnt-cluster(8)
Guido Trotter [Tue, 23 Apr 2013 12:05:28 +0000 (14:05 +0200)]
Fix a few unclear sentences in gnt-cluster(8)

The renew-crypto entry had a few obscure sentences. Improve it by
rephrasing it.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

11 years agoMake burnin compatible with the reason trail
Michele Tartara [Tue, 23 Apr 2013 08:42:03 +0000 (08:42 +0000)]
Make burnin compatible with the reason trail

The burnin uses its own option list, different from the one of all other
command line programs, and uses it as a parameter to a function that now
requires the "--reason" option to be present.

This commit updates the burnin option list to be compatible with the reason
trail implementation.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoExtend the simulation backend to also simulate a master node
Klaus Aehlig [Mon, 22 Apr 2013 11:50:26 +0000 (13:50 +0200)]
Extend the simulation backend to also simulate a master node

In a simulated cluster as created by the simulation backend to
the htools, make the first node of the first node group the master
node. In this way, hools (like hroller) that require a master node
can also be used on simulated clusters, e.g., for testing.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAdd unit tests for hroller
Klaus Aehlig [Mon, 22 Apr 2013 11:09:06 +0000 (13:09 +0200)]
Add unit tests for hroller

Add a unit test for hroller in a situation where the order
is completely determined. There are 3 nodes where node 2 has,
for each of the other nodes, an instanced shared with it. So
node 2 has to be a reboot group of its own. There are no more
instances, hence, my minimality, the other two nodes have to
form a single group. Node 1 is the master, and hence has to
be rebooted last; this determines the order.

Also add a unit test verifying that hroller rejects configurations
with multiple master nodes, even if the option --force is given.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoExtend Text format by marking the master node
Klaus Aehlig [Fri, 19 Apr 2013 12:58:43 +0000 (14:58 +0200)]
Extend Text format by marking the master node

Sometimes, e.g., for hroller, it is necessary to know which node
is the master node. Therefore this information has to be included
in the text format as well. Since we never use an offline node as
master node, we can put this information can be put in the "is
offline" field; as old versions only check this field for equality
to "Y", using "M" to indicate the master is compatible in both
directions. This also leaves room to add more roles in the future,
should we need them.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoMinor changes / bugfixes in documentation
Sebastian Gebhard [Mon, 22 Apr 2013 15:28:57 +0000 (17:28 +0200)]
Minor changes / bugfixes in documentation

Signed-off-by: Sebastian Gebhard <sege@fs.ei.tum.de>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

11 years agoReason trail implementation for instance reboot
Michele Tartara [Fri, 22 Mar 2013 18:31:56 +0000 (19:31 +0100)]
Reason trail implementation for instance reboot

This commits allows ganeti to correctly forward the reason trail information
regarding instance reboot.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd "reason" as a common parameter for all the RAPI calls
Michele Tartara [Tue, 26 Mar 2013 09:27:37 +0000 (10:27 +0100)]
Add "reason" as a common parameter for all the RAPI calls

Also, this add an infrastructure for having parameters common to all the
RAPI calls.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd infrastructure for adding common RAPI parameters
Michele Tartara [Tue, 26 Mar 2013 09:33:21 +0000 (10:33 +0100)]
Add infrastructure for adding common RAPI parameters

Some parameters can be common to all the RAPI calls: this commit
adds the possibility of specifying them just once, instead of
manually adding them to the classes describing each call.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd job_id and index to the reason trail
Michele Tartara [Tue, 26 Mar 2013 08:54:03 +0000 (09:54 +0100)]
Add job_id and index to the reason trail

The reason trail will contain an item indicating the job_id and the
index number of the current opcode inside the job queue.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd the reason trail to the opcodes
Michele Tartara [Tue, 26 Mar 2013 12:58:53 +0000 (13:58 +0100)]
Add the reason trail to the opcodes

The reason trail is available for all the opcodes, and as such it is
initialized as a generic option.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd a field to store the reason trail in OpCodes
Michele Tartara [Mon, 25 Mar 2013 17:24:51 +0000 (18:24 +0100)]
Add a field to store the reason trail in OpCodes

The reason trail will be available for all the OpCodes, so the field that
is to contain it has to be added to the OpCode base class.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoProvide "--reason" as a parameter for all commands
Michele Tartara [Mon, 25 Mar 2013 17:19:38 +0000 (18:19 +0100)]
Provide "--reason" as a parameter for all commands

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd function for extending the reason trail
Michele Tartara [Mon, 25 Mar 2013 15:51:07 +0000 (16:51 +0100)]
Add function for extending the reason trail

Noded functions will have to extend the reason trail specifying what
operation is being executed.

This commit adds a function for doing that (will be used by future commits).

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd an opcode name conversion function
Michele Tartara [Mon, 25 Mar 2013 15:14:41 +0000 (16:14 +0100)]
Add an opcode name conversion function

Add a function to convert an opcode class name to a source string for the
reason trail, factoring out the code in common with the existing _NameToId
function.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd function for storing the reason trail of an instance
Michele Tartara [Mon, 25 Mar 2013 15:00:25 +0000 (16:00 +0100)]
Add function for storing the reason trail of an instance

We are interested in storing the reason trail for operations that changed
the state of instances. This commit adds a function to do this.

Also, the GetInstReasonFilename() function name is prepended with an
underscore because it is only used in this file.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd function for getting the timestamp in nanoseconds
Michele Tartara [Mon, 25 Mar 2013 14:21:06 +0000 (15:21 +0100)]
Add function for getting the timestamp in nanoseconds

The timestamp is returned as an integer number of nanoseconds since the Unix
epoch.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd TMaybeList as a new type for parameters
Michele Tartara [Mon, 25 Mar 2013 14:15:26 +0000 (15:15 +0100)]
Add TMaybeList as a new type for parameters

This will be used as the type for the reason trail parameter.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd constants for the reason trail implementation
Michele Tartara [Mon, 25 Mar 2013 14:11:31 +0000 (15:11 +0100)]
Add constants for the reason trail implementation

A few constants are required, describing the source reason of the opcode.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoRemove old "reason" implementation
Michele Tartara [Mon, 25 Mar 2013 13:55:31 +0000 (13:55 +0000)]
Remove old "reason" implementation

Remove the useless parts of the old, partial, implementation of the support for
tracking the reason of instances state change, before implementing the new
reason trail support, as per the design document.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoMore specifics on the implementation of the reason trail
Michele Tartara [Fri, 22 Mar 2013 18:26:34 +0000 (19:26 +0100)]
More specifics on the implementation of the reason trail

Adding the reason trail as a parameter instead of as a new class attribute fits
better with the current structure of the system.

Also, the description of what part of the implementation will be OpCode
specific and which will be shared is added.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd monitoring daemon user to user creation script
Michele Tartara [Mon, 22 Apr 2013 09:22:25 +0000 (09:22 +0000)]
Add monitoring daemon user to user creation script

The script was added to Ganeti before the monitoring daemon, so it
did not include that user yet.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

11 years agodevel/review: fix addition of reviewer from environment
Klaus Aehlig [Mon, 22 Apr 2013 09:08:29 +0000 (11:08 +0200)]
devel/review: fix addition of reviewer from environment

In commit 3dd990, the possibility of taking a default reviewer
from the environment was introduced. Fix two deficits here
- perl does not inherit the environment
- add at all places.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoQA: Skip RAPI setup when RAPI is disabled
Bernardo Dal Seno [Fri, 19 Apr 2013 12:39:28 +0000 (14:39 +0200)]
QA: Skip RAPI setup when RAPI is disabled

This is similar to 405692ef, reverted in aeefb4cd.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoBump up version for 2.7.0~beta3 v2.7.0beta3
Guido Trotter [Mon, 22 Apr 2013 09:05:07 +0000 (11:05 +0200)]
Bump up version for 2.7.0~beta3

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoUpdate NEWS for 2.7.0~beta3
Guido Trotter [Thu, 18 Apr 2013 13:53:11 +0000 (15:53 +0200)]
Update NEWS for 2.7.0~beta3

- Most entries for beta1 are moved to the top level
- The beta1 to beta2 delta is left

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAllow proper cleanup of partially created disks
Michele Tartara [Tue, 16 Apr 2013 12:56:39 +0000 (12:56 +0000)]
Allow proper cleanup of partially created disks

During the creation of an instance, if the creation of disks fails, some
partially created disks might remain lying around. There is an already
implemented cleanup procedure, but it requires the disks to be listed in the
disks_created variable, which is updated after the creation of the disk itself
to prevent it from removing disks already existing previously.

This patch introduces a better tracking of partially created disks, so that
they can be removed without risking removing already existing ones.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoMake hroller insist on finding precisely one master node
Klaus Aehlig [Thu, 18 Apr 2013 12:53:45 +0000 (14:53 +0200)]
Make hroller insist on finding precisely one master node

As people rely on the master node being the last node of the last
group, make hroller fail, if no master node could be found in the
cluster. This happens, e.g., if a backend format is used that does not
contain information about the master node. The error can be turned
into a warning by using the --force option.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoUpdate hroller man page: master node is last
Klaus Aehlig [Wed, 17 Apr 2013 11:13:17 +0000 (13:13 +0200)]
Update hroller man page: master node is last

Where the information is available, hroller now schedules the
master node as the last node in the last group. Update the man
page to reflect this change.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoIn Rapi, set master correctly
Klaus Aehlig [Wed, 17 Apr 2013 09:22:02 +0000 (11:22 +0200)]
In Rapi, set master correctly

The cluster data contains the information about the master
node. Use this information to set the isMaster bit correctly.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoIn Luxi, set the master correctly
Klaus Aehlig [Tue, 16 Apr 2013 12:19:36 +0000 (14:19 +0200)]
In Luxi, set the master correctly

The cluster data contains the information about the master
node. Use this information to set the isMaster bit correctly.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoUtility function to set the master node in a node list
Klaus Aehlig [Wed, 17 Apr 2013 09:42:28 +0000 (11:42 +0200)]
Utility function to set the master node in a node list

The information about which node is the master node is a cluster-wide
setting, in most formats provided independently of the node information.
Most backends therefore have to set the isMaster bit indepently in the
obtained node list. This patch provides a utility function for this.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoMake Hroller present master node last
Klaus Aehlig [Tue, 16 Apr 2013 08:57:39 +0000 (10:57 +0200)]
Make Hroller present master node last

If in the list of nodes to be scheduled for maintaince,
one is marked as being the master node, schedule it
as the last node in the last group.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoExtend the node description by isMaster
Klaus Aehlig [Mon, 15 Apr 2013 12:54:23 +0000 (14:54 +0200)]
Extend the node description by isMaster

Extend the description of the node by the property
of being the master node; also provide and appropriate
setter function. This property will be used, e.g., by
hroller to schedule reboot of the master last.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoupdate hroller man page: node group filtering is implemented
Klaus Aehlig [Wed, 17 Apr 2013 11:23:37 +0000 (13:23 +0200)]
update hroller man page: node group filtering is implemented

Filtering of nodes by node group was already implemented in
2fce67b; fix the man page to reflect this change.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoUse correct name for design-storagespace.rst
Guido Trotter [Fri, 19 Apr 2013 10:22:36 +0000 (12:22 +0200)]
Use correct name for design-storagespace.rst

This was renamed in b284f50 but the old name was still in use in the
makefile and draft designs list.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

11 years agoStorage type design doc: ipolicy vs. enabled disk templates
Helga Velroyen [Wed, 17 Apr 2013 17:56:47 +0000 (19:56 +0200)]
Storage type design doc: ipolicy vs. enabled disk templates

Adding the design decision regarding the consistency of the enabled disk
templates in the ipolicy and in the cluster config.

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

11 years agoRename design doc from space reporting to storage types
Helga Velroyen [Wed, 17 Apr 2013 17:50:30 +0000 (19:50 +0200)]
Rename design doc from space reporting to storage types

Since the design doc for storage space reporting ended up being mostly
about disk templates and storage types, and the space reporting being
just a small part of it, I am renaming the design doc.

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

11 years agoQA: Fix error regarding missing names of disk configs
Helga Velroyen [Wed, 17 Apr 2013 18:55:47 +0000 (20:55 +0200)]
QA: Fix error regarding missing names of disk configs

This fixes an error in case there are no disk names in the QA config
(which was the case till recently). Right now, QA tries to use 'None'
as disk name and that makes instance creation fail.

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

11 years agoRevert "Make invocation of rapi test configurable ..."
Helga Velroyen [Wed, 17 Apr 2013 22:15:41 +0000 (00:15 +0200)]
Revert "Make invocation of rapi test configurable ..."

This reverts commit 405692eff3d6f8400834f2df93d597bc7e4dd89f, because it
breaks QA.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agodevel/review: take default reviewer from environment
Klaus Aehlig [Fri, 12 Apr 2013 09:34:55 +0000 (11:34 +0200)]
devel/review: take default reviewer from environment

When adding a 'Reviewed-by'-line, also add the reviewer
passed through the REVIEWER environment variable. In that
way, adding the reviewer for patch series all reviewed
by the same person gets easier.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>