ganeti-local
11 years agognt-cluster repair-disk-sizes repairs spindles too
Bernardo Dal Seno [Thu, 23 May 2013 00:03:13 +0000 (02:03 +0200)]
gnt-cluster repair-disk-sizes repairs spindles too

When exclusive storage is active, any wrong or missing spindles information
in disks gets updated too.

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

11 years agoNew RPC to get size and spindles of disks
Bernardo Dal Seno [Wed, 22 May 2013 23:21:19 +0000 (01:21 +0200)]
New RPC to get size and spindles of disks

This RPC replaces the existing one that only returned disk size.

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

11 years agoNew BlockDev methods to get spindles
Bernardo Dal Seno [Wed, 22 May 2013 23:19:24 +0000 (01:19 +0200)]
New BlockDev methods to get spindles

Two new methods are created to get the number of spindles, one alone, and
one together with size. For devices that don't support spindles, None is
returned.

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

11 years agoAttaching a logical volume builds a list of PVs
Bernardo Dal Seno [Tue, 21 May 2013 22:33:08 +0000 (00:33 +0200)]
Attaching a logical volume builds a list of PVs

When an LV gets attached, the list of the PVs used by the LV is built. This
will be used to count spindles for exclusive_storage, but it could also be
useful to optimize disk growing and snapshotting.

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

11 years agoRefactor code for attaching a logical volume
Bernardo Dal Seno [Tue, 21 May 2013 20:27:58 +0000 (22:27 +0200)]
Refactor code for attaching a logical volume

The parsing of "lvs" output is moved into private methods. The code is
slightly more readable and testable. The split in two methods is useful
for the following patches. Unit tests for the new functions are
provided.

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

11 years agoFix missing "raise" in QA
Bernardo Dal Seno [Fri, 24 May 2013 10:41:38 +0000 (12:41 +0200)]
Fix missing "raise" in QA

The bug was introduced in 345d395d.

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

11 years agoMerge branch 'stable-2.8'
Guido Trotter [Fri, 24 May 2013 11:26:50 +0000 (13:26 +0200)]
Merge branch 'stable-2.8'

* stable-2.8:
  Bump up version for 2.7.0~rc2 release
  Create overall design document for 2.8
  Add NEWS entry for SO_PEERCRED fix
  Workaround missing SO_PEERCRED
  Add debugging clause to _ExpandCheckDisks error
  Reduce pylint maximum file length to 4500
  Mention hail network incompatibility in manpages
  Remove obsolete Debian-related documentation
  Update NEWS for 2.7.0 rc2
  Improve installation documentation
  Add Harep man page
  Stash Xen config file after a failed startup
  Fix owner of the OS log dir

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

11 years agoMerge branch 'stable-2.7' into stable-2.8
Guido Trotter [Fri, 24 May 2013 11:19:28 +0000 (13:19 +0200)]
Merge branch 'stable-2.7' into stable-2.8

* stable-2.7:
  Bump up version for 2.7.0~rc2 release
  Add NEWS entry for SO_PEERCRED fix
  Workaround missing SO_PEERCRED
  Add debugging clause to _ExpandCheckDisks error
  Mention hail network incompatibility in manpages
  Remove obsolete Debian-related documentation
  Update NEWS for 2.7.0 rc2
  Improve installation documentation
  Fix owner of the OS log dir

Conflicts:
lib/cmdlib.py: port to cmdlib/instance_storage.py
lib/tools/ensure_dirs.py: trivial

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

11 years agoBump up version for 2.7.0~rc2 release v2.7.0rc2
Guido Trotter [Fri, 24 May 2013 09:21:26 +0000 (11:21 +0200)]
Bump up version for 2.7.0~rc2 release

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

11 years agoQA for spindles in creating disks
Bernardo Dal Seno [Wed, 15 May 2013 19:47:20 +0000 (21:47 +0200)]
QA for spindles in creating disks

"gnt-instance add" and "gnt-instance recreate-disks" are tested giving the
number of spindles, when supported. Also, QA for "gnt-instance
recreate-disks" now covers the case where disks are resized.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoCreate overall design document for 2.8
Michele Tartara [Fri, 3 May 2013 09:11:33 +0000 (11:11 +0200)]
Create overall design document for 2.8

Also, cleanup the list of draft designs.

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

11 years agocfgupgrade: Remove spindles on downgrade
Bernardo Dal Seno [Wed, 15 May 2013 00:17:56 +0000 (02:17 +0200)]
cfgupgrade: Remove spindles on downgrade

