ganeti-local
11 years agoAbstract code related to job ID creation
Iustin Pop [Mon, 10 Dec 2012 18:35:09 +0000 (19:35 +0100)]
Abstract code related to job ID creation

Having makeJobIdS as a separate function will allow us to use it
outside of json encoding.

The patch also exports one more function from the Types module.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAdd new Haskell library dependency for tests
Iustin Pop [Tue, 11 Dec 2012 00:11:39 +0000 (01:11 +0100)]
Add new Haskell library dependency for tests

The 'temporary' library add support for create temporary
directories/files beyond what is offered in the base library (which is
somewhat limited, and hard to use in tests).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoReduce logging level in tests
Iustin Pop [Mon, 10 Dec 2012 18:32:27 +0000 (19:32 +0100)]
Reduce logging level in tests

This allows tests to execute IO actions which have logging as a side
effect, without polluting the stderr too much.

A better solution would be that we have fine-grained control over
loggers, so that tests can run with their own logging, etc. etc..

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoExport jstore constants as well to Constants.hs
Iustin Pop [Mon, 10 Dec 2012 16:25:30 +0000 (17:25 +0100)]
Export jstore constants as well to Constants.hs

This single constant could be as well moved to constants.py. For now I
choose to just export the module as well.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoGeneralise the test helper 'genUniquesList'
Iustin Pop [Mon, 10 Dec 2012 16:23:54 +0000 (17:23 +0100)]
Generalise the test helper 'genUniquesList'

Instead of always using "arbitrary", make it require a generator (that
can then use more complex rules for building the list elements), and
also convert it to use a temporary set instead of list membership.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoExport more paths from Path.hs
Iustin Pop [Mon, 10 Dec 2012 10:06:21 +0000 (11:06 +0100)]
Export more paths from Path.hs

Also adds a small helper for building the paths.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoSimplify a bit the FilterRegex JSON instance
Iustin Pop [Mon, 10 Dec 2012 08:46:43 +0000 (09:46 +0100)]
Simplify a bit the FilterRegex JSON instance

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoImplement opcode summary support
Iustin Pop [Mon, 10 Dec 2012 08:32:13 +0000 (09:32 +0100)]
Implement opcode summary support

This implements in the Haskell codebase the opcode summary. As opposed
to Python, we always use custom code for formatting, since we don't
want to use dynamic attribute lookup.

To test this properly, we need to change MetaOpCode to record-syntax,
so that we get accessor functions.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd optional formatting for OP_DSC_FIELD
Iustin Pop [Mon, 10 Dec 2012 08:27:07 +0000 (09:27 +0100)]
Add optional formatting for OP_DSC_FIELD

For some opcodes, the output is not "stable", and depends on the exact
input values; this makes it harder to check consistency against
Haskell code.

To compensate for this, we add a way to override the formatting of the
OP_DSC_FIELD; by default, this is always "%s", but if the
OP_DSC_FORMATTER is defined (must be a callable), it is used to format
the actual value.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd a type for the log type in job/opcode logs
Iustin Pop [Thu, 6 Dec 2012 15:13:18 +0000 (16:13 +0100)]
Add a type for the log type in job/opcode logs

Also fixes indentation for OP_STATUS.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoFix small typo in OpTestDelay/duration definition
Iustin Pop [Thu, 6 Dec 2012 14:23:35 +0000 (15:23 +0100)]
Fix small typo in OpTestDelay/duration definition

