ganeti-local
12 years agoserializer: Remove JSON indentation and dict key sorting
Michael Hanselmann [Wed, 21 Dec 2011 14:29:32 +0000 (15:29 +0100)]
serializer: Remove JSON indentation and dict key sorting

Serializing to JSON using “simplejson” is significantly slower when
indentation and/or sorting of dictionary keys is used. In simplejson 1.x
the difference isn't that big, but with simplejson 2.x the difference
can be up to a factor of 7.5. The reason is that the latter no longer
uses C functions when sorting or indentation is used.

With this patch we revert everything to simplejson's defaults, which
should provide us with the best performance available.

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

12 years agoFix unittests for daemon_util with disabled confd
Iustin Pop [Wed, 14 Dec 2011 11:11:46 +0000 (12:11 +0100)]
Fix unittests for daemon_util with disabled confd

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

12 years agoFix parameters for QueryJob in JobExecutor
Andrea Spadaccini [Mon, 19 Dec 2011 15:46:39 +0000 (15:46 +0000)]
Fix parameters for QueryJob in JobExecutor

When gnt-job submit is used with the --each option, it sends as
parameters for QueryJobs a list of lists, each containing a job ID.
While this works now, it is not the intended format for QueryJobs.

This patch fixes this behavior, by making it send a list of job IDs.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoFix cluster destroy failure
Andrea Spadaccini [Mon, 19 Dec 2011 10:42:32 +0000 (10:42 +0000)]
Fix cluster destroy failure

Cluster destroy would fail if there were errors while deactivating the
master IP address. This patch demotes such errors to warnings, allowing
the cluster to be destroyed even if the master IP address turndown
fails.

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

12 years agoAdd docs for missing option in gnt-debug man page
Andrea Spadaccini [Fri, 16 Dec 2011 20:54:06 +0000 (20:54 +0000)]
Add docs for missing option in gnt-debug man page

Document the --each option of gnt-debug submit-job.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

12 years agognt-node: Add hv/disk state to add
René Nussbaumer [Fri, 9 Dec 2011 12:54:20 +0000 (13:54 +0100)]
gnt-node: Add hv/disk state to add

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agognt-group: Add hv/disk state to add
René Nussbaumer [Thu, 8 Dec 2011 11:43:16 +0000 (12:43 +0100)]
gnt-group: Add hv/disk state to add

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agognt-cluster: Add hv/disk state to init
René Nussbaumer [Thu, 8 Dec 2011 10:55:56 +0000 (11:55 +0100)]
gnt-cluster: Add hv/disk state to init

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agoRAPI client: Export feature constants
Michael Hanselmann [Fri, 9 Dec 2011 14:50:13 +0000 (15:50 +0100)]
RAPI client: Export feature constants

Users of the RAPI client may want to use feature strings too, therefore
they should be explicitely public.

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

12 years agoRAPI client: Replace body value assignments with helper
Michael Hanselmann [Fri, 9 Dec 2011 14:44:41 +0000 (15:44 +0100)]
RAPI client: Replace body value assignments with helper

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

12 years agoRAPI client: Use utilities for building query parameters
Michael Hanselmann [Fri, 9 Dec 2011 14:33:08 +0000 (15:33 +0100)]
RAPI client: Use utilities for building query parameters

Instead of repeating a “if cond: query.append(…)” pattern, utility
functions are added and used.

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

12 years agosphinx_ext: No longer exclude “depends” parameter by default
Michael Hanselmann [Fri, 9 Dec 2011 14:31:10 +0000 (15:31 +0100)]
sphinx_ext: No longer exclude “depends” parameter by default

By default parameters existing for all opcodes (e.g. “debug_level”) are
not listed in the RAPI documentation. With this change the “depends”
parameter will be listed unless explicitely excluded.

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

12 years agoopcodes: Extend description of “depends” parameter
Michael Hanselmann [Fri, 9 Dec 2011 14:23:54 +0000 (15:23 +0100)]
opcodes: Extend description of “depends” parameter

The documentation string is used in the RAPI description and
having more details is good.

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

12 years agoAdd infrastructure for, and two extra hlint rules
Iustin Pop [Mon, 12 Dec 2011 09:42:46 +0000 (10:42 +0100)]
Add infrastructure for, and two extra hlint rules