Spindles didn't exist in 2.8 and should be removed to downgrade.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agognt-instance info prints information about spindles
Bernardo Dal Seno [Tue, 14 May 2013 16:51:54 +0000 (18:51 +0200)]
gnt-instance info prints information about spindles

For each disk, the number of requested spindles (if present) is shown.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoSpindles are used in creating new disks
Bernardo Dal Seno [Tue, 14 May 2013 15:59:55 +0000 (17:59 +0200)]
Spindles are used in creating new disks

The requested number of spindles is used to allocate PVs when creating new
LVs.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoDocument disk device Create() functions
Bernardo Dal Seno [Tue, 14 May 2013 15:25:36 +0000 (17:25 +0200)]
Document disk device Create() functions

Document all the arguments and return values of bdev.Create() and
bdev.BlockDev.Create().

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoAdd spindles field to disk object
Bernardo Dal Seno [Tue, 7 May 2013 16:37:05 +0000 (18:37 +0200)]
Add spindles field to disk object

The field is filled with the value provided on the command line.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoCheck that spindles are not given when they are not allowed
Bernardo Dal Seno [Tue, 7 May 2013 15:35:14 +0000 (17:35 +0200)]
Check that spindles are not given when they are not allowed

Masterd checks that specifications for new disks don't include spindles
when exclusive storage is disabled.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoAdd "spindles" option to instance disk creation commands
Bernardo Dal Seno [Mon, 6 May 2013 10:51:26 +0000 (12:51 +0200)]
Add "spindles" option to instance disk creation commands

The option is parsed but ignored, for the moment.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoFix style inconsistencies in gnt-instance man page
Bernardo Dal Seno [Mon, 6 May 2013 09:31:09 +0000 (11:31 +0200)]
Fix style inconsistencies in gnt-instance man page

Escaping and initial capitals were not uniform.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agocfgupgrade: Downgrade is a NO-OP
Bernardo Dal Seno [Tue, 30 Apr 2013 14:07:17 +0000 (16:07 +0200)]
cfgupgrade: Downgrade is a NO-OP

The configuration is still the same as in 2.8 (the reference stable version
for this branch), so downgrade shouldn't do anything.

Unit tests are also updated, with a new 2.8 configuration file. The
configuration file used for the upgrade+downgrade test was tailored to the
2.7 downgrade, and it's not needed any more.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoAdd NEWS entry for SO_PEERCRED fix
Guido Trotter [Wed, 22 May 2013 14:55:37 +0000 (16:55 +0200)]
Add NEWS entry for SO_PEERCRED fix

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

11 years agoDesign doc for internal shutdown detection
Michele Tartara [Fri, 17 May 2013 09:42:47 +0000 (10:42 +0100)]
Design doc for internal shutdown detection

Ganeti is currently not able to detect a legit shutdown request performed by a
user from inside a Xen domain.

This patch provides a design document to implement a mechanism able to cope with
such events.

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

11 years agoDocument recent hroller changes in the NEWS file
Klaus Aehlig [Wed, 22 May 2013 12:19:17 +0000 (14:19 +0200)]
Document recent hroller changes in the NEWS file

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

11 years agoDocument hroller options recently added
Klaus Aehlig [Wed, 22 May 2013 12:57:16 +0000 (14:57 +0200)]
Document hroller options recently added

hroller now also supports the options --skip-non-redundant and
--ignore-non-redundant, and this should be documented in the
man page as well.

While there, also use the same order in the options section
as in the synopsis, and in the synopsis group the algorithms
into
- those that modify the set of nodes to be scheduled, and
- those that modify the constraints to be taken into account.

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

11 years agoWorkaround missing SO_PEERCRED
Guido Trotter [Wed, 22 May 2013 12:57:51 +0000 (14:57 +0200)]
Workaround missing SO_PEERCRED

This bug happens in a few new distributions, so we workaround it by
defining the constant ourselves, if it's missing.

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

11 years agoAdd debugging clause to _ExpandCheckDisks error
Guido Trotter [Wed, 22 May 2013 12:52:32 +0000 (14:52 +0200)]
Add debugging clause to _ExpandCheckDisks error

This has been reported by users, so we should have the extra debugging
available.

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

11 years agoReduce pylint maximum file length to 4500
Thomas Thrainer [Wed, 22 May 2013 13:47:05 +0000 (15:47 +0200)]
Reduce pylint maximum file length to 4500