The extra space results in inaccessible names; currently GHC doesn't
flag this as an error, but I've filled an upstream bug for that
(http://hackage.haskell.org/trac/ghc/ticket/7484).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoAdd constants for two values which we re-evaluate
Iustin Pop [Fri, 14 Dec 2012 00:31:53 +0000 (01:31 +0100)]
Add constants for two values which we re-evaluate

Two constants which we use as Integer are defined as Int in
Constants.hs (coming from constants.py), so we do the conversion every
time we use it. Let's move them to top-level names, so that the
conversion is only done once.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoFix an small but quite nasty typo
Iustin Pop [Thu, 13 Dec 2012 21:33:47 +0000 (22:33 +0100)]
Fix an small but quite nasty typo

Introduced in commit d4752785.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoupdate gnt-instance manpage about self-rename
Guido Trotter [Mon, 13 Dec 2010 11:57:25 +0000 (11:57 +0000)]
update gnt-instance manpage about self-rename

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoburnin: rename instances to same name
Guido Trotter [Mon, 13 Dec 2010 11:53:39 +0000 (11:53 +0000)]
burnin: rename instances to same name

this (a) allows us to test renaming in burnin even if we don't have an
extra instance name and (b) is a valid operation, as it allows to "fix"
an instance who went name-astray

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoVery very very basic openvswitch support
Guido Trotter [Wed, 20 Jun 2012 14:03:37 +0000 (15:03 +0100)]
Very very very basic openvswitch support

This is a "better than nothing" support, just for kvm and just joining
the machine to the opevswitch bridge with the right command.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agoImprove a few Graph test properties
Guido Trotter [Wed, 12 Dec 2012 14:29:50 +0000 (06:29 -0800)]
Improve a few Graph test properties

Return type is changed from Property to Bool, and the ==? True at the
end is dropped.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoremove duplicate code in Graph.hs
Guido Trotter [Wed, 12 Dec 2012 14:27:19 +0000 (06:27 -0800)]
remove duplicate code in Graph.hs

Also update the docstring of a function.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoAdd profiling dependencies note
Guido Trotter [Wed, 12 Dec 2012 12:43:17 +0000 (04:43 -0800)]
Add profiling dependencies note

As discussed on the list, these are needed to do a make hs-prof.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoLog only partial response in Luxi when in debug mode
Iustin Pop [Thu, 13 Dec 2012 17:05:26 +0000 (18:05 +0100)]
Log only partial response in Luxi when in debug mode

Currently, we log the entire response (at debug level) in the Luxi
replies. This is not a good idea; the logging library operates on
strings, and as such it will use huge amounts of memory: without debug
logging, a certain gnt-job list invocation uses 295MB (+RTS -s) and
2m35s time, when in debug mode, it's 1525MB and 48m!

So we make two changes:

- first, we switch from "show (pp_value a)" to "encode a", which
  generates a non-formatted string rather than a indented one
- second we log only the first 2000 characters; this should be enough
  to understand the first part of the response

We could go for higher, or for logging in batches (that would be
faster, as well).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoPass check_ip and not hostname.ip to _ComputeNics
Constantinos Venetsanopoulos [Thu, 13 Dec 2012 16:06:05 +0000 (18:06 +0200)]
Pass check_ip and not hostname.ip to _ComputeNics

This should be done because in the case of --no-name-check there
is no 'hostname.ip' attribute, causing an execution error.
'check_ip' is always set (in CheckArguments) even if --no-name-check
is passed in the command line.

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoAdd version check for doc/design-draft.rst
Michael Hanselmann [Thu, 13 Dec 2012 15:03:30 +0000 (16:03 +0100)]
Add version check for doc/design-draft.rst

This is similar to README or “doc/security.rst”. Having a comment that
needs updating for a new version is more likely going to trigger a check
of the lists of design drafts.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMakefile/check-local: List all errors before failing
Michael Hanselmann [Thu, 13 Dec 2012 15:03:25 +0000 (16:03 +0100)]
Makefile/check-local: List all errors before failing

Use the “error” variable in multiple places and fail only once all tests
have been completed.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMove four designs from draft to 2.7
Michael Hanselmann [Thu, 13 Dec 2012 14:49:51 +0000 (15:49 +0100)]
Move four designs from draft to 2.7

These are the ones I implemented and for which I'm certain they're
complete.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoRAPI documentation fix and update
Michael Hanselmann [Thu, 13 Dec 2012 14:20:34 +0000 (15:20 +0100)]
RAPI documentation fix and update

- Mention user capabilities in security.rst
- Replace “query” with “read” in RAPI documentation

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoAdd hpc-mon-collector to .gitignore
Michele Tartara [Thu, 13 Dec 2012 11:48:55 +0000 (12:48 +0100)]
Add hpc-mon-collector to .gitignore

It is a binary file and it should never be added to the git repository.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoRead watcher pause using RPC, not directly
Michael Hanselmann [Tue, 11 Dec 2012 17:00:25 +0000 (18:00 +0100)]
Read watcher pause using RPC, not directly

The master daemon should not directly read files written by the node
daemon. This patch adds a new RPC to read the watcher pause file and
changes the master code to use it.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoSet watcher pause on all nodes
Michael Hanselmann [Tue, 11 Dec 2012 15:48:03 +0000 (16:48 +0100)]
Set watcher pause on all nodes

Instead of just setting the watcher pause file, which isn't replicated,
RPC is used to set it on all nodes (where possible). This means that
after an outage of the master node and a following master-failover, the
watcher will still be paused.

The RPC is attempted on all nodes. Errors for nodes marked offline are
ignored. All other errors are returned in the form of an exception
(there is no other option given the LUXI API).

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd RPC for setting watcher pause
Michael Hanselmann [Tue, 11 Dec 2012 16:17:20 +0000 (17:17 +0100)]
Add RPC for setting watcher pause

The watcher pause file should be set/unset on all nodes at once, not
only the master node. For that a new RPC is needed.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoGenerated RPC code: Don't write whitespace after paren
Michael Hanselmann [Tue, 11 Dec 2012 16:03:38 +0000 (17:03 +0100)]
Generated RPC code: Don't write whitespace after paren

There is no obvious need for this space--the line would wrap at the next
space, which comes soon after.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoRename test for backend._CommonRestrictedCmdCheck
Michael Hanselmann [Tue, 11 Dec 2012 16:09:44 +0000 (17:09 +0100)]
Rename test for backend._CommonRestrictedCmdCheck

“TestWriteFile” was not renamed when adding the file based on
“ganeti.utils.io_unittest-runasroot.py”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agojqueue: Improve inotify error reporting
Michael Hanselmann [Mon, 10 Dec 2012 13:32:13 +0000 (14:32 +0100)]
jqueue: Improve inotify error reporting

This addresses issue 218. When the number of inotify watches is
exhausted, for example by being set too low from the beginning or by
other programs, waiting for a job to change would just report a lost job
(e.g. “Error checking job status: Job with id 7817 lost”).

This patch changes the job watcher to no longer catch
“errors.InotifyError” and, this is by far the larger part of this patch,
adds unittests for this situation.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoImprove test for tools.ensure_dirs
Michael Hanselmann [Tue, 11 Dec 2012 14:52:56 +0000 (15:52 +0100)]
Improve test for tools.ensure_dirs

- Add more checks, some of them are deliberately redundant
- Descriptive error messages
- Add comment describing order to “tools.ensure_dirs”
- Avoid copying a list in an assertion in “tools.ensure_dirs”

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoJobs.hs: make L.Client the last argument for all functions
Dato Simó [Wed, 12 Dec 2012 15:32:46 +0000 (15:32 +0000)]
Jobs.hs: make L.Client the last argument for all functions

Having the Luxi client be the last argument of the functions allows for
easier use with `Exception.bracket L.getClient L.closeClient ...`.

Signed-off-by: Dato Simó <dato@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoFix a bug in the hs-coverage rule of Makefile.am
Michele Tartara [Wed, 12 Dec 2012 13:46:27 +0000 (14:46 +0100)]
Fix a bug in the hs-coverage rule of Makefile.am

The coverage information for mon-collector was not merged correctly.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agouidpool: Remove roman number support
Michael Hanselmann [Wed, 12 Dec 2012 10:00:23 +0000 (11:00 +0100)]
uidpool: Remove roman number support

Doing so simplifies to code a bit and never had a practical use.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoRemove checks wrt IDISK_PARAMS from OpCode level
Constantinos Venetsanopoulos [Tue, 4 Dec 2012 11:50:16 +0000 (13:50 +0200)]
Remove checks wrt IDISK_PARAMS from OpCode level

Change the "--disks" option validation, to just check the format
of the dict and do not check whether the keys are included in the
IDISK_PARAMS constant at OpCode level. This allows the passing of
arbitrary parameters at the CLI, which will then be logically
checked at LU level (inside CheckArguments).

Currently, the check wrt to IDISK_PARAMS already happens in all
related LUs (InstanceSetParams, InstanceCreate, InstanceRecreateDisks),
with the use of ForceDictType(), so there is no need for additional
checking code.

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>
Signed-off-by: Iustin Pop <iustin@google.com>
[iustin@google.com: fixed a unittest that needed adjustement]
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoAdd shelltests for the mon-collector
Michele Tartara [Wed, 5 Dec 2012 09:20:18 +0000 (10:20 +0100)]
Add shelltests for the mon-collector

This commit adds shelltests for the mon-collector binary and for the DRBD
data collector.

Also, it fixes a small bug in the DRBD parser found thanks to the tests.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoAdd the stand-alone data collector for DRBD
Michele Tartara [Tue, 27 Nov 2012 09:16:45 +0000 (10:16 +0100)]
Add the stand-alone data collector for DRBD

It is implemented as a single binary receiving, as its first parameter,
the name of the actual data collector to be run.
This way, its structure can be used for all the future data collectors.

Also, factored out of bdev.py into constants.py the location of the DRBD
status file.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMove the path of the DRBD status file to the Constants file
Michele Tartara [Wed, 12 Dec 2012 08:45:29 +0000 (09:45 +0100)]
Move the path of the DRBD status file to the Constants file

It will be needed by the DRBD data collector, that will be added shortly.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMake configure check for haskell vector library
Helga Velroyen [Wed, 12 Dec 2012 09:02:42 +0000 (10:02 +0100)]
Make configure check for haskell vector library

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

11 years agoRemove usage of reserved key word 'family'
Helga Velroyen [Wed, 12 Dec 2012 08:38:39 +0000 (09:38 +0100)]
Remove usage of reserved key word 'family'

An old hlint version (1.8.28) was complaining about the
word 'family' being used in the network tests. Thanks to
an epiphany of Iustin this was due to that it is a reserved
key word.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoAdd documentation about new dependency to vector lib
Helga Velroyen [Tue, 11 Dec 2012 17:37:36 +0000 (18:37 +0100)]
Add documentation about new dependency to vector lib

Updates the INSTALL file to add the haskell library
libghc-vector-dev.

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

11 years agoNetwork and address pool (again)
Helga Velroyen [Mon, 10 Dec 2012 10:36:27 +0000 (11:36 +0100)]
Network and address pool (again)

Implementation of the network objects and address pool. Functionality
as in the reverted commit b9a616e132af9bba718d2da8c94eeec7af886814, but
now using only the vector library and not the bit-vector library.
Tested with vector library version 0.9 and 0.10., which are
also installed on the buildbot machines now.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoFix ordering of entries in tools.ensure_dirs
Michael Hanselmann [Tue, 11 Dec 2012 14:50:45 +0000 (15:50 +0100)]
Fix ordering of entries in tools.ensure_dirs

Commit ebd437a added two new entries to tools.ensure_dirs, but did so in
the wrong order. Patch forthcoming to improve the unittest's error
message.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoSet owner on watcher pause and queue drain files
Michael Hanselmann [Tue, 11 Dec 2012 13:29:45 +0000 (14:29 +0100)]
Set owner on watcher pause and queue drain files

If the files were created by a user different, e.g. due to a switch from
running masterd as root to running it as a dedicated user, they couldn't
be modified/removed anymore.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agolib/tools/ensure_dirs.py: Code formatting
Michael Hanselmann [Tue, 11 Dec 2012 13:23:22 +0000 (14:23 +0100)]
lib/tools/ensure_dirs.py: Code formatting

Wrap lines in a consistent manner (uid/gid on the second line) if
wrapping is necessary at all. “git diff --color-words” shows no
difference at all as only whitespace changed.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoReplicate queue drain flag across all master candidates
Michael Hanselmann [Tue, 11 Dec 2012 12:56:35 +0000 (13:56 +0100)]
Replicate queue drain flag across all master candidates

Until now, the flag was unset on a master failover unless the
“$localstatedir/lib/ganeti/queue/drain” file existed.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd utility function to create frozenset with unique values
Michael Hanselmann [Mon, 10 Dec 2012 15:52:57 +0000 (16:52 +0100)]
Add utility function to create frozenset with unique values

When used instead of a plain call to “frozenset”, this would have
avoided the issue fixed in commit e2dd6ec. The new function is located
in the “compat” module as it will be used at module load time in most
places and should therefore reside in a place with very few
dependencies.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoconstants: Remove duplicate DRBD barrier option
Michael Hanselmann [Mon, 10 Dec 2012 17:30:51 +0000 (18:30 +0100)]
constants: Remove duplicate DRBD barrier option

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agodoc/rapi.rst: Add ECODE_TEMP_NORES
Michael Hanselmann [Mon, 10 Dec 2012 16:42:43 +0000 (17:42 +0100)]
doc/rapi.rst: Add ECODE_TEMP_NORES

The assertion was failing as ECODE_TEMP_NORES was not documented.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoChange value for ECODE_TEMP_NORES
Michael Hanselmann [Mon, 10 Dec 2012 15:41:42 +0000 (16:41 +0100)]
Change value for ECODE_TEMP_NORES

Unfortunately there was a bug in commit 518a45e whereby ECODE_TEMP_NORES
had the same value as ECODE_NORES, leading to failures in a Haskell
test. Of course this would also have affected other users of the constant.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMake htools/Ganeti/Constants.hs depend on errors.py
Michael Hanselmann [Mon, 10 Dec 2012 15:40:38 +0000 (16:40 +0100)]
Make htools/Ganeti/Constants.hs depend on errors.py

It also uses values from “lib/errors.py”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agomasterd: Remove duplicate code
Michael Hanselmann [Mon, 10 Dec 2012 14:30:32 +0000 (15:30 +0100)]
masterd: Remove duplicate code

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoImprove error message for when adding inotify watcher fails
Michael Hanselmann [Mon, 10 Dec 2012 13:34:15 +0000 (14:34 +0100)]
Improve error message for when adding inotify watcher fails

Explicitely mention the fs.inotify.max_user_watches sysctl value.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agohtools/Ganeti/Errors: Add ECodeTempNoRes
Michael Hanselmann [Mon, 10 Dec 2012 14:14:24 +0000 (15:14 +0100)]
htools/Ganeti/Errors: Add ECodeTempNoRes

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoUpdate pyinotify website
Michael Hanselmann [Mon, 10 Dec 2012 12:09:33 +0000 (13:09 +0100)]
Update pyinotify website

It has moved to github.com.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agohtest/Types.hs: check ordering of some ADTs
Dato Simó [Thu, 6 Dec 2012 18:43:25 +0000 (18:43 +0000)]
htest/Types.hs: check ordering of some ADTs

In some ADT, ordering of constructors is important because a certain
meaning is attached to ordinality (e.g., "clusters with lesser AllocPolicy
are preferred").

To ensure constructor order is not accidentally changed, this commit
introduces assertions that verify the ordering of these types is as
expected.

Signed-off-by: Dato Simó <dato@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agohtools: Add missing parameter to OpInstanceMultiAlloc
Michael Hanselmann [Fri, 7 Dec 2012 13:17:44 +0000 (14:17 +0100)]
htools: Add missing parameter to OpInstanceMultiAlloc

Somehow this went missing in commit 1f1188c.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoExport error codes from RAPI client module
Michael Hanselmann [Tue, 4 Dec 2012 16:57:13 +0000 (17:57 +0100)]
Export error codes from RAPI client module

Until now the error codes were not available from the RAPI client
module. A newly added unit test ensures all error codes are contained in
“ECODE_ALL”, as well as ensuring consistency between the RAPI client and
the authoritative “errors” module.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd error code for temporary lack of resources
Michael Hanselmann [Tue, 4 Dec 2012 15:17:05 +0000 (16:17 +0100)]
Add error code for temporary lack of resources

When an instance creation uses opportunistic locks, the iallocator might
not be able to find an allocation solution if not enough node locks (or
a suboptimal subset thereof) were acquired. As per the design document
<doc/design-opportunistic-locking.rst> a new error code denoting
temporary failures is added.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agocmdlib: Use locked nodes as node whitelist
Michael Hanselmann [Tue, 4 Dec 2012 14:53:55 +0000 (15:53 +0100)]
cmdlib: Use locked nodes as node whitelist

Also actually start using opportunistic locks (if requested).

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agocmdlib: Opportunistic locking on instance creation
Michael Hanselmann [Fri, 7 Dec 2012 12:29:49 +0000 (13:29 +0100)]
cmdlib: Opportunistic locking on instance creation

Adds a new parameter to “OpInstanceCreate” and “OpInstanceMultiAlloc” to
use opportunistic locks.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agocmdlib: Node whitelist support for allocation request
Michael Hanselmann [Tue, 27 Nov 2012 06:33:26 +0000 (07:33 +0100)]
cmdlib: Node whitelist support for allocation request

Forward the node whitelist to the iallocator plugin.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agomcpu: Verify node allocation lock mode
Michael Hanselmann [Mon, 26 Nov 2012 06:02:35 +0000 (07:02 +0100)]
mcpu: Verify node allocation lock mode

Add verification code to mcpu to check an LU's locks. Two whitelists are
provided to exclude LUs from the two tests.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years ago_ExportQuery: Use node allocation lock
Michael Hanselmann [Mon, 26 Nov 2012 09:09:26 +0000 (10:09 +0100)]
_ExportQuery: Use node allocation lock

Block instance allocations when all node locks will be acquired.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoLUBackupExport: Use node allocation lock
Michael Hanselmann [Mon, 26 Nov 2012 09:09:38 +0000 (10:09 +0100)]
LUBackupExport: Use node allocation lock

Block instance allocations when all node locks will be acquired.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoLUBackupRemove: Use node allocation lock
Michael Hanselmann [Fri, 23 Nov 2012 03:44:58 +0000 (04:44 +0100)]
LUBackupRemove: Use node allocation lock

Block instance allocations when all node locks will be acquired.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoLUInstanceMultiAlloc: Use node allocation lock
Michael Hanselmann [Fri, 23 Nov 2012 03:43:48 +0000 (04:43 +0100)]
LUInstanceMultiAlloc: Use node allocation lock

Avoid conflicts between instance allocations.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoLUInstanceRecreateDisks: Use node allocation lock
Michael Hanselmann [Fri, 23 Nov 2012 03:43:08 +0000 (04:43 +0100)]
LUInstanceRecreateDisks: Use node allocation lock

Block instance allocations when all node locks will be acquired.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoLUNodeSetParams: Use node allocation lock
Michael Hanselmann [Fri, 23 Nov 2012 03:42:27 +0000 (04:42 +0100)]
LUNodeSetParams: Use node allocation lock

Block instance allocations when all node locks will be acquired.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoLUNodeQueryvols: Use node allocation lock
Michael Hanselmann [Fri, 23 Nov 2012 03:41:52 +0000 (04:41 +0100)]
LUNodeQueryvols: Use node allocation lock

Block instance allocations when all node locks will be acquired.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoLUOobCommand: Use node allocation lock
Michael Hanselmann [Fri, 23 Nov 2012 03:41:34 +0000 (04:41 +0100)]
LUOobCommand: Use node allocation lock

If no node names are given, all node locks are acquired.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoFix typo in comment
Michele Tartara [Thu, 6 Dec 2012 16:45:40 +0000 (17:45 +0100)]
Fix typo in comment

There was a typo in the docstring of the parseMessage function of the
confd server.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoRevert "Network and address pool"
Helga Velroyen [Thu, 6 Dec 2012 18:35:44 +0000 (19:35 +0100)]
Revert "Network and address pool"

This reverts commit b9a616e132af9bba718d2da8c94eeec7af886814, which
depends on the "bitvec" library. We need to investigate a bit further that
dependency, as it in turns depends on "vector" 0.9.1 or *below*, since
0.10.* removed support for Data.Vector.Unboxed.Safe which it uses.

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

11 years agoNetwork and address pool
Helga Velroyen [Tue, 27 Nov 2012 09:34:02 +0000 (10:34 +0100)]
Network and address pool

Implementation of the network and address pool class in
Haskell. Not complete yet. Includes unit tests that cover
all functionality that is so far implemented.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoFix node-daemon-setup test with older pyOpenSSL
Michael Hanselmann [Thu, 6 Dec 2012 15:43:53 +0000 (16:43 +0100)]
Fix node-daemon-setup test with older pyOpenSSL

Older versions use “-----BEGIN RSA PRIVATE KEY-----” instead of
“-----BEGIN PRIVATE KEY-----”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd tool to clean up node
Michael Hanselmann [Wed, 5 Dec 2012 15:02:11 +0000 (16:02 +0100)]
Add tool to clean up node

Sometimes a node is not removed properly from a cluster (especially
during development). This new tool stops all daemons and removes (after
making copies) the most critical files.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoSwitch from scp/ssh to node daemon setup utility
Michael Hanselmann [Fri, 30 Nov 2012 10:34:39 +0000 (11:34 +0100)]
Switch from scp/ssh to node daemon setup utility

This patch does away with many calls to scp and by means of using
“tools/node-daemon-setup”, verifies most of the values before writing
them to files.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd tool to configure node daemon
Michael Hanselmann [Tue, 27 Nov 2012 10:43:57 +0000 (11:43 +0100)]
Add tool to configure node daemon

The design for this is in “doc/design-node-add.rst”. The tool receives a
JSON data structure on stdin and configures the node's daemon after
verifying the received values.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agomake genMaybe more Just
Guido Trotter [Thu, 6 Dec 2012 11:32:16 +0000 (12:32 +0100)]
make genMaybe more Just

There is a common conception that Just something is more worth than
Nothing. So we're biasing our tests towards that. As such let's generate
Nothing fewer times, and Just subgen more times. The values were copied
from the "official" maybe generator.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoLocking related fixes for networks
Dimitris Aragiorgis [Wed, 5 Dec 2012 16:28:14 +0000 (18:28 +0200)]
Locking related fixes for networks

Use GetNetwork() only when having already aquired the lock,
i.e. in CheckPrereq().

In LUNetworkConnect/Disconnect do not include Network info in Hooks
environment, so that network locking can be avoided if conflicts
are not checked.

Invoke _CheckNodeGroupInstances() only in case of conflicts check,
because otherwise owned instances are None, which results to an error.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoFix build breakage in Jobs.hs test code
Iustin Pop [Thu, 6 Dec 2012 08:58:21 +0000 (09:58 +0100)]
Fix build breakage in Jobs.hs test code

Commit 3bdbe4b3 (“Jobs.hs: move OpStatus and JobStatus ADTs to
Types.hs”) removed the TemplateHaskell language pragma from
htest/Test/Ganeti/Jobs.hs due to a hlint warning, but that is bad: it
means the testSuite call is no longer interpreted as a splice, so it results in:

  Parse error: naked expression at top level

With newer GHCs. To fix this, we restore the pragma, and add an hlint
ignore.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoconfigure.ac: fix reading of HLINT environment variable
Dato Simó [Wed, 5 Dec 2012 15:16:02 +0000 (15:16 +0000)]
configure.ac: fix reading of HLINT environment variable

configure.ac advertised that the HLINT environment variable could be set to
specify the path to the 'hlint' tool. However, HLINT was being initialized
to "no" inside configure.ac, which broke this usage.

Signed-off-by: Dato Simó <dato@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoHbal.hs: move job execution functions to Jobs.hs
Dato Simó [Tue, 20 Nov 2012 14:54:11 +0000 (14:54 +0000)]
Hbal.hs: move job execution functions to Jobs.hs

Ganeti.Jobs now holds functions that can be used to submit and monitor the
status of jobs. In particular, execJobsWait and waitForJobs are factored
out of Hbal.hs.

Signed-off-by: Dato Simó <dato@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoHbal.hs: use Result (), not Bool, as return value for exec*
Dato Simó [Wed, 7 Nov 2012 19:40:01 +0000 (19:40 +0000)]
Hbal.hs: use Result (), not Bool, as return value for exec*

Previously, functions in Hbal.hs related to execution of jobsets were
returning only IO Bool, and printing any errors they found directly to
stderr on their own.

I'm going to be moving some of these functions to a library module in
future commits, and it makes sense that they won't print to stderr, but
rather return an error condition. To make diffs more readable, I change the
return value in Hbal.hs itself, so that the next commit deals only with the
move. It's now `main` that prints any Bad result to stderr.

Signed-off-by: Dato Simó <dato@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoHbal.hs: rename functions that deal with early termination
Dato Simó [Thu, 15 Nov 2012 12:45:48 +0000 (12:45 +0000)]
Hbal.hs: rename functions that deal with early termination

In Hbal.hs, it's easy to get lost in the flow of exec* functions
because their names are similar and don't convey their different
purposes (e.g. runJobSet, execJobSet, execWrapper).

This patch renames 'runJobSet' to 'execWithCancel', and 'execWrapper'
to 'execCancelWrapper', since these two functions deal, in particular,
with early termination when the user presses ^C.

Signed-off-by: Dato Simó <dato@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoHbal.hs: fix typo in signal handler names (hangle -> handle)
Dato Simó [Wed, 7 Nov 2012 17:38:01 +0000 (17:38 +0000)]
Hbal.hs: fix typo in signal handler names (hangle -> handle)

'hangleSigInt' and 'hangleSigTerm' are renamed to 'handleSigInt' and
'handleSigTerm', respectively.

Signed-off-by: Dato Simó <dato@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoJobs.hs: move OpStatus and JobStatus ADTs to Types.hs
Dato Simó [Tue, 20 Nov 2012 14:34:48 +0000 (14:34 +0000)]
Jobs.hs: move OpStatus and JobStatus ADTs to Types.hs

This leaves Ganeti/Jobs.hs and Test/Ganeti/Jobs.hs empty, but they're the
target of a future move of some functions, so we leave them around, and
don't delete them, to avoid unnecessary delete/create diffs.

Signed-off-by: Dato Simó <dato@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMakefile: Reset environment for epydoc
Michael Hanselmann [Wed, 5 Dec 2012 16:41:54 +0000 (17:41 +0100)]
Makefile: Reset environment for epydoc

epydoc allows overriding configuration values via environment variables.
While this might be useful in certain use cases, but as no prefix
whatsoever is used, conflicts are easily created. Some people have the
environment variable “NAME” set, effectively overriding the project name
set in epydoc.conf. A bug in epydoc causes an error if non-ASCII
characters, such as German umlauts, are used in NAME.

$ NAME=Täscht make py-apidoc
[…]
UNEXPECTED ERROR:
'ascii' codec can't decode byte 0xc3 in position 73: ordinal not in range(128)

$ parse=false make py-apidoc
[…]
epydoc: error: Invalid option combination: --parse-only and --introspect-only.

This patch changes the call in Makefile to reset the environment given
to epydoc save for PATH and PYTHONPATH.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agojqueue: Don't modify input opcode when changing priority
Michael Hanselmann [Wed, 5 Dec 2012 12:42:45 +0000 (13:42 +0100)]
jqueue: Don't modify input opcode when changing priority

Commit 4679547 implemented the ability to change job's priority after it
was submitted. The code contained a bug whereby it would modify the
input data for an opcode, something the job queue shouldn't do (logical
units do for historical reasons).

This patch removes the line modifying the opcode input and adjusts the
tests.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoUse new util function for mac_prefix validation
Dimitris Aragiorgis [Wed, 5 Dec 2012 14:08:10 +0000 (16:08 +0200)]
Use new util function for mac_prefix validation

Use new NormalizeAndValidateThreeOctetMacPrefix() util function in
LUNetworkAdd/LUNetworkSetParams to validate network's MAC prefix.
Additionally, move the check in CheckArguments() in the case of
LUNetworkAdd.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoLUClusterRedistConf: Use node allocation lock
Michael Hanselmann [Fri, 23 Nov 2012 03:41:15 +0000 (04:41 +0100)]
LUClusterRedistConf: Use node allocation lock

All node locks are acquired.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoLUClusterRepairDiskSizes: Use node allocation lock
Michael Hanselmann [Fri, 23 Nov 2012 03:40:17 +0000 (04:40 +0100)]
LUClusterRepairDiskSizes: Use node allocation lock

This opcode acquires all node resource locks, which conflicts with
instance allocations.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoLUGroupVerifyDisks: Use node allocation lock
Michael Hanselmann [Fri, 23 Nov 2012 03:39:46 +0000 (04:39 +0100)]
LUGroupVerifyDisks: Use node allocation lock

See comment in code.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoLUClusterVerifyGroup: Use node allocation lock
Michael Hanselmann [Fri, 23 Nov 2012 03:39:20 +0000 (04:39 +0100)]
LUClusterVerifyGroup: Use node allocation lock

See comment in code.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoLUInstanceReplaceDisks: Acquire node allocation lock
Michael Hanselmann [Fri, 23 Nov 2012 01:47:13 +0000 (02:47 +0100)]
LUInstanceReplaceDisks: Acquire node allocation lock

If the lock was acquired in the first place (only when an iallocator is
used), it is released as soon as possible.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoLUInstanceChangeGroup: Acquire node allocation lock
Michael Hanselmann [Thu, 22 Nov 2012 23:08:32 +0000 (00:08 +0100)]
LUInstanceChangeGroup: Acquire node allocation lock

Changing instances' groups shouldn't conflict with instance allocations.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAcquire node allocation lock during node query
Michael Hanselmann [Thu, 22 Nov 2012 22:29:07 +0000 (23:29 +0100)]
Acquire node allocation lock during node query

If locking is used (usually by ganeti-watcher), node allocations must be
temporarily blocked.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoMention dsh/cssh in man page for "gnt-cluster command"
Michael Hanselmann [Wed, 5 Dec 2012 10:36:22 +0000 (11:36 +0100)]
Mention dsh/cssh in man page for "gnt-cluster command"

Until now they are only mentioned in “doc/admin.rst” and the man page
for “ganeti-listrunner”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>