ganeti-local
11 years agoSwitch job IDs to numeric
Iustin Pop [Thu, 2 Aug 2012 11:47:53 +0000 (13:47 +0200)]
Switch job IDs to numeric

This has been a long-standing cleanup item, which we've always
refrained from doing due to the high estimated effort needed.

In reality, it turned out that after some infrastructure improvements
(the previous patches), the actual job queue-related changes are quite
small.

We will need to update the NEWS file later, but so far the RAPI
documentation doesn't mention that the job ID is a string (it only
says it is "a number"), so it doesn't look like it needs update.

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

11 years agoAdd infrastructure for building numeric namefield filters
Iustin Pop [Thu, 2 Aug 2012 11:29:04 +0000 (13:29 +0200)]
Add infrastructure for building numeric namefield filters

Currently, all the CLI helpers in qlang.py and cli.py assume that all
namefields are string, which leads to various breakage in case the're
actually not.

To improve the flexibility of the helpers, we add a bit of
infrastructure for accepting so called "numeric" namefields; this is a
bit of a hack, as a proper fix would actually add QFT_* support to the
helpers, and case for example the regex/globbing on QFT_TEXT, etc. But
that's left for (eventual) later improvement.

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

11 years agoMake jqueue unittests more generic
Iustin Pop [Thu, 2 Aug 2012 11:16:47 +0000 (13:16 +0200)]
Make jqueue unittests more generic

This patch removes/abstracts some hardcoded values in the jqueue
unittests. Currently we have a per-resource type name field, but the
name field values are hardcoded at the call sites, instead of being
abstracted into separate variables.

This will become a problem later, so let's just introduce some new
vars holding these; modifying the tests later will be therefore
easier.

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

11 years agoExpand debug messages in gnt-debug test-jobqueue
Iustin Pop [Thu, 2 Aug 2012 10:50:23 +0000 (12:50 +0200)]
Expand debug messages in gnt-debug test-jobqueue

It wasn't clear for which tests we were ignoring the errors.

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

11 years agoFix uses of OpPrereqError without code info
Iustin Pop [Thu, 2 Aug 2012 09:37:46 +0000 (11:37 +0200)]
Fix uses of OpPrereqError without code info

A while back, we did cleanup the code and ensured (manually) that use
of OpPrereqError includes an errors.ECODE_* field as second
argument. Since we cannot automate the check for this, it turns out
that more and more such usage has crept over the years, including in
the master code (the use on the CLI side is not as important).

Note that this also uncovered a few errors in ovf.py where the errors
messages were wrongly constructed.

Still looking for a way to automate this check…

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

11 years agohtools: abstract function for parsing job ids
Iustin Pop [Wed, 25 Jul 2012 14:20:56 +0000 (16:20 +0200)]
htools: abstract function for parsing job ids

Both the job id and submit job result parsing are abstracted into
separate functions, so that later changes are more localised.

Also, this makes submitManyJobs itself easier to read.

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

11 years agoIntroduce a type for the ganeti job type
Iustin Pop [Wed, 25 Jul 2012 14:16:38 +0000 (16:16 +0200)]
Introduce a type for the ganeti job type

This will be used for easier change later.

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

11 years agoRelease version 2.6.0 (final) v2.6.0
Iustin Pop [Fri, 27 Jul 2012 10:59:54 +0000 (12:59 +0200)]
Release version 2.6.0 (final)

Phew, it wasn't easy, but…

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

11 years agoFix 'explicitely' common typo
Iustin Pop [Thu, 26 Jul 2012 19:53:26 +0000 (21:53 +0200)]
Fix 'explicitely' common typo

It seems that 'explicitely' is wrong, and that the right form is
'explicitly'. This is just fixing the typo plus adjusting affected
paragraphs.

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

11 years agoFix issue in LUClusterVerifyGroup with multi-group clusters
Iustin Pop [Thu, 26 Jul 2012 14:43:18 +0000 (16:43 +0200)]
Fix issue in LUClusterVerifyGroup with multi-group clusters

In case LUClusterVerifyGroup is run on a group which doesn't contain
the master node, the following could happen:

- master node is selected due to the explicit check
- if the order of nodes in the 'absent_nodes' list is such that the
  master node is the first in it, then we'll select (again) the master
  node
- passing duplicate nodes to RPC calls will break due to RPC
  internals; this should be fixed separately, but in the meantime we
  just refrain from passing such duplicates

This patch should not change the semantics of the code, since it
wasn't guaranteed even before that we find a vm_capable node.

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

11 years agoAdd QA test for node group modification of ndparams
Iustin Pop [Thu, 26 Jul 2012 11:24:58 +0000 (13:24 +0200)]
Add QA test for node group modification of ndparams

Additionally, we run hbal if the htools tests are enabled (new
key). Note that hbal will directly exit, since there are no instances,
but at least it will load and parse the group details.

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

11 years agoFix node group modification of node parameters
Iustin Pop [Thu, 26 Jul 2012 11:17:41 +0000 (13:17 +0200)]
Fix node group modification of node parameters