This will allow us to easily use add new lint rules that we
standardise on, if any.

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

12 years agoDocument DRBD dynamic resync params in man pages
Andrea Spadaccini [Fri, 9 Dec 2011 16:30:26 +0000 (16:30 +0000)]
Document DRBD dynamic resync params in man pages

Also, remove some spurious spaces in the documentation of other options
and uniform the style of the disk parameters descriptions, by
terminating them with a period and adding the measurement unit in square
brackets after the description.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAdd the remaining DRBD dynamic sync disk params
Andrea Spadaccini [Fri, 9 Dec 2011 14:26:27 +0000 (14:26 +0000)]
Add the remaining DRBD dynamic sync disk params

Add the c-plan-ahead, c-fill-target, c-delay-target, c-max-rate,
c-min-rate parameters; report errors while setting the
synchronization speed.

Change the error signaling model of SetSyncParams. Instead of returning
True or False, return a list of errors (to make possible error reporting
during the recursive call).

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAdd the dynamic-resync DRBD disk parameter
Andrea Spadaccini [Fri, 9 Dec 2011 12:14:19 +0000 (12:14 +0000)]
Add the dynamic-resync DRBD disk parameter

constants.py, cmdlib.py:
- add the dynamic-resync parameter, both at DT and LD levels;

lib/bdev.py:
- change SetSyncSpeed to SetSyncParams, and _SetMinorSyncSpeed to
  _SetMinorSyncParams;
- use the dynamic-resync parameter.

Later patches will implement the rest of the parameters.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoDescribe the dynamic-resync par. in the design doc
Andrea Spadaccini [Wed, 7 Dec 2011 20:50:03 +0000 (20:50 +0000)]
Describe the dynamic-resync par. in the design doc

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoMakefile.am: fix permissions for Python scripts on install
Bernardo Dal Seno [Fri, 9 Dec 2011 15:26:15 +0000 (16:26 +0100)]
Makefile.am: fix permissions for Python scripts on install

Some Python scripts in /usr/lib/ganeti/ were getting the wrong permissions
(their 'x' bit was cleared).  This patch fixes that behavior.

This patch renames the variable 'dist_tools_PYTHON' to 'python_scripts'.
Some Python scripts were listed in the 'dist_tools_PYTHON' variable, but as
said scripts have no .py extension in their names, Automake treated the scripts
as data files, and hence no 'x' bit.  Now the Python scripts are processed
by the rules created for the 'dist_tools_SCRIPTS' variable, and such rules
don't depend on file name extensions.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agodevel/upload: Fix permissions for installed directories
Bernardo Dal Seno [Thu, 8 Dec 2011 23:35:47 +0000 (00:35 +0100)]
devel/upload: Fix permissions for installed directories

Permissions for the directories created during install depended on the
umask of the user running the script.  Now umask is reset inside the script
to remove such dependency.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoQA: init cluster changes ispecs
Agata Murawska [Fri, 9 Dec 2011 14:03:50 +0000 (15:03 +0100)]
QA: init cluster changes ispecs

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agoEmpty ipolicy fix
Agata Murawska [Fri, 9 Dec 2011 13:31:05 +0000 (14:31 +0100)]
Empty ipolicy fix

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agoMan page for gnt-group
Agata Murawska [Fri, 9 Dec 2011 11:49:06 +0000 (12:49 +0100)]
Man page for gnt-group

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

12 years agoMan page for gnt-cluster
Agata Murawska [Fri, 9 Dec 2011 11:33:05 +0000 (12:33 +0100)]
Man page for gnt-cluster

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

12 years agoResource model design update
Agata Murawska [Fri, 9 Dec 2011 10:55:02 +0000 (11:55 +0100)]
Resource model design update

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