The longest Python files we still have are around 4200 lines long. In
order to prevent future growth, limit the maximum file length (checked
by pylint) to 4500 lines.

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

11 years agoExtend hroller tests by options for non-redundant instances
Klaus Aehlig [Wed, 22 May 2013 10:49:17 +0000 (12:49 +0200)]
Extend hroller tests by options for non-redundant instances

The cluster now consists of 3 nodes, with drbd instances between
nodes 1 and 2, and 2 and 3. Additionally, nodes 1 and 3 each contain
a non-redundant instance, but node 2 cannot hold two additional
instances.

So,
- if we take non-redundant instances into account (the new default
  behavior), the nodes have to be rebooted individually,
- if we ignore non-redundant instances, nodes 1 and 3 can be rebooted
  simultaneously, and
- if we skip nodes with non-redundant instances, only a single node
  remains (of course, forming a single reboot group).

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

11 years agoMention hail network incompatibility in manpages
Guido Trotter [Wed, 22 May 2013 10:54:49 +0000 (12:54 +0200)]
Mention hail network incompatibility in manpages

We can't fix this in the 2.7 version, so it should be documented.

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

11 years agoRemove obsolete Debian-related documentation
Thomas Thrainer [Wed, 22 May 2013 09:23:59 +0000 (11:23 +0200)]
Remove obsolete Debian-related documentation

This part of the documentation refers to Grub instead of Grub2, but
Grub2 has been the standard boot loader since Squeeze. As this part only
(wrongly) repeats the preceeding documentation, it's removed completely.

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

11 years agoUpdate NEWS for 2.7.0 rc2
Guido Trotter [Tue, 21 May 2013 08:00:43 +0000 (10:00 +0200)]
Update NEWS for 2.7.0 rc2

Move "local" entries at the bottom, and leave global 2.7 entries at the
top, as for the other releases.

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

11 years agoTest for hroller taking non-redundant instances into account
Klaus Aehlig [Tue, 14 May 2013 09:45:22 +0000 (11:45 +0200)]
Test for hroller taking non-redundant instances into account

The example cluster consists of 6 nodes, each hosting 2 instances and
having capacity for 3. So, while the drbd-induced graph consists of
only insulated nodes, no more than two nodes can be rebooted at the
same time.

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

11 years agohroller: option to ignore non-redundant instances
Klaus Aehlig [Thu, 16 May 2013 17:36:47 +0000 (19:36 +0200)]
hroller: option to ignore non-redundant instances

Add an option to hroller restoring the old behavior on not taking
any non-redundant instances into account when forming reboot
groups.

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

11 years agoMake hroller also plan for non-redundant instances
Klaus Aehlig [Tue, 14 May 2013 09:34:03 +0000 (11:34 +0200)]
Make hroller also plan for non-redundant instances

Non-redundant instances need to be moved to a different node
before maintenance of the node. Even though they can be moved to
any node, there must be enough capacity to host the instances of the
reboot group to be evacuated.

This is achieved by greedily moving the non-redundant instances
to other nodes, till we run out of capacity. In this way we
refine the groups obtained by coloring the drbd-induced graph.

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

11 years agohroller: option to skip nodes with non-redundant instances
Klaus Aehlig [Thu, 16 May 2013 15:12:33 +0000 (17:12 +0200)]
hroller: option to skip nodes with non-redundant instances

So far, hroller ignores the fact, that non-redundant instances exist.
One option to deal is non-redundant instances is to not schedule those
nodes for reboot. This is supported by adding the option --skip-non-redundant.

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

11 years agoRemove trailing whitespace
Klaus Aehlig [Thu, 16 May 2013 10:48:55 +0000 (12:48 +0200)]
Remove trailing whitespace

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

11 years agoImprove installation documentation
Thomas Thrainer [Tue, 21 May 2013 09:53:06 +0000 (11:53 +0200)]
Improve installation documentation

Based on user feedback the installation documentation is clarified and
extended.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
(cherry picked from commit 3913eaa72b8a48706ca4caa59dd022fa1a05805a)

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

11 years agoImprove installation documentation
Thomas Thrainer [Tue, 21 May 2013 09:53:06 +0000 (11:53 +0200)]
Improve installation documentation

Based on user feedback the installation documentation is clarified and
extended.

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

11 years agoRPC 'node_info': <storage_type,key> instead of vg_names
Helga Velroyen [Mon, 6 May 2013 20:10:21 +0000 (22:10 +0200)]
RPC 'node_info': <storage_type,key> instead of vg_names