Commit 904b3bfe tried to fix the deletion of custom ndparams from
group, but instead broke both modification and deletion: because we
run ForceDictType on self.op.ndparams instead of the updated
new_ndparams, we can neither delete nor set properly spindle_count
(since it won't be coerced to int).

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

11 years agoQA for allocator in recreate-disks
Bernardo Dal Seno [Wed, 27 Jun 2012 08:53:47 +0000 (10:53 +0200)]
QA for allocator in recreate-disks

QA for recreate-disks called it twice with a list of node; the first call
now uses an allocator.

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

11 years agoFront-end and doc to use allocator in recreate-disks
Adam Ingrassia [Wed, 22 Feb 2012 15:31:26 +0000 (10:31 -0500)]
Front-end and doc to use allocator in recreate-disks

The recreate-disks command no longer requires an explicit list of nodes.

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

11 years agoAllocator support in recreate-disks LU
Bernardo Dal Seno [Wed, 4 Apr 2012 17:50:05 +0000 (19:50 +0200)]
Allocator support in recreate-disks LU

This affects only the backend.

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

11 years agoAdded method to call an allocator for recreate-disks
Adam Ingrassia [Fri, 24 Feb 2012 17:28:49 +0000 (12:28 -0500)]
Added method to call an allocator for recreate-disks

Ideally this should have used relocation mode, but to due lacking of
support in current allocators, allocation mode has been used instead.

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

11 years agoSupport for checking the group of only the primary node
Adam Ingrassia [Tue, 24 Jul 2012 17:05:35 +0000 (13:05 -0400)]
Support for checking the group of only the primary node

_CheckInstanceNodeGroups behaves in the old way with the default value
of the new parameter.

Signed-off-by: Adam Ingrassia <api@google.com>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMerge commit 'v2.5.2' into stable-2.6
Iustin Pop [Tue, 24 Jul 2012 16:44:59 +0000 (18:44 +0200)]
Merge commit 'v2.5.2' into stable-2.6

* commit 'v2.5.2':
  Fix RST formatting in NEWS file
  Update NEWS and bump version for release 2.5.2
  Fix boot=on flag for CDROMs
  KVM: only pass boot flag once

Conflicts:
        NEWS         (trivial, merged the entries)
        configure.ac (trivial, kept ours)

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

11 years agoFix RST formatting in NEWS file v2.5.2
Iustin Pop [Tue, 24 Jul 2012 16:02:33 +0000 (18:02 +0200)]
Fix RST formatting in NEWS file

*FileID is interpreted as a start-of-bold, without corresponding end
marker. Sorry for not catching it in the first place.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

11 years agoUpdate NEWS and bump version for release 2.5.2
Iustin Pop [Tue, 24 Jul 2012 15:52:23 +0000 (17:52 +0200)]
Update NEWS and bump version for release 2.5.2

This is a trivial release, with just bug fixes, so a small change log.

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

11 years agoFix boot=on flag for CDROMs
Iustin Pop [Mon, 23 Jul 2012 12:46:08 +0000 (14:46 +0200)]
Fix boot=on flag for CDROMs

This generalises commit 4304964a to cdroms too, since they have
somewhat the same logic. We just abstract the needs_boot_flag into a
separate variable, and then reuse it in the cdrom section.

Note that the logic of what 'if=' type to pass to KVM was very
convoluted, and (I think) incorrect; I went and cleaned it to be more
consistent.

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

11 years agoKVM: only pass boot flag once
Iustin Pop [Mon, 23 Jul 2012 11:56:09 +0000 (13:56 +0200)]
KVM: only pass boot flag once

This addresses issue 230: passing two methods of booting to KVM can,
depending on the KVM version, confuse it.

Note that commit 4304964a introduced a partial fix for this (but only
for disks, and keyed on KVM versions). However, it didn't fix cdrom
booting, which still fails with the same error, so let's fix it more
generically; we still leave the per-disk check since that is about
-boot c versus -drive …,boot=on rather than two boot methods.

Patch is based on the one submitted by Vladimir Mencl, many thanks!

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

11 years agoBuild epydoc.conf using standard replace_vars_sed
Iustin Pop [Fri, 20 Jul 2012 18:58:57 +0000 (20:58 +0200)]
Build epydoc.conf using standard replace_vars_sed

This is just begging to be converted to a standard replace_vars_sed
rule, instead of custom sed calls.

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

11 years agoSimplify some make rules
Iustin Pop [Fri, 20 Jul 2012 18:49:33 +0000 (20:49 +0200)]
Simplify some make rules

A rule of type "a/%: a/%.in" will also match "a/b/%: a/b/%.in", so no
need for the explicit examples/hooks rule. As for the man rules, they
are identical and thus can be collapsed.

We still have the problem that globally, not all our %.in to %
transformations are identical; this is suboptimal and should be
cleaned sometime…

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

11 years agoExplicitly terminate some make rules
Iustin Pop [Fri, 20 Jul 2012 18:30:18 +0000 (20:30 +0200)]
Explicitly terminate some make rules

Generic rules like:

  %: %.in

have the downside that the source (%.in) itself matches the target
(via %.in: %.in.in). This leads to things like:

  Looking for a rule with intermediate file `doc/examples/hooks/ipsec.in.in'.
   Trying pattern rule with stem `ipsec.in.in'.
   Trying implicit prerequisite `doc/examples/hooks/ipsec.in.in.in'.
   Trying pattern rule with stem `ipsec.in.in'.
   Trying implicit prerequisite `doc/examples/hooks/ipsec.in.in.in'.
   Looking for a rule with intermediate file `doc/examples/hooks/ipsec.in.in.in'.
  Rejecting impossible implicit prerequisite `doc/examples/hooks/ipsec.in.in'.

To fix this, we need to tell make that such rules are terminating, so
that it doesn't recurse into them.

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

11 years agoRemove ancient implicit make rules
Iustin Pop [Fri, 20 Jul 2012 17:49:13 +0000 (19:49 +0200)]
Remove ancient implicit make rules

GNU Make contains some (ancient) implicit rules, that try to
_automatically_ extract source files from RCS/SCCS version control
systems. This is unneeded, and it pollutes the make -d output
significantly: after removing these rules (by defining empty targets
for their patterns), make -d line count goes from 5.3K to 3.3K.

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

11 years agoStop using BUILT_SOURCES
Iustin Pop [Fri, 20 Jul 2012 15:54:14 +0000 (17:54 +0200)]
Stop using BUILT_SOURCES

Commit dc7d2c49 introduced the use of BUILT_SOURCES to work around
missing dependencies. However, on closer reading of the gmake manual,
BUILT_SOURCES is mainly used in cases where the dependencies are not
know before the build starts (e.g. with auto-generated C header
files). Additionally, there are a number of drawbacks to
BUILT_SOURCES, which we already had to work around (e.g. in commit
eb732fb5).

Since we know all our dependencies statically, there's no need to use
this special variable. Let's rename it to GENERATED_FILES, which
doesn't have a special meaning to make, and add a few missing
dependencies (one of which was already broken by make -j on a clean
tree).

After this change, running make in a fully built tree is finally "clean":

  $ make
  make: Nothing to be done for `all'.

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

11 years agoChange how we create the 'ganeti' symlink
Iustin Pop [Fri, 20 Jul 2012 15:37:36 +0000 (17:37 +0200)]
Change how we create the 'ganeti' symlink

Currently, if one runs 'make' in an already fully-built tree, this is
the result:

  cd . && test -h "ganeti" || { rm -f ganeti && ln -s lib ganeti; }
  make  all-am
  make[1]: Entering directory `/tmp/test'
  cd . && test -h "ganeti" || { rm -f ganeti && ln -s lib ganeti; }
  make[1]: Leaving directory `/tmp/test'

This is because commit dc7d2c49 added 'ganeti' (which is a PHONY
target) to BUILT_SOURCES, and since that is a dependency of other,
real targets, it means the ganeti target is always remade.

To fix this, we keep ganeti as a PHONY target, but we remove it from
the 'built_base_sources' target, and instead we only remake it
manually in the stamp-directories target. A make run now is just:

  make  all-am
  make[1]: Entering directory `/tmp/test'
  make[1]: Nothing to be done for `all-am'.
  make[1]: Leaving directory `/tmp/test'

Note that we can't get rid of the all-am since we use BUILT_SOURCES.

We also remove the comment of BUILT_SOURCES since it no longer depends
on PHONY targets.

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

11 years agoPartial undo of "Makefile: Streamline directory creation"
Iustin Pop [Fri, 20 Jul 2012 14:58:20 +0000 (16:58 +0200)]
Partial undo of "Makefile: Streamline directory creation"

Commit c964d962 changed the way we create directories, by two things:

- unifying all dependencies and ad-hoc directory creation into a
  single target (all_dirfiles)
- changing how directories are created from a stamp file to .dir files
  in each directory

The first item is a very good one, but the second item is debatable:
there's no per-se advantage of .dir files versus a single one,
top-level, since both the .dir file and stamp-directories creation are
depending on Makefile, which is the only one which can introduce new
directories.

On the other hand, moving back from .dir files to stamp-directories
has an advantage: "make -d | wc -l" does from ~8.7K lines to ~5.3K
lines, because we eliminate the many .dir files and their multiple
implicit and explicit dependencies (the %/.dir files fall under
multiple patterns).

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

11 years agoA few style fixes in Makefile.am
Iustin Pop [Fri, 20 Jul 2012 19:35:37 +0000 (21:35 +0200)]
A few style fixes in Makefile.am

Seen while debugging make rules.

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

11 years agoEnsure a stable content of the bash completion file
Iustin Pop [Fri, 20 Jul 2012 20:14:40 +0000 (22:14 +0200)]
Ensure a stable content of the bash completion file

Currently, the order of commands in the bash completion file is
random, because the sub-commands are not sorted. This makes it harder
to investigate the differences in packaged Ganeti or in installed
Ganeti, since chunks in this file will have a random order.

To fix this, we sort the subcommands based on the first subcommand in
a given group ('first' also in sorted order); this results in a stable
contents of file, as tested by building it many times and checking for
differences.

The patch also does a few other minor changes to the file
(e.g. updating copyright years, etc.).

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

11 years agoCorrectly do sub-$(MAKE) invocations
Iustin Pop [Fri, 20 Jul 2012 14:06:08 +0000 (16:06 +0200)]
Correctly do sub-$(MAKE) invocations

Reading the automake documentation, it seems that explicit calls to
$(MAKE) need $(AM_MAKEFLAGS) passed, so let's do that.

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

11 years agoMake error classes more consistent
Iustin Pop [Fri, 20 Jul 2012 10:00:29 +0000 (12:00 +0200)]
Make error classes more consistent

This removes "pass" from a few definitions, making all errors
consistent.

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

11 years agoAdd support for -cpu option in KVM
Nikita Staroverov [Wed, 11 Jul 2012 20:24:30 +0000 (13:24 -0700)]
Add support for -cpu option in KVM

This adds supports for the (non-validated) cpu parameter to KVM.

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

11 years agoAdd note in admin guide about drbd stacked devices
Johan Euphrosine [Thu, 19 Jul 2012 11:15:00 +0000 (13:15 +0200)]
Add note in admin guide about drbd stacked devices

Fixes: http://code.google.com/p/ganeti/issues/detail?id=251
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMerge branch 'stable-2.6'
Iustin Pop [Thu, 19 Jul 2012 12:37:46 +0000 (14:37 +0200)]
Merge branch 'stable-2.6'

* stable-2.6: (21 commits)
  Release Ganeti 2.6.0 rc4
  Prepare NEWS for Ganeti 2.6.0rc4
  Add some rudimentary node group ipolicy checks
  Fix setting ipolicy on node groups
  Fix --no-headers for the new list-drbd command
  Add a simple QA test for gnt-node list-drbd
  Add a new gnt-node command list-drbd
  Implement a node to drbd minors query function
  Add a new unused confd query
  Add support for computing instance all/secondary nodes
  Add disk logical ID support in Objects.hs
  Fix a docstring in bdev's DRBD8 class
  Extend the Template Haskell loadFn model
  Change how customFields are built
  Implement lookup of partial names in Config.hs
  Reorganise the lookup functions
  Remove an unused function
  Ensure that disk.params is always defined (and a dict)
  Another small consistency fix with if branches
  Fix inconsistency in the LUXI protocol w.r.t. args
  ...

Conflicts:
        htools/Ganeti/HTools/QC.hs (imports changes, trivial)

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

11 years agoRe-indent kvm-ifup.in
Iustin Pop [Thu, 19 Jul 2012 12:03:34 +0000 (14:03 +0200)]
Re-indent kvm-ifup.in

By a strange accident, this file seems to be tabified, instead of our
own 2-space rule. Re-indent it and also break one long line.

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

11 years agoRelease Ganeti 2.6.0 rc4 v2.6.0rc4
René Nussbaumer [Thu, 19 Jul 2012 12:21:53 +0000 (14:21 +0200)]
Release Ganeti 2.6.0 rc4

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

11 years agoPrepare NEWS for Ganeti 2.6.0rc4
René Nussbaumer [Thu, 19 Jul 2012 11:56:59 +0000 (13:56 +0200)]
Prepare NEWS for Ganeti 2.6.0rc4

Another release candidate is coming.

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

11 years agoAdd some rudimentary node group ipolicy checks
René Nussbaumer [Thu, 19 Jul 2012 08:40:46 +0000 (10:40 +0200)]
Add some rudimentary node group ipolicy checks

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

11 years agoFix setting ipolicy on node groups
René Nussbaumer [Thu, 19 Jul 2012 08:26:13 +0000 (10:26 +0200)]
Fix setting ipolicy on node groups

On node groups we don't have the std field. However, the InstancePolicy
object always verifies that the std value is within a given range. As we
fill it up with defaults if not set (as it happens to be on node groups)
and the min value is higher than the default std value (taken from
constants.py) we fail.

We overcome this situation by simply let the function know if we want to
verify the std value at all. If we don't want to verify std, we just set
it to a compliant value (min_v) and continue.

We also slightly adapt the error message provided, as we don't have std
values on groups.

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

11 years agoForce tap's MAC prefix to "fe"
Simon Deziel [Fri, 11 May 2012 16:00:24 +0000 (12:00 -0400)]
Force tap's MAC prefix to "fe"

Setting a high prefix discourages the bridge from adopting the tap's
MAC. Xen is not affected by this since the MAC is forced to
"fe:ff:ff:ff:ff:ff".

This addresses issue #217.

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

11 years agoFix --no-headers for the new list-drbd command
Iustin Pop [Thu, 19 Jul 2012 08:31:52 +0000 (10:31 +0200)]
Fix --no-headers for the new list-drbd command

Sorry, I forgot that with GenerateTable this needs to be handled
manually. Fixed now and tested in both ways.

(But to be honest, this should be abstracted in GenerateTable, instead
of the 'if' test in all its callers.)

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

11 years agoAdd a simple QA test for gnt-node list-drbd
Iustin Pop [Wed, 18 Jul 2012 11:07:08 +0000 (13:07 +0200)]
Add a simple QA test for gnt-node list-drbd

This will be run only if 'haskell-confd' QA configuration has been
enabled.

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

11 years agoAdd a new gnt-node command list-drbd
Iustin Pop [Wed, 18 Jul 2012 09:44:48 +0000 (11:44 +0200)]
Add a new gnt-node command list-drbd

This uses confd to query the DRBD minors, which is very special; no
other command currently does so.

Since the backend is only implemented in the Haskell version of confd,
we have checks that 1) confd is enable, and 2) hs confd is also
enabled. If by mistake people do manage to query Python confd, the
error message will be clean:

  Query gave non-ok status '2': not implemented

So nothing breaks in an "ugly" way.

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

11 years agoImplement a node to drbd minors query function
Iustin Pop [Wed, 18 Jul 2012 09:35:05 +0000 (11:35 +0200)]
Implement a node to drbd minors query function

This can be queried remotely since it's a pure configuration query.

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

11 years agoAdd a new unused confd query
Iustin Pop [Mon, 16 Jul 2012 13:49:04 +0000 (15:49 +0200)]
Add a new unused confd query

This is not implemented currently.

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

11 years agoAdd support for computing instance all/secondary nodes
Iustin Pop [Mon, 16 Jul 2012 12:59:40 +0000 (14:59 +0200)]
Add support for computing instance all/secondary nodes

This fixes an old FIXME. Since we now how actual DRBD configuration
data, we can finally compute the instance's secondary nodes.

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

11 years agoAdd disk logical ID support in Objects.hs
Iustin Pop [Mon, 16 Jul 2012 12:11:03 +0000 (14:11 +0200)]
Add disk logical ID support in Objects.hs

This is a complex field, so we have to do a lot of manual work for now.

The complexity arises from the fact that the contents of the field,
and the way to parse it, depends on the disk type field, so we don't
have a single, static way of parsing it. Hence we needed the
extensions to the Template Haskell code.

Since we now can both load and save the disk type, we can remove the
in-memory (duplicate) disk type from the disk objects, relying only on
the logical ID to hold the type information.

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

11 years agoFix a docstring in bdev's DRBD8 class
Iustin Pop [Mon, 16 Jul 2012 11:51:20 +0000 (13:51 +0200)]
Fix a docstring in bdev's DRBD8 class

It seems this was not updated since the move to static minors…

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

11 years agoExtend the Template Haskell loadFn model
Iustin Pop [Mon, 16 Jul 2012 11:37:09 +0000 (13:37 +0200)]
Extend the Template Haskell loadFn model

Currently, we only allow field-by-field de-serialisation. Since we
have cases where information about how to un-serialise a field is
split across two JSON fields (e.g. disk type and disk logical_id,
hypervisor and hvparams, etc.), we need to pass the entire object to
custom read functions.

Furthermore, since we will have to generate two actual fields from the
single in-memory field, we need to extend the custom save function so
that they can generate additional fields beyond the "main" field value
they currently generate.

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

11 years agoChange how customFields are built
Iustin Pop [Mon, 16 Jul 2012 11:31:18 +0000 (13:31 +0200)]
Change how customFields are built

Instead of passing an expression (which cannot come from the current
module), we pass a name, which is allowed to reference functions from
the module we're in. Since we currently don't have custom fields, we
don't need to modify any callers.

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

11 years agoImplement lookup of partial names in Config.hs
Iustin Pop [Wed, 18 Jul 2012 09:31:39 +0000 (11:31 +0200)]
Implement lookup of partial names in Config.hs

This uses the recently-moved functions to implement partial lookup of
names on getNode and getInstance, similar to the Python codebase.

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

11 years agoReorganise the lookup functions
Iustin Pop [Wed, 18 Jul 2012 09:03:31 +0000 (11:03 +0200)]
Reorganise the lookup functions

Currently, the LookupResult, MatchPriority and related functions are
locate in Loader.hs, since (so far) only hbal needs them in the
selection of instances. However, with the new functionality on confd
side, we need these functions there too, but we don't want to import
Loader.hs (which pulls in lots of balancing-related code). So we move
all these function to BasicTypes.hs, since that module is a leaf one,
with no other dependencies.

Unittests are slightly adjusted (but they are still tested under the
'Loader' group).

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

11 years agoRemove an unused function
Iustin Pop [Mon, 16 Jul 2012 11:30:04 +0000 (13:30 +0200)]
Remove an unused function

This is not used, as we need a more complex serialisation, which is
done in the saveObjectField function.

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

11 years agoEnsure that disk.params is always defined (and a dict)
Iustin Pop [Wed, 18 Jul 2012 12:18:12 +0000 (14:18 +0200)]
Ensure that disk.params is always defined (and a dict)

Commit cce46164 fixed upgrading from other 2.6 versions, but
accidentally broke upgrading from 2.5 (disk.params was left as None,
which breaks FillDict). The simplest way to handle params is to always
set them to an empty dict (disregarding what they currently contain).

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

11 years agoAnother small consistency fix with if branches
René Nussbaumer [Wed, 18 Jul 2012 11:34:36 +0000 (13:34 +0200)]
Another small consistency fix with if branches

While looking at the testability of this piece of code, I found another
consistency problem. We have two if branches instead of one, with
elif's.

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

11 years agoFix inconsistency in the LUXI protocol w.r.t. args
René Nussbaumer [Wed, 18 Jul 2012 09:13:09 +0000 (11:13 +0200)]
Fix inconsistency in the LUXI protocol w.r.t. args

This inconsistency was found during rebalancing. Hbal failed because,
Ganeti couldn't load the opcode. After digging through the cause, an
inconsistency with the "args" field in the LUXI protocol was triggered
by the TemplateHaskell side where it's done uniformed.

For SubmitJob and SubmitManyJobs we treat args as one argument,
containing the job definition. In every other LUXI call args is actually
a list of arguments. This patch fixes this consistency.

This change is NOT backwards compatible.

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

12 years agoFix UpgradeConfig of Disk object regards disk params
René Nussbaumer [Tue, 17 Jul 2012 08:18:41 +0000 (10:18 +0200)]
Fix UpgradeConfig of Disk object regards disk params

This bug was found during disk parameter debugging. While looking at the
config some values seem present on the disk parameters, but that's not
expected behaviour. This patch fixes this, and also fixes the "broken"
configs automatically upon masterd restart.

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

12 years agoMerge branch 'stable-2.6'
Iustin Pop [Fri, 13 Jul 2012 14:39:41 +0000 (16:39 +0200)]
Merge branch 'stable-2.6'

* stable-2.6: (72 commits)
  Make Ganeti 2.6.0 rc3 release
  Allow reinstall even when secondaries are offline
  Prepare NEWS file for Ganeti 2.6.0 rc3
  QA updated to test instance removing when sec. is offline
  Ignore offline node errors when removing disks
  Allow instance disc activation with offline secondaries
  RAPI regression beparams/memory fix
  Fix redistribution of files w.r.t. offline nodes
  Fix cluster verify error on master-ip-setup script
  Add a Makefile rule to test unclean git status
  Add test helpers to .gitignore
  Fix a typo in NEWS
  Release Ganeti 2.6.0rc2
  Prepare NEWS file for 2.6.0 rc2
  Update time on Haskell binaries after build
  hcheck: add two simple type aliases for readability
  hcheck: rework output mode
  hcheck: reword and fix typo in instance/offline msg
  Add hlint warning for wrong use of 'length'
  Remove can_rebalance functionality from hcheck
  ...

Conflicts:
        htools/Ganeti/HTools/QC.hs: due to the cleanup of missing type
        signatures, and the fact that in master two test functions had
        a changed argument list, trivial to fix

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

12 years agoMake Ganeti 2.6.0 rc3 release v2.6.0rc3
René Nussbaumer [Fri, 13 Jul 2012 11:46:34 +0000 (13:46 +0200)]
Make Ganeti 2.6.0 rc3 release

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

12 years agoAllow reinstall even when secondaries are offline
René Nussbaumer [Wed, 11 Jul 2012 12:29:06 +0000 (14:29 +0200)]
Allow reinstall even when secondaries are offline

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoPrepare NEWS file for Ganeti 2.6.0 rc3
René Nussbaumer [Wed, 11 Jul 2012 11:38:34 +0000 (13:38 +0200)]
Prepare NEWS file for Ganeti 2.6.0 rc3

Update NEWS regarding rc3 fixes and document changes in behaviour.

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

12 years agoQA updated to test instance removing when sec. is offline
Agata Murawska [Mon, 9 Jul 2012 10:49:52 +0000 (12:49 +0200)]
QA updated to test instance removing when sec. is offline

Added test checking that it is possible to remove an instance with drbd
disk when non-primary node is offline.

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

12 years agoIgnore offline node errors when removing disks
Agata Murawska [Mon, 9 Jul 2012 09:00:53 +0000 (11:00 +0200)]
Ignore offline node errors when removing disks

When we delete DRBD disks from some instance, we do not want to get
errors due to nodes other than that instance's primary being offline.

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

12 years agoAllow instance disc activation with offline secondaries
Iustin Pop [Fri, 6 Jul 2012 13:59:19 +0000 (15:59 +0200)]
Allow instance disc activation with offline secondaries

Currently, this is not allowed, so one can't run a replace-disks; this
breaks any non-invasive method of recovering the redundancy of the
instance if its disks are already stopped (but it still works if the
disks on the primary are active). So let's fix this inconsistency.

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

12 years agoReplace a few explicit case expressions
Iustin Pop [Fri, 6 Jul 2012 13:43:10 +0000 (15:43 +0200)]
Replace a few explicit case expressions

Since we're just talking about converting Maybe into another monad, we
can do that via the maybe function, instead of explicit casing.

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

12 years agoFix Haskell coverage results
Iustin Pop [Fri, 6 Jul 2012 12:46:46 +0000 (14:46 +0200)]
Fix Haskell coverage results

There are two current issues with the coverage values:

- we don't import all modules, thus leading to incomplete
  coverage results (too optimistic);
- we use hpc in its default mode (intersection), which means that even
  modules which do have coverage results but are not used in all
  binaries we test will be dropped from the results; thanks to Agata,
  passing --union to hpc is enough to have better results (don't
  remember why this wasn't there in the first place…)

After adding more modules to the import list and fixing the combining
mode, we now have a complete list of modules in coverage results, many
with zero coverage, so our overall coverage has dropped to about 60%.

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

12 years agoAlso compute Haskell tags in "make tags"
Iustin Pop [Fri, 6 Jul 2012 10:47:39 +0000 (12:47 +0200)]
Also compute Haskell tags in "make tags"

Note however that this won't work correctly with older compilers, due
to ghc issue #4256; however, it's a handy way to build complete a TAGS
file for Emacs.

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

12 years agoCleanup the QC.hs file w.r.t. compiler options
Iustin Pop [Fri, 6 Jul 2012 10:20:04 +0000 (12:20 +0200)]
Cleanup the QC.hs file w.r.t. compiler options

Currently, we build the Haskell unittests with custom GHC flags,
because we (I) were quite lazy when initially writing the
unittests. This is not a problem for the tests themselves, but it
creates problem when (for example) one would want to pass all
$(HS_LIB_SRCS) to the compilers; this is not doable unless we
"degrade" the flags used for all modules, instead of just for QC.hs.

So we do two things to fix this:

- first, we go and add type declaration to all functions that were
  missing them (in QC), and fix the couple of cases of monomorphism
  restrictions; this gets us rid of -fno-warn-missing-signature and
  -fno-warn-monomorphism-restriction
- then, we move the actually important remaining options
  (-fno-warn-orphans and -fno-warn-unused-imports; see the explanation
  for the latter in the newly added FIXME) to a compiler pragma in the
  file, so that when building the unittests only this file is using
  the extra options

And finally we can then drop the other unused options
(-fno-warn-missing-methods anmd -Wwarn), leaving htools/test use
simply -fhpc. This is more in-line with the other files, and thus we
can handle all of HS_LIB_SRCS the same.

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

12 years agoRAPI regression beparams/memory fix
René Nussbaumer [Fri, 6 Jul 2012 09:35:24 +0000 (11:35 +0200)]
RAPI regression beparams/memory fix

For compatibility with the old Ganeti version, we want to keep the
beparams/memory field around for another release. This patch fixes this
regression.

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

12 years agoInstallation instructions update
Agata Murawska [Tue, 3 Jul 2012 13:06:57 +0000 (15:06 +0200)]
Installation instructions update

This patch aims at improving documentation for installing ganeti - both for users and developers.

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

12 years agoFix Query2.hs to compile without warnings
Iustin Pop [Thu, 5 Jul 2012 16:30:20 +0000 (18:30 +0200)]
Fix Query2.hs to compile without warnings

Since this is not yet used by any targets, we didn't detect yet the
compilation warnings. Just trivial exports/imports cleanup.

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

12 years agoEnsure that --wait-for-sync is used in QA
Iustin Pop [Thu, 5 Jul 2012 13:28:47 +0000 (15:28 +0200)]
Ensure that --wait-for-sync is used in QA

We don't have a specific test for activate disks, so let's add it in
the cases where we run (incidentally) activate-disks.

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

12 years agoAdd --wait-for-sync in gnt-instance
Iustin Pop [Thu, 5 Jul 2012 13:27:02 +0000 (15:27 +0200)]
Add --wait-for-sync in gnt-instance

Note that this needs (like for the opcode) a new option, with the
default reverted (False instead of True).

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

12 years ago9Add wait_for_sync flag to OpInstanceActivateDisks
Iustin Pop [Thu, 5 Jul 2012 13:19:38 +0000 (15:19 +0200)]
9Add wait_for_sync flag to OpInstanceActivateDisks

This can be used to ensure that after activate-disks has returned, the
instance's storage is consistent; currently there's no programmatic
way to do this.

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

12 years agohbal: return exit status 0 in case of early exit
Iustin Pop [Thu, 5 Jul 2012 12:44:05 +0000 (14:44 +0200)]
hbal: return exit status 0 in case of early exit

This derives from an internal bug, but the story is consistent across
both internal and external usage of hbal.

Basically right now, hbal returns exit code 1 if requested to exit
early, even if all jobs are successful. This is counter-intuitive due
to two reasons:

- hbal did what it was requested (exit early), so it shouldn't return error
- there were no job failures, so there's nothing to "cleanup" or
  investigate on the Ganeti cluster, so again it shouldn't return
  error

Therefore the new behaviour is as follows:

- for cases where all jobs were successful, even if terminated early
  via SIGINT or via --limit, we exit with code 0
- for cases where jobs have failed or there were other errors in
  running hbal, the exit code is 1
- for cases were hbal is requested an immediate termination (SIGTERM),
  exit code is 2, denoting "unknown whether the Ganeti cluster is
  consistent or not"

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

12 years agoFix DRBD resize code
Iustin Pop [Thu, 5 Jul 2012 10:08:44 +0000 (12:08 +0200)]
Fix DRBD resize code

There are two bugs in the current resize code, affecting mostly DRBD.

First, due to bugs in old DRBD versions (pre 8.0.14), the code currently
calls `drbdsetup resize' on both the primary or secondary. However,
this is actually wrong per current DRBD (from drbdsetup(8)):

     resize
       This causes DRBD to reexamine the size of the device's backing
       storage device. To actually do online growing you need to
       extend the backing storages on both devices and call the resize
       command on one of your nodes.

So calling it just on the primary node should be enough. However, we
can't simply remove the calls to the secondary nodes, since that would
break the growth of the underlying storage (LVM) on the
secondary. Which leads to the second existing bug: we call resize on
each node, even before finish the growth of the underlying
storage. This can leads to all kind of issues if DRDB is not well
behaved.

So to fix both these bugs, we have to extend the current RPC call with
another parameter, which denotes whether to extend the actual backing
storage or just the "logical" one (DRBD being the only one; MD would
be another, if implemented). This allows us to do the growth in two
steps, first the backing store on all nodes, then the logical storage
on just the primary node.

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

12 years agoFix redistribution of files w.r.t. offline nodes
Iustin Pop [Wed, 4 Jul 2012 15:41:01 +0000 (17:41 +0200)]
Fix redistribution of files w.r.t. offline nodes

Currently, _RedistributeAncillaryFiles computes two lists: the list of
online nodes (for all files redistribution), and the list of
vm_capable nodes, for hypervisor-specific files. However, the
vm_capable list includes offline nodes too, leading to warning
messages:

  WARNING: Copy of file /etc/xen/xend-config.sxp to node node13.example.com failed: Node is marked offline

We fix this by trivially intersecting the vm_capable list with the
online one.

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

12 years agoFix cluster verify error on master-ip-setup script
René Nussbaumer [Wed, 4 Jul 2012 11:08:40 +0000 (13:08 +0200)]
Fix cluster verify error on master-ip-setup script

This error does not show up until we exceed the pool of master
candidates and have nodes which are not master candidates.

The background is that we check for master-ip-setup script on master
candidates and expect them not to be on the other nodes. However, we
distribute a default master-ip-script which break this assumption.
Furthermore, there's no reason why the file should just exists on the
master candidates.

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

12 years agoAdd a Makefile rule to test unclean git status
Iustin Pop [Sat, 30 Jun 2012 01:25:45 +0000 (18:25 -0700)]
Add a Makefile rule to test unclean git status

This is trivial, but can be used easily from automated builds to check
that the git tree is clean: files are not modified and untracked files
are not present.

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

12 years agoAdd test helpers to .gitignore
Iustin Pop [Sat, 30 Jun 2012 01:17:42 +0000 (18:17 -0700)]
Add test helpers to .gitignore

Commit 3096524e enabled building of test helpers, but forgot to add
them to .gitignore, resulting in "unclean" git status output.

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

12 years agoFix a typo in NEWS
René Nussbaumer [Tue, 3 Jul 2012 11:55:33 +0000 (13:55 +0200)]
Fix a typo in NEWS

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

12 years agoRelease Ganeti 2.6.0rc2 v2.6.0rc2
René Nussbaumer [Tue, 3 Jul 2012 08:26:03 +0000 (10:26 +0200)]
Release Ganeti 2.6.0rc2

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoPrepare NEWS file for 2.6.0 rc2
René Nussbaumer [Thu, 28 Jun 2012 14:31:42 +0000 (16:31 +0200)]
Prepare NEWS file for 2.6.0 rc2

We are about to release another version of Ganeti 2.6, so we prepare the
NEWS file with the changes from rc1 to rc2.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoUpdate time on Haskell binaries after build
Iustin Pop [Thu, 28 Jun 2012 23:00:03 +0000 (16:00 -0700)]
Update time on Haskell binaries after build

This patch works around an issue in our build system. Since we don't
use cabal or 'ghc -M', we don't track actual dependencies in our
Makefile; this in turn means that editing a file that only is used in
the main 'htools' binary will keep triggering 'ghc --make' for the
hconfd binary; and this actually takes a bit of time to look at all
the dependencies.

So to work around this, we add a touch after each ghc --make, such
that we trigger the unneeded build at most once.

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

12 years agohcheck: add two simple type aliases for readability
Iustin Pop [Thu, 28 Jun 2012 22:54:36 +0000 (15:54 -0700)]
hcheck: add two simple type aliases for readability

The same types are reused a couple of times, so let's add a couple of
type aliases for easier change later and readability.

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

12 years agohcheck: rework output mode
Iustin Pop [Thu, 28 Jun 2012 22:48:47 +0000 (15:48 -0700)]
hcheck: rework output mode

Looking at the output of hcheck, in human readable mode, it looks like
it always starts with a blank line. This is not nice, so I wanted to
redo this to start cleanly.

However, looking at the code, I realised that we need some internal
cleanup; 'perGroupChecks' was doing both pure computation (computing
the score/stats) and I/O work (printing the stats), which is ugly, so
I split that in two; this allows perGroupChecks to be simpler, and we
can therefore first compute the group stats, and start the output with
the mode in which we run.

So right now, hcheck will first output whether we need to run a
rebalance, or if no-simulation is selected, etc., and only then
display the actual stats, making the output a bit more consistent.

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

12 years agohcheck: reword and fix typo in instance/offline msg
Iustin Pop [Thu, 28 Jun 2012 22:44:45 +0000 (15:44 -0700)]
hcheck: reword and fix typo in instance/offline msg

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

12 years agoAdd hlint warning for wrong use of 'length'
Iustin Pop [Thu, 28 Jun 2012 22:20:05 +0000 (15:20 -0700)]
Add hlint warning for wrong use of 'length'

While removing split instances check from hcheck, I saw a wrong use of
'length': this should only be used when one needs the actual length of
the list, and not when one wants to check whether the list is empty or
not (in that case, 'null' should be used).

To prevent this in the future, let's add a hlint hint for it, and fix
the warning it generates in hbal.

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

12 years agoRemove can_rebalance functionality from hcheck
Iustin Pop [Thu, 28 Jun 2012 22:15:46 +0000 (15:15 -0700)]
Remove can_rebalance functionality from hcheck

Since hbal can now run rebalances even in the presence of split
instances, we can remove this check and always run the rebalance.

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

12 years agoFix building of hcheck man page
Iustin Pop [Thu, 28 Jun 2012 22:10:59 +0000 (15:10 -0700)]
Fix building of hcheck man page

The code used a space, not a tab, in Makefile.am, which means it
actually broke the variable declaring the man pages.

Furthermore, we add some blank lines in the man page, otherwise the
paragraphs will be run-in together.

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

12 years agoFix tiny typo in htools.rst
Iustin Pop [Thu, 28 Jun 2012 21:51:23 +0000 (14:51 -0700)]
Fix tiny typo in htools.rst

Backtracking through git blame, it turns out than commit 49148d15
changed "\fB20,102400,16384,4\fR" into "**B20,102400,16384,4**". But
of course that's a mistake, since the markup was \fB, not just \f.

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

12 years agoFixed spaces/indentation according to guide lines
Bernardo Dal Seno [Fri, 29 Jun 2012 14:22:03 +0000 (16:22 +0200)]
Fixed spaces/indentation according to guide lines

Problem introduced by commit 87f0aa4896ac4dfacc9d20bc55b0855282b4d1d4.

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

12 years agoFix small bug with a space in the hv_xen module's line
Jack [Fri, 29 Jun 2012 09:26:26 +0000 (13:26 +0400)]
Fix small bug with a space in the hv_xen module's line

Remove a useless space at the end of the line in a config file.

Signed-off-by: Jack Sitnikov <sitnikove@gmail.com>
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

12 years agoAllow param `modify' during gnt-instance modify
Constantinos Venetsanopoulos [Wed, 27 Jun 2012 15:27:28 +0000 (18:27 +0300)]
Allow param `modify' during gnt-instance modify

With the new gnt-instance modify syntax for addition and removal of
disks/NICs on arbitrary indexes, we hit an assertion if the user
passes `modify' as one of the disk's parameters. E.g::

 gnt-instance modify --disk 2:modify,size=3G instance1
 gnt-instance modify --disk 3:add,size=1G,modify instance2

This patch fixes the bug, by allowing `modify' to be passed as a
parameter (as happens with `add' and `remove'), as long as it is
not done alongside `add' or `remove'. If so, it is treated in the
same way as if none of modify/add/remove is passed --> modify.

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoAdd PCI passthrough for hvm xen
Jack [Thu, 28 Jun 2012 16:39:17 +0000 (20:39 +0400)]
Add PCI passthrough for hvm xen

This hv parameter allows passing PCI devices to virtual machines.

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

12 years agoCorrect a wrong --help option for --simulate
Iustin Pop [Thu, 28 Jun 2012 04:56:11 +0000 (21:56 -0700)]
Correct a wrong --help option for --simulate

This was not update when the alloc policy was added to the parameter.

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

12 years agoAdd a shell test for hbal and split instances
Iustin Pop [Thu, 28 Jun 2012 04:46:13 +0000 (21:46 -0700)]
Add a shell test for hbal and split instances

This is not perfect, as we only test that hbal completes successfully
and that it show a score improvement, but it's better than nothing.

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

12 years agohbal: relax restrictions on split instances
Iustin Pop [Thu, 28 Jun 2012 00:51:51 +0000 (17:51 -0700)]
hbal: relax restrictions on split instances

The recent patch series on hcheck made me realise how much pain we
have due to hbal not being able to work (at all) with split instances.

This is sub-optimal; ideally, hbal would degrade its behaviour, but
not completely refuse to work. This patch does this, by marking any
split instances as not movable (since such instances most likely mean
that some manual intervention is done on then), but otherwise
proceeding with the rebalance of the selected node group.

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