12 years agoSimpleFillIpolicy corrected
Agata Murawska [Fri, 9 Dec 2011 10:01:44 +0000 (11:01 +0100)]
SimpleFillIpolicy corrected

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoChange constants: ISPECS suffixes to prefixes
Agata Murawska [Fri, 9 Dec 2011 09:28:44 +0000 (10:28 +0100)]
Change constants: ISPECS suffixes to prefixes

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agomem_count is now mem_size everywhere
Agata Murawska [Fri, 9 Dec 2011 08:54:34 +0000 (09:54 +0100)]
mem_count is now mem_size everywhere

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agoGroupSetParam supports instance policy changes
Agata Murawska [Tue, 6 Dec 2011 15:24:57 +0000 (16:24 +0100)]
GroupSetParam supports instance policy changes

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAddGroup supports instance policy
Agata Murawska [Tue, 6 Dec 2011 15:24:29 +0000 (16:24 +0100)]
AddGroup supports instance policy

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoGroup query now calculates ipolicy
Agata Murawska [Tue, 6 Dec 2011 15:22:47 +0000 (16:22 +0100)]
Group query now calculates ipolicy

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoVerification of instance policy for gnt-cluster verify
Agata Murawska [Tue, 6 Dec 2011 15:21:40 +0000 (16:21 +0100)]
Verification of instance policy for gnt-cluster verify

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoIntroduce instance policy on nodegroup level
Agata Murawska [Tue, 6 Dec 2011 16:35:08 +0000 (17:35 +0100)]
Introduce instance policy on nodegroup level

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoCluster-level instance policy - other
Agata Murawska [Tue, 6 Dec 2011 15:16:57 +0000 (16:16 +0100)]
Cluster-level instance policy - other

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoSetClusterParams supports instance policy changes
Agata Murawska [Tue, 6 Dec 2011 15:14:38 +0000 (16:14 +0100)]
SetClusterParams supports instance policy changes

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoInitCluster supports instance policy
Agata Murawska [Tue, 6 Dec 2011 15:35:05 +0000 (16:35 +0100)]
InitCluster supports instance policy

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoInstance policy command line support
Agata Murawska [Tue, 6 Dec 2011 15:13:31 +0000 (16:13 +0100)]
Instance policy command line support

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoIntroduce instance policy on cluster level
Agata Murawska [Tue, 6 Dec 2011 15:07:50 +0000 (16:07 +0100)]
Introduce instance policy on cluster level

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAdd a balloon device to all kvm instances
Guido Trotter [Thu, 8 Dec 2011 14:09:58 +0000 (14:09 +0000)]
Add a balloon device to all kvm instances