This replaces the field 'vg_names' in the RPC call of 'node info' by
'storage_units'. A storage unit is a tuple <storage_type,key>
and a generalization of a vg_name. The list of vg names is replaced by
a list of storage units. The modified RPC call will be used to report
storage space for more than just lvm volume groups. What the 'key' is
depends on the storage type. For storage type lvm-vg, the key is the
volume group name. To keep backward compatibility, all functions that
use the old vg_names, convert them to a list where every volume group
is mapped to a tuple [('lvm-vg',volume_group)] before making the call.

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

11 years agoAdd Harep man page
Michele Tartara [Fri, 17 May 2013 15:18:46 +0000 (15:18 +0000)]
Add Harep man page

Add the man page for the Ganeti auto-repair tool.

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

11 years agoStash Xen config file after a failed startup
Balazs Lecz [Thu, 16 May 2013 11:32:54 +0000 (12:32 +0100)]
Stash Xen config file after a failed startup

This is a fix for a minor bug.
Currently, a failed Xen VM start results in a stale config file left
behind on the filesystem.
This change introduces a new log directory, where the Xen VM config
file is moved after a failed startup.

Signed-off-by: Balazs Lecz <leczb@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoMerge branch 'stable-2.8' into master
Bernardo Dal Seno [Fri, 17 May 2013 13:18:13 +0000 (15:18 +0200)]
Merge branch 'stable-2.8' into master

* stable-2.8: (45 commits)
  Update NEWS with disk creation fixes
  Sort cmdlib-related entries in Makefile.am
  cmdlib: Cleanup public/private functions
  cmdlib: Extract instance query related functionality
  cmdlib: Extract instance operation functionality
  cmdlib: Extract migration related functionality
  cmdlib: Extract storage related functionality
  Reformat and define exports in cmdlib/__init__.py
  Extract miscellaneous logical units from cmdlib
  Extract os related logical units from cmdlib
  Extract query related logical units from cmdlib
  Extract backup related logical units from cmdlib
  Extract instance related logical units from cmdlib
  Extract node related logical units from cmdlib
  Extract group related logial units from cmdlib
  Extract cluster related logical units from cmdlib
  Extract test logical units from cmdlib
  Extract network related logical units from cmdlib
  Extract tags related logical units from cmdlib
  Extract base classes from cmdlib
  ...

Conflicts:
devel/build_chroot
lib/cmdlib.py

devel/build_chroot is straightforward: one side has added versions, the
other has added one library. lib/cmdlib.py has been split in many files in
stable-2.8, so I've semi-manually applied the changes from master.

This merge also fixes a problem with merge f2d87a5e5, which partially
reverted changes from 912737ba by mistake.

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

11 years agoFix owner of the OS log dir
Balazs Lecz [Fri, 17 May 2013 10:23:24 +0000 (11:23 +0100)]
Fix owner of the OS log dir

The OS log dir is used by noded, not masterd.

Signed-off-by: Balazs Lecz <leczb@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoMerge branch 'stable-2.7' into stable-2.8
Bernardo Dal Seno [Fri, 17 May 2013 11:12:01 +0000 (13:12 +0200)]
Merge branch 'stable-2.7' into stable-2.8

* stable-2.7:
  Update NEWS with disk creation fixes
  Don't fail to deactivate master IP if already down
  Add QA for recreating single instance disks
  Add QA for gnt-instance modify --disk
  Clean up when "gnt-instance modify" fails to create a disk
  recreate-disks honors the prealloc_wipe_disks flag
  Introduce wrapper for cmdlib._WipeDisks()
  Don't catch an exception that cannot be raised
  Wipe disks added through "gnt-instance modify"
  Support /var/run being a symlink in upload
  Final NEWS and configure.ac update for 2.7.0~rc1
  gnt-job list: deal with non-ascii encoding in jobs

Conflicts:
NEWS
lib/cmdlib.py
qa/ganeti-qa.py
qa/qa-sample.json

NEWS, qa/ganeti-qa.py and qa/qa-sample.py had trivial conflicts. But I've
updated QA changes to use the new interfaces. lib/cmdlib.py was renamed and
split, so I had to semi-manually apply the changes to the new files. I had
to change the names of some functions by removing or adding the initial
underscore and update the imported names.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoUpdate NEWS with disk creation fixes
Bernardo Dal Seno [Fri, 17 May 2013 00:40:21 +0000 (02:40 +0200)]
Update NEWS with disk creation fixes

Also document a couple more fixes.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoSort cmdlib-related entries in Makefile.am
Thomas Thrainer [Fri, 17 May 2013 09:21:30 +0000 (11:21 +0200)]
Sort cmdlib-related entries in Makefile.am

Files in the cmdlib directory are sorted alphabetically in
Makefile.am.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agocmdlib: Cleanup public/private functions
Thomas Thrainer [Tue, 14 May 2013 12:30:08 +0000 (14:30 +0200)]
cmdlib: Cleanup public/private functions

All functions/classes which are used outside of their defining module
(with tests as an exception) no longer have a leading underscore.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agocmdlib: Extract instance query related functionality
Thomas Thrainer [Tue, 14 May 2013 12:02:29 +0000 (14:02 +0200)]
cmdlib: Extract instance query related functionality

Split instance.py further by extracting instance querying related
logical units and functions to instance_query.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agocmdlib: Extract instance operation functionality
Thomas Thrainer [Tue, 14 May 2013 11:52:28 +0000 (13:52 +0200)]
cmdlib: Extract instance operation functionality

Split instance.py further by extracting instance operations
(start/stop/reboot/etc.) related logical units and functions to
instance_operation.py.

The extracted operations have in common that they affect the operating
system in a running instance directly.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agocmdlib: Extract migration related functionality
Thomas Thrainer [Tue, 14 May 2013 11:38:23 +0000 (13:38 +0200)]
cmdlib: Extract migration related functionality

Split instance.py further by extracting migration related logical units
and functions to instance_migration.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agocmdlib: Extract storage related functionality
Thomas Thrainer [Thu, 16 May 2013 07:13:48 +0000 (09:13 +0200)]
cmdlib: Extract storage related functionality

Split instance.py further by extracting storage related logical units
and functions to instance_storage.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoReformat and define exports in cmdlib/__init__.py
Thomas Thrainer [Thu, 16 May 2013 07:12:59 +0000 (09:12 +0200)]
Reformat and define exports in cmdlib/__init__.py

cmdlib/__init__.py now simply defines the interface of the cmdlib module
by importing all classes which should be visible to clients.

Also don't ignore C0302 (Too many lines in module) any more.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract miscellaneous logical units from cmdlib
Thomas Thrainer [Tue, 14 May 2013 08:24:50 +0000 (10:24 +0200)]
Extract miscellaneous logical units from cmdlib

All remaining classes in __init__.py are extracted to misc.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract os related logical units from cmdlib
Thomas Thrainer [Tue, 14 May 2013 08:17:04 +0000 (10:17 +0200)]
Extract os related logical units from cmdlib

All LUOs* classes are extracted to operating_system.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract query related logical units from cmdlib
Thomas Thrainer [Tue, 14 May 2013 08:07:29 +0000 (10:07 +0200)]
Extract query related logical units from cmdlib

All LUQuery* classes are extracted to query.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract backup related logical units from cmdlib
Thomas Thrainer [Tue, 14 May 2013 07:55:31 +0000 (09:55 +0200)]
Extract backup related logical units from cmdlib

All LUBackup* classes are extracted to backup.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract instance related logical units from cmdlib
Thomas Thrainer [Tue, 14 May 2013 07:19:16 +0000 (09:19 +0200)]
Extract instance related logical units from cmdlib

All LUInstance* classes are extracted to instance.py. Common functions
are moved to common.py if used by non-instance logical units as well.
Additionally, helper functions which are only used by LUBackup* and
LUInstance* are moved to instance_utils.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract node related logical units from cmdlib
Thomas Thrainer [Mon, 13 May 2013 13:16:27 +0000 (15:16 +0200)]
Extract node related logical units from cmdlib

All LUNode* classes are extracted to node.py. Common functions are moved
to common.py if used by non-node logical units as well.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract group related logial units from cmdlib
Thomas Thrainer [Mon, 13 May 2013 12:54:49 +0000 (14:54 +0200)]
Extract group related logial units from cmdlib

All LUGroup* classes are moved to group.py. Common functions are
extracted to common.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract cluster related logical units from cmdlib
Thomas Thrainer [Mon, 13 May 2013 11:49:33 +0000 (13:49 +0200)]
Extract cluster related logical units from cmdlib