This can be used to resize their memory (for now only manually, as
ganeti doesn't do the job yet)

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

12 years agokvm: get more accurate info from qmp, if possible
Guido Trotter [Thu, 8 Dec 2011 13:56:06 +0000 (13:56 +0000)]
kvm: get more accurate info from qmp, if possible

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

12 years agokvm: make qmp connections more robust
Guido Trotter [Thu, 8 Dec 2011 13:28:32 +0000 (13:28 +0000)]
kvm: make qmp connections more robust

Currently qmp fails at connect() time if there are socket errors. (eg.
if the instance was started without qmp). Add some better checking.

Also in the only place where we use it avoid hiding the error connecting
to the socket as a failure to read the password file.

In addition one variable is renamed because its name now conflicts with
the newly imported stat module.

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

12 years agoMove ErrnoOnStr backend function to utils
Guido Trotter [Thu, 8 Dec 2011 13:19:45 +0000 (13:19 +0000)]
Move ErrnoOnStr backend function to utils

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

12 years agoAdd documentation for disk parameters to man pages
Andrea Spadaccini [Mon, 28 Nov 2011 12:01:54 +0000 (12:01 +0000)]
Add documentation for disk parameters to man pages

Document the stripes parameter for the plain template and the
resync-rate, datastripes, metastripes, disk-barriers, meta-barriers,
metavg, disk-custom and meta-custom parameters for the drbd template.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAdd net-custom and disk-custom DRBD parameters
Andrea Spadaccini [Tue, 6 Dec 2011 14:50:43 +0000 (14:50 +0000)]
Add net-custom and disk-custom DRBD parameters

Those parameters can be used to pass options directly to drbdsetup disk
and drbdsetup net.

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

12 years agoAdd the metavg DRBD disk parameter
Andrea Spadaccini [Tue, 6 Dec 2011 11:18:25 +0000 (11:18 +0000)]
Add the metavg DRBD disk parameter

This parameter represents the default metadata volume group for DRBD
disks. It can be overridden at instance creation time using the metavg
instance disk parameter.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoMove LD parameters constants to the LDP_ namespace
Andrea Spadaccini [Tue, 6 Dec 2011 16:54:17 +0000 (16:54 +0000)]
Move LD parameters constants to the LDP_ namespace

Add the LDP_ prefix to the LD parameters-related constants, in order to
avoid pollution in the global constants namespace.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoRestore diskparams in the gnt-group options check
Andrea Spadaccini [Thu, 8 Dec 2011 11:12:01 +0000 (11:12 +0000)]
Restore diskparams in the gnt-group options check

Commit a82823 accidentally removed opts.diskparameters from the list of
parameters that are checked for presence in gnt-group, thus causing
invocations of gnt-group modify with only disk paramaters to fail.

This commit restores the check and also simplifies the whole chain of
checks by using only conjunctions of negations (as opposed to using both
congjunctions of negations and negations of disjunctions).

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoSome small test simplifications
Iustin Pop [Thu, 8 Dec 2011 09:39:29 +0000 (10:39 +0100)]
Some small test simplifications

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

12 years agoAdd tests for parameter "always_failover"
Bernardo Dal Seno [Wed, 7 Dec 2011 16:19:44 +0000 (17:19 +0100)]
Add tests for parameter "always_failover"

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAdd new back-end parameter "always_failover"
Bernardo Dal Seno [Mon, 5 Dec 2011 19:10:42 +0000 (20:10 +0100)]
Add new back-end parameter "always_failover"

Instances that have this parameter is set to True are never migrated, but
instead they can only fail over.  There are some cases where freezing the
kernel may cause problems, and hence this behavior is preferable.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agomanpages: Fix small errors in documentation
Bernardo Dal Seno [Wed, 30 Nov 2011 17:05:29 +0000 (18:05 +0100)]
manpages: Fix small errors in documentation

Mostly typos, except for the output of "gnt-instance migrate" in an
example, which has been updated to the current version

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agognt-cluster: Allow modify disk/hv state
René Nussbaumer [Mon, 28 Nov 2011 15:03:43 +0000 (16:03 +0100)]
gnt-cluster: Allow modify disk/hv state

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agognt-group: Allow modify disk/hv state
René Nussbaumer [Mon, 28 Nov 2011 14:45:27 +0000 (15:45 +0100)]
gnt-group: Allow modify disk/hv state

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agognt-node: Allow modify disk/hv state
René Nussbaumer [Fri, 25 Nov 2011 13:54:29 +0000 (14:54 +0100)]
gnt-node: Allow modify disk/hv state

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agocmdlib: Adding hv/disk state dict helper functions
René Nussbaumer [Wed, 30 Nov 2011 13:57:15 +0000 (14:57 +0100)]
cmdlib: Adding hv/disk state dict helper functions

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agocli: Add common command flags for hv/disk state
René Nussbaumer [Fri, 25 Nov 2011 13:53:47 +0000 (14:53 +0100)]
cli: Add common command flags for hv/disk state

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agocmdlib: Adding _UpdateAndVerifySubDict helper
René Nussbaumer [Fri, 25 Nov 2011 10:49:41 +0000 (11:49 +0100)]
cmdlib: Adding _UpdateAndVerifySubDict helper

This helps with 2 dimensional dicts.
For example the hv_state and the disk_state dicts.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

12 years agoCleanup hlint errors
Iustin Pop [Wed, 7 Dec 2011 17:28:01 +0000 (18:28 +0100)]
Cleanup hlint errors

First, we update the recommended hlint version to what I used to get a
clean output (1.8.15). Most of the changes are:

- remove unneeded parentheses
- some simplifications (intercalate " " → unwords, maybe … id →
  fromMaybe, etc.)
- removal of some duplicate code (in previous patches)

There are still some warnings which I didn't clean out but plain
ignored:

- 'Eta reduce' in some specific files, because the type inference
  specialises the function on the first call, and annotating the type
  properly would be too verbose
- use of 'first', 'comparing', and 'on', since these don't seem to be
  widely or consistently used (outside ganeti/htools, I mean)
- use of Control.Exception.catch, as we only care about I/O errors; at
  one point yes, we will need to transition to this new API
- 'Reduce duplication', since hlint warns even for 3 duplicate lines,
  and abstracting that away seems overkill to me

After this patch, make hlint is clean and doesn't exit with an error
anymore; we could enable it automatically on 'make lint' if hlint is
detected (future patch).

Note that we explicitly skip the THH.hs file from checking because it
seems that hlint doesn't parse correctly for now the splice notation.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoAbstract some common hspace code into a function
Iustin Pop [Wed, 7 Dec 2011 17:22:19 +0000 (18:22 +0100)]
Abstract some common hspace code into a function

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoAbstract some common Cluster.hs code into a function
Iustin Pop [Wed, 7 Dec 2011 17:21:15 +0000 (18:21 +0100)]
Abstract some common Cluster.hs code into a function

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoAdd DRBD dynamic resync speed params to design doc
Andrea Spadaccini [Tue, 6 Dec 2011 22:14:02 +0000 (22:14 +0000)]
Add DRBD dynamic resync speed params to design doc

* Expand the Name column of the table (for c-delay-target)
* Add the c-* DRBDparameters to the table containing the disk parameters
* Add the unit of measurement in square brackets, when needed
* Document the supported DRBD version, warn about the DRBD version
  needed for barriers and for the dynamic resync speed parameters.
* Add links to some documentation about the dynamic resync speed
  parameters

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoConvert opcode TH code to the use of Field type
Iustin Pop [Tue, 6 Dec 2011 15:39:32 +0000 (16:39 +0100)]
Convert opcode TH code to the use of Field type

This makes more explicit the field behaviour - previously an optional
field was detected via a "Maybe" constructor, and an optional one via
a "Just defval" one. With this, field behaviour become more explicit
than auto-deduced.

In THH.hs, I slightly changed the fieldVariable function to use the
field name (if the field is not renamed), so that we have the exact
same output as before.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoUnify some file lists in Makefile.am
Iustin Pop [Tue, 6 Dec 2011 14:26:01 +0000 (15:26 +0100)]
Unify some file lists in Makefile.am

These were repeated needlessly; I hope I grouped them correctly.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Andrea Spadaccini <spadaccio@google.com>

12 years agoAdd DRBD barriers disk parameters
Andrea Spadaccini [Mon, 28 Nov 2011 18:17:04 +0000 (18:17 +0000)]
Add DRBD barriers disk parameters

Add the disk-barriers and meta-barriers parameters described in the
design doc.

constants.py:
* add the needed LD and DT-level parameters, use the defaults provided
  at ./configure time;
* add constants representing which barriers should be disabled and the
  set of valid options.

lib/bdev.py:
* factor the barriers handling code to a class method, for testing
  purposes;
* implement the more granular version checking logic;
* use the LD level parameters;
* add stricter check on DRBD version (8.0, 8.2 or 8.3), as we do not
  support 8.4 yet.

lib/cmdlib.py:
* translate DT level parameters to LD level ones.

configure.ac, Makefile.am:
* set both disk and meta barriers parameters depending on the value of
  --enable-drbd-barriers.

test/ganeti.bdev_unittest.py:
* unit tests for the code that sets DRBD barrier parameters depending on
  the version.

doc/design-resource-model.rst:
* reword the description of meta-barriers;
* change all disk parameters names to use dashes instead of underscores.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoStyle fixes on confd-client
Iustin Pop [Tue, 6 Dec 2011 09:44:27 +0000 (10:44 +0100)]
Style fixes on confd-client

Oops, forgot to check this before initial commit, sorry!

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

12 years agoNEWS: Add missing space
Michael Hanselmann [Tue, 6 Dec 2011 09:57:03 +0000 (10:57 +0100)]
NEWS: Add missing space

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agohtools: small change in error message in THH.hs
Iustin Pop [Sun, 20 Nov 2011 17:03:30 +0000 (18:03 +0100)]
htools: small change in error message in THH.hs

We should also display the value we can't parse, otherwise debugging
is very hard.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agohtools: improvements to JSON deserialisation
Iustin Pop [Fri, 25 Nov 2011 11:21:52 +0000 (12:21 +0100)]
htools: improvements to JSON deserialisation

This fixes two problems:

- first, when we deserialise a big object, showing its value is not
  useful, as it will hide the actual error message
- second, we shouldn't deserialise a container at once, because then
  we will lose the detail of which 'key' failed to deserialise; we
  change to manual deserialisation of each key/value pair, so that we
  can keep this information

The last point requires that we import JSON.hs into THH.hs, in order
not to duplicate functionality.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agohtools: add new template haskell system
Iustin Pop [Fri, 18 Nov 2011 09:54:02 +0000 (10:54 +0100)]
htools: add new template haskell system

This system based on explicit types instead of ad-hoc rules
(e.g. instead of deducing from "Maybe Int" an optional field, we now
can say explicitly OptionalField ''Int). In the first phase, this will
be used for the equivalent of lib/objects.py, which has slightly
different rules than luxi/opcodes.

We should look at merging the two systems later.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoAdd a small confd client
Iustin Pop [Tue, 22 Nov 2011 10:47:38 +0000 (11:47 +0100)]
Add a small confd client

This can be used to test live servers; currently there's not direct
way to interact with a confd server, except for burnin's builtin tests
(which were the source of this file).

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

12 years agoA few updates to the confd design (2.1)
Iustin Pop [Sun, 20 Nov 2011 00:42:11 +0000 (01:42 +0100)]
A few updates to the confd design (2.1)

While the 2.1 design is old and should be “immutable”, I can't find
documentation about the confd protocol anywhere else, so let's correct
the design doc.

The patch is mostly style changes, plus a clarification on the ‘query’
field of the request, which varies *a lot* per request type.

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

12 years agocmdlib: Make use of cluster's new “primary_hypervisor” property
Michael Hanselmann [Thu, 1 Dec 2011 13:11:06 +0000 (14:11 +0100)]
cmdlib: Make use of cluster's new “primary_hypervisor” property

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

12 years agoobjects.Cluster: Add property for primary hypervisor
Michael Hanselmann [Thu, 1 Dec 2011 12:59:25 +0000 (13:59 +0100)]
objects.Cluster: Add property for primary hypervisor

This is useful for working with a node's hypervisor state, where only
the primary hypervisor will be authoritative.

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

12 years agoLV stripes parameters for plain and drbd
Andrea Spadaccini [Mon, 28 Nov 2011 10:47:35 +0000 (10:47 +0000)]
LV stripes parameters for plain and drbd

configure.ac:
* change the documentation of --with-lvm-stripecount parameter to
  reflect the change

doc/design-resource-model.rst:
* change drbd/stripes to drbd/data-stripes and drbd/metastripes to
  drbd/meta-stripes

rest of files:
* add the plain/stripes, drbd/data-stripes and drbd/meta-stripes disk
  parameters

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAdd DRBD8 static resync speed disk parameter
Andrea Spadaccini [Mon, 21 Nov 2011 14:51:11 +0000 (14:51 +0000)]
Add DRBD8 static resync speed disk parameter

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoUse disk parameters in Logical Units
Andrea Spadaccini [Wed, 23 Nov 2011 11:43:40 +0000 (11:43 +0000)]
Use disk parameters in Logical Units

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoUse disk parameters in noded
Andrea Spadaccini [Mon, 21 Nov 2011 13:48:58 +0000 (13:48 +0000)]
Use disk parameters in noded

* add the params attribute to BlockDev, and add the corresponding
  parameter to all the BlockDev classes;
* change the Create, Assemble and FindDevice factory functions interface
  to accept as parameters an objects.Disk instance and a list of
  children block devices; update their callers;
* make the factory functions provide default values for params if
  needed;
* factor out a check in the block device factory functions.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoqa: add gnt-cluster tests related to disk params
Andrea Spadaccini [Wed, 23 Nov 2011 22:53:34 +0000 (22:53 +0000)]
qa: add gnt-cluster tests related to disk params

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAdd basic support for disk parameters
Andrea Spadaccini [Mon, 21 Nov 2011 13:43:09 +0000 (13:43 +0000)]
Add basic support for disk parameters

objects.py:
  * add disk parameters to Disk, Cluster, NodeGroup.

constants.py:
  * add dictionaries that will hold types and default values for disk
    parameters (for now, empty).

test/ganeti.constants_unittest.py:
  * add unit tests for consistency in disk parameters default values.

rest of files:
  * add to gnt-cluster and gnt-group the options to manipulate disk
    parameters.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoMore fixes after commit 78519c106
Michael Hanselmann [Wed, 30 Nov 2011 13:51:12 +0000 (14:51 +0100)]
More fixes after commit 78519c106

A quick QA run successfully finished with these changes.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Andrea Spadaccini <spadaccio@google.com>

12 years agoFix “node_info” RPC result
Michael Hanselmann [Wed, 30 Nov 2011 13:38:15 +0000 (14:38 +0100)]
Fix “node_info” RPC result

Commit 78519c106 broke everything. Here's the fix.

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

12 years agoquery: Add fields for node's disk/hv state
Michael Hanselmann [Mon, 28 Nov 2011 14:07:39 +0000 (15:07 +0100)]
query: Add fields for node's disk/hv state

These fields just return the node attribute's contents. They will be
used by the watcher to detect out of date node states.

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

12 years agohv_xen: Report memory used by hypervisor
Michael Hanselmann [Fri, 25 Nov 2011 10:33:43 +0000 (11:33 +0100)]
hv_xen: Report memory used by hypervisor

- Report memory used by hypervisor (“mem_hv” as per resource model
  design document, “xmem” in htools)
- Also report number of CPUs available to Dom0
- Some other, small changes

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

12 years agohv_xen: Export number of CPUs for Dom0
Michael Hanselmann [Thu, 24 Nov 2011 13:21:03 +0000 (14:21 +0100)]
hv_xen: Export number of CPUs for Dom0

This will be stored in the node object and used for calculations.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoAdd objects for disk/hv state
Michael Hanselmann [Tue, 22 Nov 2011 09:13:59 +0000 (10:13 +0100)]
Add objects for disk/hv state

- Data objects
- Serialization/deserialization
- Unittests

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

12 years agoobjects.Node: Add static hv/disk state
Michael Hanselmann [Mon, 21 Nov 2011 10:34:03 +0000 (11:34 +0100)]
objects.Node: Add static hv/disk state

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agohv_xen: Use constant for “Domain-0” name
Michael Hanselmann [Thu, 24 Nov 2011 13:17:34 +0000 (14:17 +0100)]
hv_xen: Use constant for “Domain-0” name

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoChange “node_info” RPC to accept multiple VGs/hypervisors
Michael Hanselmann [Tue, 29 Nov 2011 16:32:48 +0000 (17:32 +0100)]
Change “node_info” RPC to accept multiple VGs/hypervisors

Keeping the node state up to date will require information from multiple
VGs and hypervisors. Instead of requiring multiple calls this change
allows a single call to return all needed information. Existing users
are changed.

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

12 years agolocking: Allow checking if lock is owned in certain mode
Michael Hanselmann [Tue, 29 Nov 2011 15:36:26 +0000 (16:36 +0100)]
locking: Allow checking if lock is owned in certain mode

With this patch the “LockSet” and “GanetiLockManager” classes have a new
function to check if a single or a group of locks (at a certain level)
have been acquired in a specific mode. This will be used for additional
assertions. Until now they could only check if a lock has been acquired,
but not in which mode. One use-case will be updating the node state in
various places, where the node lock must be acquired in exclusive mode.

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

12 years agoMerge branch 'devel-2.5'
Michael Hanselmann [Thu, 24 Nov 2011 13:59:52 +0000 (14:59 +0100)]
Merge branch 'devel-2.5'

* devel-2.5:
  ConfigWriter: Fix epydoc error
  ConfigWriter: Fix epydoc error

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

12 years agoMerge branch 'devel-2.4' into devel-2.5
Michael Hanselmann [Thu, 24 Nov 2011 12:22:28 +0000 (13:22 +0100)]
Merge branch 'devel-2.4' into devel-2.5

* devel-2.4:
  ConfigWriter: Fix epydoc error

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoMerge branch 'stable-2.5' into devel-2.5
Michael Hanselmann [Thu, 24 Nov 2011 12:15:46 +0000 (13:15 +0100)]
Merge branch 'stable-2.5' into devel-2.5

* stable-2.5:
  ConfigWriter: Fix epydoc error

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Andrea Spadaccini <spadaccio@google.com>

12 years agoConfigWriter: Fix epydoc error
Michael Hanselmann [Thu, 24 Nov 2011 12:02:36 +0000 (13:02 +0100)]
ConfigWriter: Fix epydoc error

The parameter is called “mods”, not “modes”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Andrea Spadaccini <spadaccio@google.com>
(cherry picked from commit 1730d4a1ab56ef36d082b614d3d0ab13f3e14a85)

12 years agoConfigWriter: Fix epydoc error
Michael Hanselmann [Thu, 24 Nov 2011 12:02:36 +0000 (13:02 +0100)]
ConfigWriter: Fix epydoc error

The parameter is called “mods”, not “modes”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Andrea Spadaccini <spadaccio@google.com>

12 years agoMerge branch 'devel-2.5'
Michael Hanselmann [Thu, 24 Nov 2011 09:50:35 +0000 (10:50 +0100)]
Merge branch 'devel-2.5'

* devel-2.5:
  LUGroupAssignNodes: Fix node membership corruption
  LUGroupAssignNodes: Fix node membership corruption
  Fix pylint warning on unreachable code
  LUNodeEvacuate: Disallow migrating all instances at once
  Separate OpNodeEvacuate.mode from iallocator
  LUNodeEvacuate: Locking fixes
  Fix error when removing node

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoMerge branch 'devel-2.4' into devel-2.5
Michael Hanselmann [Thu, 24 Nov 2011 09:06:39 +0000 (10:06 +0100)]
Merge branch 'devel-2.4' into devel-2.5

* devel-2.4:
  LUGroupAssignNodes: Fix node membership corruption

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoMerge branch 'stable-2.5' into devel-2.5
Michael Hanselmann [Thu, 24 Nov 2011 08:40:10 +0000 (09:40 +0100)]
Merge branch 'stable-2.5' into devel-2.5

* stable-2.5:
  LUGroupAssignNodes: Fix node membership corruption
  Fix pylint warning on unreachable code
  LUNodeEvacuate: Disallow migrating all instances at once
  LUNodeEvacuate: Locking fixes
  Fix error when removing node

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoLUGroupAssignNodes: Fix node membership corruption
Michael Hanselmann [Thu, 24 Nov 2011 07:43:04 +0000 (08:43 +0100)]
LUGroupAssignNodes: Fix node membership corruption

Note: This bug only manifests itself in Ganeti 2.5, but since the
problematic code also exists in 2.4, I decided to fix it there.

If a node was assigned to a new group using “gnt-group assign-nodes” the
node object's group would be changed, but not the duplicate member list
in the group object. The latter is an optimization to require fewer
locks for other operations. The per-group member list is only kept in
memory and not written to disk.

Ganeti 2.5 starts to make use of the data kept in the per-group member
list and consequently fails when it is out of date. The following
commands can be used to reproduce the issue in 2.5 (in 2.4 the issue was
confirmed using additional logging):

  $ gnt-group add foo
  $ gnt-group assign-nodes foo $(gnt-node list --no-header -o name)
  $ gnt-cluster verify  # Fails with KeyError

This patch moves the code modifying node and group objects into
“config.ConfigWriter” to do the complete operation under the config
lock, and also to avoid making use of side-effects of modifying objects
without calling “ConfigWriter.Update”. A unittest is included.

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

12 years agoLUGroupAssignNodes: Fix node membership corruption
Michael Hanselmann [Thu, 24 Nov 2011 07:43:04 +0000 (08:43 +0100)]
LUGroupAssignNodes: Fix node membership corruption

Note: This bug only manifests itself in Ganeti 2.5, but since the
problematic code also exists in 2.4, I decided to fix it there.

If a node was assigned to a new group using “gnt-group assign-nodes” the
node object's group would be changed, but not the duplicate member list
in the group object. The latter is an optimization to require fewer
locks for other operations. The per-group member list is only kept in
memory and not written to disk.

Ganeti 2.5 starts to make use of the data kept in the per-group member
list and consequently fails when it is out of date. The following
commands can be used to reproduce the issue in 2.5 (in 2.4 the issue was
confirmed using additional logging):

  $ gnt-group add foo
  $ gnt-group assign-nodes foo $(gnt-node list --no-header -o name)
  $ gnt-cluster verify  # Fails with KeyError

This patch moves the code modifying node and group objects into
“config.ConfigWriter” to do the complete operation under the config
lock, and also to avoid making use of side-effects of modifying objects
without calling “ConfigWriter.Update”. A unittest is included.

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

12 years agoFix pylint warning on unreachable code
Michael Hanselmann [Thu, 24 Nov 2011 07:58:56 +0000 (08:58 +0100)]
Fix pylint warning on unreachable code

Commit c50452c3186 added an exception when all instances should be
evacuated off a node, but did so in a way which made pylint complain
about unreachable code.

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