All LUCluster* classes are extracted to cluster.py. Shared functions are
extracted to common.py, helper functions only used by LUCluster* are
extracted to cluster.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract test logical units from cmdlib
Thomas Thrainer [Mon, 13 May 2013 10:17:01 +0000 (12:17 +0200)]
Extract test logical units from cmdlib

LUTest* are moved to test.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract network related logical units from cmdlib
Thomas Thrainer [Mon, 13 May 2013 09:38:08 +0000 (11:38 +0200)]
Extract network related logical units from cmdlib

LUNetwork* and associated helper functions are extracted to network.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract tags related logical units from cmdlib
Thomas Thrainer [Mon, 13 May 2013 09:16:43 +0000 (11:16 +0200)]
Extract tags related logical units from cmdlib

LUTags* and their base class, TagsLU, are extracted to tags.py. An
additional shared function, _ShareAll, is extracted to common.py for
shared usage.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExtract base classes from cmdlib
Thomas Thrainer [Mon, 13 May 2013 08:48:48 +0000 (10:48 +0200)]
Extract base classes from cmdlib

Base classes holding common functionality is extracted into base.py.
Utility functions used by both base classes and subclasses is moved to
common.py.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoDon't fail to deactivate master IP if already down
Thomas Thrainer [Tue, 14 May 2013 14:21:25 +0000 (16:21 +0200)]
Don't fail to deactivate master IP if already down

The master IP setup script now checks if the master IP is actually
configured on the machine before trying to remove the IP.

This fixes issue 460.

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

11 years agoCompatibility test for instances
Helga Velroyen [Wed, 15 May 2013 10:46:24 +0000 (12:46 +0200)]
Compatibility test for instances

This patch introduces a test to check the compatibility
of the Haskell and the Python representation of instances.

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

11 years agoInstance generators
Helga Velroyen [Wed, 15 May 2013 11:46:46 +0000 (13:46 +0200)]
Instance generators

This patch introduces and enhances generators for
instances:
- 'genInstWithNets' is split into the generation of an
  arbitrary instance and enhancing an instance with nets
- 'genInst' calls 'genInstWithNets' with an empty set
  of initial networks to provide a reasonable default
- the Arbitrary instance of 'Instance' uses now 'genDisks'
  to create instances with a reasonable set of disks

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

11 years agoAnnotate every arbitrary instance field
Helga Velroyen [Wed, 15 May 2013 13:01:28 +0000 (15:01 +0200)]
Annotate every arbitrary instance field

The Arbitrary instance of the 'Instance' object is written
using the <*> syntax. Since it often uses the 'arbitrary'
generator for the instance's fields it is hard to figure
out which 'arbitrary' fills which instance field. This
patch annotates all fields with their name to make
maintenance of this code easier.

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

11 years agoGenerators for disks
Helga Velroyen [Wed, 15 May 2013 12:52:47 +0000 (14:52 +0200)]
Generators for disks

This patch adds generators for Disk instances to the Haskell
test code. It uses somewhat more reasonable generators to
fill the fields instead of just arbitrary values.
'genDiskWithChildren' is a generator that generates a disk
with a specified number of disk children. To avoid shooting
ourselves in the foot we do not generate further (grand)
child disks for the child disks. 'genDisk' calls
'genDiskWithChildren' by requesting three children as a
resonable default.

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

11 years agoUse os.statvfs to determine free disk space
Helga Velroyen [Wed, 15 May 2013 09:45:40 +0000 (11:45 +0200)]
Use os.statvfs to determine free disk space

This simplifies my previous commit (820bade90) by using os.statvfs
instead of parsing the output of 'df'.

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

11 years agoReorder unit tests in Makefile.am
Helga Velroyen [Tue, 14 May 2013 15:59:12 +0000 (17:59 +0200)]
Reorder unit tests in Makefile.am

In a previous commit, I accidentially changed the order of
unit tests in Makefile.am to not be alphabetically anymore.
This fixes it.

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

11 years agoBackend function for file storage space reporting
Helga Velroyen [Tue, 14 May 2013 13:23:32 +0000 (15:23 +0200)]
Backend function for file storage space reporting

This adds functionality to retrieve disk space information
for file storage. It calls the 'df' tool and parses its
output to extract the total and free amount of disk space
on the disk where the given path is located.
The code is not integrated yet, but thoroughly unit-tested.

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

11 years agoRemove extra newline
Michele Tartara [Tue, 14 May 2013 17:26:07 +0000 (18:26 +0100)]
Remove extra newline

Also, properly set the date of the last modification.

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

11 years agoMake HS ConfD client IPv6 compatible
Michele Tartara [Tue, 14 May 2013 11:04:33 +0000 (12:04 +0100)]
Make HS ConfD client IPv6 compatible

The Haskell ConfD client was assuming internet addresses to be IPv4. This
patch modifies the client so that it is able to automatically detect the
protocol it should use by analyzing the address it is told to connect to.

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

11 years agoFactor out resolveAddr function
Michele Tartara [Tue, 14 May 2013 15:52:06 +0000 (16:52 +0100)]
Factor out resolveAddr function

This function can be useful to many parts of the code to convert the string
representation of an IP (v4 or v6) address into the proper data type.

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

11 years agoAdd MonD to the watcher
Michele Tartara [Mon, 13 May 2013 14:05:08 +0000 (14:05 +0000)]
Add MonD to the watcher

The monitoring daemon should always be alive, therefore it's added to the
watcher.

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

11 years agoStart the monitoring and node daemons together
Michele Tartara [Mon, 13 May 2013 14:00:17 +0000 (14:00 +0000)]
Start the monitoring and node daemons together

Add the monitoring daemon to the command starting the node daemon, given that
they both have to be started on all nodes.

Note that daemon-util only supports starting one daemon at the time, so the
actual command has to be composed as a sequence of two different daemon-util
invocations.

Also, the monitoring daemon invocation is conditional, depending on whether it
was enabled at configure time.

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

11 years agoAdd a constant stating whether monitoring is enabled
Michele Tartara [Mon, 13 May 2013 13:57:46 +0000 (13:57 +0000)]
Add a constant stating whether monitoring is enabled

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

11 years agoAdd QA for recreating single instance disks
Bernardo Dal Seno [Fri, 10 May 2013 23:37:45 +0000 (01:37 +0200)]
Add QA for recreating single instance disks

So far QA only recreated the whole set of disks at once.

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

11 years agoAdd QA for gnt-instance modify --disk
Bernardo Dal Seno [Fri, 10 May 2013 23:23:08 +0000 (01:23 +0200)]
Add QA for gnt-instance modify --disk

Just a very basic test that adds and then removes a disk.

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

11 years agoClean up when "gnt-instance modify" fails to create a disk
Bernardo Dal Seno [Fri, 10 May 2013 14:27:20 +0000 (16:27 +0200)]
Clean up when "gnt-instance modify" fails to create a disk

cmdlib.LUInstanceSetParams now uses helper functions to create and wipe
disks, so that when the creation of a disk fails, any leftover device is
cleaned up. As a bonus, exceptions raised by _CreateBlockDev() are caught
correctly.

Now cmdlib._CreateDisks() is used every time there are disks to create.

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

11 years agorecreate-disks honors the prealloc_wipe_disks flag
Bernardo Dal Seno [Fri, 10 May 2013 13:05:56 +0000 (15:05 +0200)]
recreate-disks honors the prealloc_wipe_disks flag

Now even recreate-disks wipes the newly-created disks, if the flag is set.

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

11 years agoIntroduce wrapper for cmdlib._WipeDisks()
Bernardo Dal Seno [Fri, 10 May 2013 13:44:01 +0000 (15:44 +0200)]
Introduce wrapper for cmdlib._WipeDisks()

The wrapper handles errors by logging them and cleaning up freshly-created
disks.

Also, the correct disk is used in the error message when an error happens
in cmdlib._CreateDisks() and the resulting disk clean-up fails.

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

11 years agoDon't catch an exception that cannot be raised
Bernardo Dal Seno [Thu, 9 May 2013 17:07:34 +0000 (19:07 +0200)]
Don't catch an exception that cannot be raised

Since 9b221ea4, _CreateBlockDev() doesn't raise OpExecError any more. Yet
some code was left in place to catch it. By removing that code we have two
advantages:
1. Dead code is removed.
2. If for whatever reason _CreateBlockDev() raises OpExecError, the
   exception is not silently dropped and we notice (so we can fix it).

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

11 years agoWipe disks added through "gnt-instance modify"
Michael Hanselmann [Mon, 25 Feb 2013 15:27:27 +0000 (16:27 +0100)]
Wipe disks added through "gnt-instance modify"

In issue 353 Sascha Lucas reported that disks are not wiped when added
through “gnt-instance modify”. This patch adds this functionality and
updates the docstring for “_WipeDisks”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
(cherry picked from commit 965e0e6a88e09f96d4c9b6030ab8753366c84a78)

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

11 years agoMove 'container.py' to storage directory
Helga Velroyen [Tue, 14 May 2013 12:31:04 +0000 (14:31 +0200)]
Move 'container.py' to storage directory

Moving 'container.py' to the storage directory.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoRename dir 'block' to 'storage'
Helga Velroyen [Tue, 14 May 2013 11:33:28 +0000 (13:33 +0200)]
Rename dir 'block' to 'storage'

Renaming the 'block' directory to 'storage', because I plan to
place code there that is related to file storage and leaving
it named 'block' would be misleading.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoRename storage.py to container.py
Helga Velroyen [Tue, 14 May 2013 11:04:53 +0000 (13:04 +0200)]
Rename storage.py to container.py

Renaming 'storage.py' to 'container.py'. It will be moved into the new
'storage' directory, which will come in later patches to avoid clashes of
notation.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

11 years agoMonitoring QA: Remove superfluous import
Michele Tartara [Tue, 14 May 2013 13:07:18 +0000 (14:07 +0100)]
Monitoring QA: Remove superfluous import

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

11 years agoNon-Xen support for monitoring QA
Michele Tartara [Mon, 13 May 2013 18:10:11 +0000 (19:10 +0100)]
Non-Xen support for monitoring QA

The QA tests the Xen instance status collector, but that is expected to fail
when run on machines that do not use Xen.

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

11 years agoAdd QA for instance status collector
Michele Tartara [Fri, 10 May 2013 10:07:07 +0000 (10:07 +0000)]
Add QA for instance status collector

This commit introduces the QA for the instance status collector.

Begin the first QA for a monitoring-related component, the files and some
functions are named after monitoring because they are meant to contain
future monitoring QAs as well.

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

11 years agoQA: factor out some instance management functions
Michele Tartara [Fri, 10 May 2013 09:10:32 +0000 (09:10 +0000)]
QA: factor out some instance management functions

Some functions for managing instances will have to be used by new upcoming
unit tests, so they are taken out of the instances QA file and put in a new
utilities file accessible by other QA files as well.

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

11 years agoAdd inst-status-xen to the monitoring daemon
Michele Tartara [Wed, 8 May 2013 13:00:21 +0000 (15:00 +0200)]
Add inst-status-xen to the monitoring daemon

Enable the monitoring daemon to invoke the Xen instance status data collector.
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

11 years agoRun the monitoring daemon as root
Michele Tartara [Wed, 8 May 2013 12:51:33 +0000 (14:51 +0200)]
Run the monitoring daemon as root

The monitoring daemon needs to be able to run some commands that require root
access (such as "xm") in order to fulfill its duties.

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

11 years agoExport the Instance Status collector report
Michele Tartara [Tue, 7 May 2013 16:37:05 +0000 (16:37 +0000)]
Export the Instance Status collector report

It will need to be accessed by the monitoring daemon.

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

11 years agoAdd instance status collector to mon-collector man page
Michele Tartara [Mon, 28 Jan 2013 13:36:53 +0000 (14:36 +0100)]
Add instance status collector to mon-collector man page

Add a section related to the new collector.

Also, fix some formatting issue (white spaces, line longer than 80 chars)
in the DRBD collector section.

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

11 years agoAdd global status field to the instance status collector
Michele Tartara [Tue, 30 Apr 2013 12:17:54 +0000 (12:17 +0000)]
Add global status field to the instance status collector

The global status is computed from the statuses of the single instances.

The output json format is adapted to include this piece of information, as
prescribed by the design document.

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

11 years agoFactor out the mergeStatuses function
Michele Tartara [Tue, 30 Apr 2013 12:14:30 +0000 (12:14 +0000)]
Factor out the mergeStatuses function

It will be used by multiple data collectors, not only the DRBD collector.

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

11 years agoMonitoring design doc: better specify field names
Michele Tartara [Tue, 30 Apr 2013 12:23:48 +0000 (12:23 +0000)]
Monitoring design doc: better specify field names

The name of the list of instances was not specified.

Also, fix a line that was longer than 80 characters.

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

11 years agoUse dcName in mon-collector
Michele Tartara [Tue, 30 Apr 2013 11:11:49 +0000 (11:11 +0000)]
Use dcName in mon-collector

Instead of manually specify the name of the data collectors in mon-collector,
just use the dcName field each of them exports.

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