ganeti-local
14 years agoDisable TODO warnings in pylint
Iustin Pop [Mon, 28 Dec 2009 16:40:52 +0000 (17:40 +0100)]
Disable TODO warnings in pylint

We don't get any useful out of this - a git grep is as effective, and
these only pollute the pylint output.

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

14 years agoAdd some stubs to bdev.FileStorage
Iustin Pop [Mon, 28 Dec 2009 16:03:56 +0000 (17:03 +0100)]
Add some stubs to bdev.FileStorage

This patch adds explicit errors (instead of notimplemented) in
FileStorage (and the associated TODOs).

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

14 years agoFix indentation issues
Iustin Pop [Mon, 28 Dec 2009 14:43:37 +0000 (15:43 +0100)]
Fix indentation issues

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

14 years agoFix two bugs in ConfigWriter._EnsureUUID
Iustin Pop [Mon, 28 Dec 2009 14:17:45 +0000 (15:17 +0100)]
Fix two bugs in ConfigWriter._EnsureUUID

Wrong argument name and wrong number of arguments in string formatting.

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

14 years agoKVM: Abstract/rework instance up checks
Iustin Pop [Mon, 28 Dec 2009 13:54:33 +0000 (14:54 +0100)]
KVM: Abstract/rework instance up checks

This patch abstract the check "is instance stopped" into a separate
function, and thus simplifies a couple of higher-level functions. It
also moves from manual read of the pidfile to use the (correct
abstraction of) _InstancePidAlive.

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

14 years agoKVM: Split out the pidfile computation
Iustin Pop [Mon, 28 Dec 2009 13:48:26 +0000 (14:48 +0100)]
KVM: Split out the pidfile computation

In some cases we only need the pidfile, but not the pid or the alive
status.

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

14 years agoFix an error message
Iustin Pop [Mon, 28 Dec 2009 13:41:39 +0000 (14:41 +0100)]
Fix an error message

Detected by an 'Unused variable' warning.

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

14 years agoRemove many 'Unused variable' warnings
Iustin Pop [Mon, 28 Dec 2009 13:39:20 +0000 (14:39 +0100)]
Remove many 'Unused variable' warnings

Note there are some cases left which need extra cleanup.

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

14 years agoFix use of the logging functions
Iustin Pop [Mon, 28 Dec 2009 12:55:29 +0000 (13:55 +0100)]
Fix use of the logging functions

The logging functions expand the arguments themselves, thus it's safer
to let them do it rather than manual string formatting.

Also re-wraps one comment.

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

14 years agoMerge branch 'devel-2.0' into devel-2.1
Iustin Pop [Mon, 28 Dec 2009 12:05:40 +0000 (13:05 +0100)]
Merge branch 'devel-2.0' into devel-2.1

* devel-2.0:
  Fix indentation in hv_kvm
  Implement BuildHooksEnv for NoHooksLU
  Clarifiy some more wide pylint disables
  Fix two bugs in seldom-used codepaths
  Update pylintrc
  Add targetted pylint disables
  Partial cherry-pick of 6c881c5 from the 2.1 branch
  Add a release script
  Fix a typo in the doc string

Conflicts:
lib/cli.py
lib/cmdlib.py
lib/hypervisor/hv_kvm.py
lib/jstore.py
lib/locking.py
lib/mcpu.py
lib/rapi/rlib2.py

Many of the conflicts were on code removed from 2.1, so the resolving was
trivial.

14 years agoFix indentation in hv_kvm
Iustin Pop [Mon, 21 Dec 2009 16:08:13 +0000 (17:08 +0100)]
Fix indentation in hv_kvm

Per pylint warnings.

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

14 years agoImplement BuildHooksEnv for NoHooksLU
Iustin Pop [Mon, 21 Dec 2009 15:51:40 +0000 (16:51 +0100)]
Implement BuildHooksEnv for NoHooksLU

This just adds a stub function that raises an assertion error; this
accomplishes two things:

- silences many pylint warnings
- if we ever stumble upon this, a specific assertion error is
  (hopefully) clearer than just a not implemented error

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

14 years agoClarifiy some more wide pylint disables
Iustin Pop [Mon, 21 Dec 2009 15:44:21 +0000 (16:44 +0100)]
Clarifiy some more wide pylint disables

This removes/updates some module-wide pylint disables.

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

14 years agoFix two bugs in seldom-used codepaths
Iustin Pop [Mon, 21 Dec 2009 15:21:07 +0000 (16:21 +0100)]
Fix two bugs in seldom-used codepaths

New version of pylint, new bugs found!

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

14 years agoUpdate pylintrc
Iustin Pop [Mon, 21 Dec 2009 15:19:35 +0000 (16:19 +0100)]
Update pylintrc

Since the current pylintrc is in now way good for our style, we update
it:

- remove docstring checks, since we have too many cases where a
  docstring doesn't make sense
- relax naming rules to cover more alternatives (but not break the
  naming rules)
- increase many of the limits

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

14 years agoAdd targetted pylint disables
Iustin Pop [Mon, 21 Dec 2009 15:12:43 +0000 (16:12 +0100)]
Add targetted pylint disables

This patch adds targeted pylint disables, where it makes sense (either
due to limitations in pylint or due to historical usage), and also a few
blanket ones in rapi where all the names are… “different”.

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

14 years agoPartial cherry-pick of 6c881c5 from the 2.1 branch
Iustin Pop [Wed, 4 Nov 2009 13:09:53 +0000 (14:09 +0100)]
Partial cherry-pick of 6c881c5 from the 2.1 branch

This cherry-picks the utils.FieldSet.Matches changes and the significant
jqueue.py change. These are stable in the 2.1 branch and therefore make
sense to backport to 2.0 (are basically cleanups).

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

14 years agoAdd a release script
Iustin Pop [Fri, 18 Dec 2009 13:09:44 +0000 (14:09 +0100)]
Add a release script

Currently releases are done via the manual procedure on
http://code.google.com/p/ganeti/wiki/ReleaseProcess, but that is not
very reliable, and breaks for rc releases. The 1.2.9/2.0.5/2.1.0~rc2
releases were done with this new script that eases the process.

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

14 years agoFix a typo in the doc string
René Nussbaumer [Fri, 18 Dec 2009 12:59:12 +0000 (13:59 +0100)]
Fix a typo in the doc string

MaybeRaise in lib/errors.py had a typo in the doc string

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

14 years agoMerge branch 'stable-2.1' into devel-2.1
Iustin Pop [Wed, 16 Dec 2009 14:10:04 +0000 (15:10 +0100)]
Merge branch 'stable-2.1' into devel-2.1

* stable-2.1:
  Bump version to 2.1.0~rc2
  Update NEWS file and release Ganeti 2.0.5
  Security issue: add validation of script names
  Move the hooks file mask into constants.py
  Improve LUQueryNodes for lockless case
  Ship rapi.rst/rapi.html in the dist archive

14 years agoBump version to 2.1.0~rc2 v2.1.0rc2
Iustin Pop [Wed, 16 Dec 2009 14:07:58 +0000 (15:07 +0100)]
Bump version to 2.1.0~rc2

14 years agoMerge branch 'stable-2.0' into stable-2.1
Iustin Pop [Wed, 16 Dec 2009 13:51:41 +0000 (14:51 +0100)]
Merge branch 'stable-2.0' into stable-2.1

* stable-2.0:
  Update NEWS file and release Ganeti 2.0.5
  Security issue: add validation of script names
  Move the hooks file mask into constants.py
  Improve LUQueryNodes for lockless case
  Ship rapi.rst/rapi.html in the dist archive

Conflicts:
Makefile.am    (reverted, not needed)
NEWS           (simple fix for RST-ification)
configure.ac   (reverted, not needed)
lib/backend.py (adapted to new RPC result style)

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

14 years agoUpdate NEWS file and release Ganeti 2.0.5 v2.0.5
Iustin Pop [Wed, 16 Dec 2009 13:20:48 +0000 (14:20 +0100)]
Update NEWS file and release Ganeti 2.0.5

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

14 years agoDoc updates for --no-name-check
Iustin Pop [Mon, 14 Dec 2009 16:56:57 +0000 (17:56 +0100)]
Doc updates for --no-name-check

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

14 years agoburnin: add --no-name-check support
Iustin Pop [Mon, 14 Dec 2009 17:07:05 +0000 (18:07 +0100)]
burnin: add --no-name-check support

This patch modifies burnin to accept the --no-name-check option and also
adds --no-ip-check (which was always set to True before).

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

14 years agoCreateInstance: allow no ip check with start mode
Iustin Pop [Mon, 14 Dec 2009 16:54:58 +0000 (17:54 +0100)]
CreateInstance: allow no ip check with start mode

Since gnt-instance start doesn't do any checks on the IP, it doesn't
make much sense to do so in instance create (with start) if the user
expressly passes in ‘--no-ip-check’. Removing this requirement eases the
no-name-check mode (otherwise one would have to create --no-start and
then only start).

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

14 years agoCommand line/RAPI support for --no-name-check
Iustin Pop [Mon, 14 Dec 2009 16:51:31 +0000 (17:51 +0100)]
Command line/RAPI support for --no-name-check

This patch adds --no-name-check to gnt-instance add and gnt-backup
import. This is opposite to the opcode parameter (name_check) as it is
similar to ip_check and start.

It also adds it to RAPI and gnt-instance batch-create as a parameter in
the input (JSON-formatted) file.

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

14 years agoOp/LUCreateInstance support for (no) name checks
Iustin Pop [Mon, 14 Dec 2009 16:48:53 +0000 (17:48 +0100)]
Op/LUCreateInstance support for (no) name checks

This adds a new opcode parameter ‘name_check’ (similar to ip_check) that
is not required to be present (to easy backwards compatibility for
tools).

It also adds a CheckArguments to LUCreateInstance and changes the
workflow related to instance IP checks and NIC initialisation based on
it.

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

14 years agoPass --fqdn to ssh hostname checks
Iustin Pop [Mon, 14 Dec 2009 17:14:31 +0000 (18:14 +0100)]
Pass --fqdn to ssh hostname checks

The cluster verify checks for fqdn are done via address lookups, and
there we actually use the FQDN. However, for the ssh hostname check
which is done at node add time, we rely on the default of the “hostname”
command. And Debian for example recently changed the default to return
the shortname unless one passes ‘--fqdn’.

This patch is imported from the Debian packaging.

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

14 years agoSecurity issue: add validation of script names
Iustin Pop [Tue, 1 Dec 2009 14:08:29 +0000 (15:08 +0100)]
Security issue: add validation of script names

This patch unifies the search for external script to always go through
utils.FindFile and implements in that function a restriction on valid
chars in file names and (additionally) that the passed name is the
basename of the final (absolute) name.

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

14 years agoMove the hooks file mask into constants.py
Iustin Pop [Tue, 1 Dec 2009 13:02:12 +0000 (14:02 +0100)]
Move the hooks file mask into constants.py

This will allow reuse of the same mask for multiple validations.

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

14 years agoImprove LUQueryNodes for lockless case
Iustin Pop [Mon, 14 Dec 2009 15:26:48 +0000 (16:26 +0100)]
Improve LUQueryNodes for lockless case

In most uses of LUQueryNodes, we don't take a lock. This means that the
instance data is not protected across GetInstanceList and
GetInstanceInfo, and this can lead to instances not existing anymore.

Switching to GetAllInstanceInfo means that we get a single,
semi-consistent snapshot (since instances can still be modified, but
it's much better).

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

14 years agoAdd disk cache control parameter for KVM
Iustin Pop [Wed, 25 Nov 2009 10:04:56 +0000 (11:04 +0100)]
Add disk cache control parameter for KVM

This patch adds the 'cache' parameter for KVM; currently this is only
customisable at the hypervisor level, so it's the same for all drives
(except any CDROM image, which gets the default).

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

14 years agoChange pyinotify import for broader compatibility
Guido Trotter [Thu, 10 Dec 2009 13:46:48 +0000 (13:46 +0000)]
Change pyinotify import for broader compatibility

On some distributions pyinotify is installed in a different way, and the
actual module just contains an internal pyinotify entry, which is the
actual library. On others the main pyinotify module contains the library
itself. We'll try both, in order to be more compatible.

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

14 years agoShip rapi.rst/rapi.html in the dist archive
Iustin Pop [Fri, 4 Dec 2009 20:04:45 +0000 (21:04 +0100)]
Ship rapi.rst/rapi.html in the dist archive

Patch 4352bf6 changed RAPI docs to RST from the previous SGML format
(the last file to be converted to RST).

However, it didn't add rapi.rst to the docrst Makefile variable, and as
such rapi.html was neither build nor shipped in the archive. We fix this
and we also distribute doc/rapi-resources.gen since otherwise “make
distcheck” has issues (since this file is built and thus lives in _built
whereas rapi.rst is shipped and lives in topsrcdir).

Note: yes, this means that no 2.0 release until now had a rapi.html file
(in the .tar.gz archive).

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

14 years agoClusterMasterQuery: add primary ip field
Guido Trotter [Wed, 2 Dec 2009 14:01:08 +0000 (15:01 +0100)]
ClusterMasterQuery: add primary ip field

By allowing also the primary ip field to be fetched directly, we avoid
one more confd lookup, or dns request, to find out which address the
master node lives at.

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

14 years agoconfd ClusterMasterQuery: allow fields request
Guido Trotter [Wed, 2 Dec 2009 12:51:58 +0000 (13:51 +0100)]
confd ClusterMasterQuery: allow fields request

Change the ClusterMasterQuery to allow a query, and if present accept a
list of fields to be returned. Currently only name and ip are accepted.

This feature will be used by NLD to route the cluster ip over the nbma.

Backwards compatibility is preserved.

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

14 years agoSimplify utils.ReadFile
Iustin Pop [Tue, 1 Dec 2009 09:17:46 +0000 (10:17 +0100)]
Simplify utils.ReadFile

The documentation for file objects' read method states that if the size
is "negative or ommitted", all data is read; thus we can simplify it to
have size=-1 by default and not have the if test.

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

14 years agoDRBD: ignore unreadable meta devices
Iustin Pop [Fri, 27 Nov 2009 14:25:00 +0000 (15:25 +0100)]
DRBD: ignore unreadable meta devices

The DRBD driver can ignore dead disks but not dead meta devices (for
which it refuses to configure the minor). To handle this case, we check
that the meta device is readable and if not we ignore it (the same as
when backend._RecursiveAssembleBD didn't find it).

A needed change is the move of some checks and initialisers before this
test (which is before the super().__init__ call), but that should be
fine.

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

14 years agognt-cluster verify: Warn if node time diverges too far
Michael Hanselmann [Mon, 30 Nov 2009 13:09:28 +0000 (14:09 +0100)]
gnt-cluster verify: Warn if node time diverges too far

The warning will be generated if the clocks diverge by more
than 150 seconds. Due to the way the RPC system works, we
cannot get exact time differences, e.g. if one of the
queried nodes is broken. The comparision is done using a
time window.

Confd queries will fail if the clock on the client and server
are more than 300 seconds from each other. This check helps
keeping at least the nodes of a cluster in sync.

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

14 years agoKVM: fail when a routed nic has no ip
Guido Trotter [Thu, 26 Nov 2009 16:37:02 +0000 (17:37 +0100)]
KVM: fail when a routed nic has no ip

This shouldn't happen, but if it does it's better to fail at this level,
rather than create a broken NIC script, which is hard to debug.

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

14 years agoEnable batch mode for devel/upload
Iustin Pop [Thu, 26 Nov 2009 16:11:36 +0000 (17:11 +0100)]
Enable batch mode for devel/upload

Since the rsync/ssh calls are done in parallel, they can't read properly a
password or confirmation about keys from stdin. As such, it's better to enable
batch mode so that they fail right away instead of prompting and then timing
out after a long while.

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

14 years agocmdlib: Work around race condition in DRBD before version 8.0.13
Michael Hanselmann [Thu, 26 Nov 2009 15:17:42 +0000 (16:17 +0100)]
cmdlib: Work around race condition in DRBD before version 8.0.13

DRBD goes into sync mode for a short amount of time after
executing the "resize" command. DRBD 8.x below version
8.0.13 contains a bug whereby calling "resize" in sync
mode fails.

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

14 years agoBump version to 2.1.0~rc1 v2.1.0rc1
Michael Hanselmann [Wed, 25 Nov 2009 14:23:43 +0000 (15:23 +0100)]
Bump version to 2.1.0~rc1

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

14 years agoRemove testJsonIndent unittest
Michael Hanselmann [Wed, 25 Nov 2009 14:24:57 +0000 (15:24 +0100)]
Remove testJsonIndent unittest

It can't work on older distributions where simplejson
doesn't have indentation support.

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

14 years agoQA: improve usability with cluster-init: False
Iustin Pop [Wed, 25 Nov 2009 14:26:16 +0000 (15:26 +0100)]
QA: improve usability with cluster-init: False

When not initialising the cluster, consider all nodes are added, so that
multi-node tests (e.g. export, replace) work correctly (if there are
nodes, of course).

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

14 years agoRemove quotes from CommaJoin and convert to it
Iustin Pop [Wed, 25 Nov 2009 12:01:05 +0000 (13:01 +0100)]
Remove quotes from CommaJoin and convert to it

This patch removes the quotes from CommaJoin and converts most of the
callers (that I could find) to it. Since CommaJoin does str(i) for i in
param, we can remove these, thus simplifying slightly a few calls.

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

14 years agoRe-add “nic.bridges” field to RAPI bulk instance list
Michael Hanselmann [Wed, 25 Nov 2009 11:27:22 +0000 (12:27 +0100)]
Re-add “nic.bridges” field to RAPI bulk instance list

Commit 495cfdf0 removed “nic.bridges” from the default
list for bulk instance list RAPI requests.

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

14 years agobuild-bash-completion: Check for None before comparing
Michael Hanselmann [Wed, 25 Nov 2009 11:19:58 +0000 (12:19 +0100)]
build-bash-completion: Check for None before comparing

Comparing a number with None is not a good idea:

  >>> (0 < None, 0 > None)
  (False, True)

This patch also adds build-bash-completion to the list
of checked Python scripts and wraps one line of more
than 80 characters.

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

14 years agoRevert "Get rid of utils.CommaJoin"
Iustin Pop [Wed, 25 Nov 2009 11:26:20 +0000 (12:26 +0100)]
Revert "Get rid of utils.CommaJoin"

This reverts commit 6915bc28fe053e92aa16cf2d974d205f1140219c based on thread on
ganeti-devel.

Conflicts:

lib/cmdlib.py (due to the error code classification, trivial)

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

14 years agoAdd check for OpenSSL entropy status
Michael Hanselmann [Tue, 24 Nov 2009 14:55:03 +0000 (15:55 +0100)]
Add check for OpenSSL entropy status

By checking for this explicitly, the errors (SSLEAY_RAND_BYTES, “PRNG
not seeded”) will happen in the start-up phase of the daemon and not
only when executing remote procedure calls.

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

14 years agoA couple of doc updates
Iustin Pop [Tue, 24 Nov 2009 09:57:35 +0000 (10:57 +0100)]
A couple of doc updates

Clarify the fact that temporary HV/BE params in instance start override
and do not extend the configured parameters; and change the instance
list headers from HVM_* to * since many of the parameters apply to KVM
too. Also fix a typo in the rapi documention for '/2/nodes'.

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

14 years agoHandle EEXIST in utils.RenameFile
Michael Hanselmann [Thu, 19 Nov 2009 15:13:12 +0000 (16:13 +0100)]
Handle EEXIST in utils.RenameFile

This should fix an issue I've seen exactly once during testing. It might have
been caused by parallel RPC calls to archive jobs.

[…] ganeti-noded:112 ERROR Error in RPC call […]
 File "/usr/lib/python2.4/site-packages/ganeti/backend.py", line 2365, in JobQueueRename
   utils.RenameFile(old, new, mkdir=True)
 File "/usr/lib/python2.4/site-packages/ganeti/utils.py", line 322, in RenameFile
   os.makedirs(os.path.dirname(new), mkdir_mode)
 File "/usr/lib/python2.4/os.py", line 159, in makedirs
   mkdir(name, mode)
OSError: [Errno 17] File exists: '/var/lib/ganeti/queue/archive/0'

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

14 years agoRemove unused parameter “unlock” from cmdlib._WaitForSync
Michael Hanselmann [Thu, 19 Nov 2009 16:30:03 +0000 (17:30 +0100)]
Remove unused parameter “unlock” from cmdlib._WaitForSync

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

14 years agoFix off-by-one error when modifying instance NIC
Michael Hanselmann [Mon, 16 Nov 2009 14:52:53 +0000 (15:52 +0100)]
Fix off-by-one error when modifying instance NIC

For an instance with exactly one NIC:

$ gnt-instance modify --net 1:ip=1.2.3.4 inst1
Failure: prerequisites not met for this operation:
error type: wrong_input, error details:
Invalid NIC index 1, valid values are 0 to 1

For an instance with no NIC at all, it fails with “Invalid NIC index 0, valid
values are 0 to 0”. This is fixed by this patch.

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

14 years agoRe-add check for duplicate instance IP
Michael Hanselmann [Mon, 16 Nov 2009 13:51:29 +0000 (14:51 +0100)]
Re-add check for duplicate instance IP

This was originally implemented in 0ce8f948 and partially
rolled back in 9b65e0d4. Apart from re-adding the check,
this patch does some housekeeping by renaming the “_helper”
function to “_AddIpAddress”.

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

14 years agoFix gnt-instance list documentation
Guido Trotter [Mon, 16 Nov 2009 11:02:13 +0000 (11:02 +0000)]
Fix gnt-instance list documentation

(1) Both the man page and the online help report the link and mode
fields, which are in the code called nic_link and nic_mode.
(2) Add missing fields to the online help.

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

14 years agoconfig: Style fixes
Michael Hanselmann [Fri, 13 Nov 2009 12:53:06 +0000 (13:53 +0100)]
config: Style fixes

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

14 years agoAdd packaging notes to documentation
Michael Hanselmann [Thu, 12 Nov 2009 16:38:40 +0000 (17:38 +0100)]
Add packaging notes to documentation

This includes a few paragraphs about daemon-util.

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

14 years agoFix epydoc error
Michael Hanselmann [Thu, 12 Nov 2009 15:03:35 +0000 (16:03 +0100)]
Fix epydoc error

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

14 years agosphinx: Treat warnings as errors
Michael Hanselmann [Thu, 12 Nov 2009 14:40:43 +0000 (15:40 +0100)]
sphinx: Treat warnings as errors

This makes it easier to catch warnings.

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

14 years agoInclude INSTALL in documentation
Michael Hanselmann [Thu, 12 Nov 2009 14:40:05 +0000 (15:40 +0100)]
Include INSTALL in documentation

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

14 years agoConvert INSTALL to RST
Michael Hanselmann [Wed, 11 Nov 2009 17:10:23 +0000 (18:10 +0100)]
Convert INSTALL to RST

This is in preparation to including it into the large
documentation.

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

14 years agoFix change of cluster nic parameters
Guido Trotter [Thu, 12 Nov 2009 16:35:14 +0000 (16:35 +0000)]
Fix change of cluster nic parameters

To stay on the safe side, we check for errors in all instances, and
refuse to act, reporting on the errors we found, if there are any
problems.

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

14 years agoNIC.CheckParameterSyntax: fix bridged check
Guido Trotter [Thu, 12 Nov 2009 17:08:25 +0000 (17:08 +0000)]
NIC.CheckParameterSyntax: fix bridged check

We should match for the strings to be the same "==" not to point to the
same memory location with is, or we skip the actual check.

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

14 years agoFix mispopulation of nic parameters at nic modify
Guido Trotter [Thu, 12 Nov 2009 15:44:51 +0000 (15:44 +0000)]
Fix mispopulation of nic parameters at nic modify

There's a bug in Ganeti 2.1 rc0 that makes nic parameters be populated
from the "filled in" dict, even if we're not changing any values in
them. This patch fixes the problem, by populating them from the correct
(unfilled) dict.

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

14 years agoBump version to 2.1.0~rc0 v2.1.0rc0
Michael Hanselmann [Wed, 11 Nov 2009 15:01:40 +0000 (16:01 +0100)]
Bump version to 2.1.0~rc0

Also add one item to NEWS.

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

14 years agoUpdate RAPI documentation on job results
Iustin Pop [Wed, 11 Nov 2009 13:55:21 +0000 (14:55 +0100)]
Update RAPI documentation on job results

This documents the new error classifier added for OpPrereqError.

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

14 years agoRevert "Backport AC_PATH_PROGS_FEATURE_CHECK"
Michael Hanselmann [Wed, 11 Nov 2009 13:02:16 +0000 (14:02 +0100)]
Revert "Backport AC_PATH_PROGS_FEATURE_CHECK"

This reverts commit 52b699ecaa688a2aaac00fa64558e249d0bc9a26.

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

14 years agoFix and simplify socat escape detection
Michael Hanselmann [Wed, 11 Nov 2009 13:00:17 +0000 (14:00 +0100)]
Fix and simplify socat escape detection

- Program paths should not be --with-… options (see
  Autoconf docs)
- Simplify checks for escape functionality
- Make SOCAT_USE_ESCAPE variable a bool

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

14 years agoUse “daemon-util” to reload SSH keys
Michael Hanselmann [Thu, 5 Nov 2009 11:21:48 +0000 (12:21 +0100)]
Use “daemon-util” to reload SSH keys

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

14 years agoKVMHypervisor: fix broken error format string
Guido Trotter [Sun, 8 Nov 2009 13:17:11 +0000 (13:17 +0000)]
KVMHypervisor: fix broken error format string

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

14 years agoConfigWriter: simplify GenerateDRBDSecret
Guido Trotter [Tue, 27 Oct 2009 21:19:11 +0000 (17:19 -0400)]
ConfigWriter: simplify GenerateDRBDSecret

We can do this by adding a new TemporaryReservationManager

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

14 years agoConfigWriter: move _temporary_macs to reservation
Guido Trotter [Tue, 27 Oct 2009 20:08:19 +0000 (16:08 -0400)]
ConfigWriter: move _temporary_macs to reservation

This solves the race conditions in mac reservation, as macs are actually
reserved, under the current ec id.

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

14 years agoConfigWriter: move _temporary_ids to reservation
Guido Trotter [Tue, 27 Oct 2009 19:27:44 +0000 (15:27 -0400)]
ConfigWriter: move _temporary_ids to reservation

In order to do this we need to pass a job id when reserving a resource.
We have one during _EnsureUUIDs because we passed it in from AddNode and
AddInstance. During config upgrade we use a fake job ID which we then
cleanup. We can delete the _CleanupTemporaryIDs code, since the cleanup
is going to be done at job finish time by mcpu.

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

14 years agoTemporaryReservationManager
Guido Trotter [Tue, 27 Oct 2009 19:42:37 +0000 (15:42 -0400)]
TemporaryReservationManager

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

14 years agoconfig.Add{Node,Instance}: get the ec id
Guido Trotter [Tue, 27 Oct 2009 18:09:07 +0000 (14:09 -0400)]
config.Add{Node,Instance}: get the ec id

This is ok because adding a node or instance cannot happen in a query.

We get the ec id from the LU and pass it to _EnsureUUID, which will
then for now not use it.

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

14 years agoAdd config.DropECReservations
Guido Trotter [Tue, 27 Oct 2009 17:53:03 +0000 (13:53 -0400)]
Add config.DropECReservations

For now this function does nothing, but it gets called by mcpu when the
execution of an LU is done, making sure any pending reservations are
dropped.

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

14 years agoProcessor: support a unique execution id
Guido Trotter [Tue, 27 Oct 2009 15:47:49 +0000 (11:47 -0400)]
Processor: support a unique execution id

When the processor is executing a job, it can export the execution id to
its callers. This is not supported for Queries, as they're not executed
in a job.

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

14 years agoRemove exceptions list from GenerateUniqueID
Guido Trotter [Tue, 27 Oct 2009 17:25:55 +0000 (13:25 -0400)]
Remove exceptions list from GenerateUniqueID

It's not used anywhere, so it's dead code.

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

14 years agoAdd errors.ReservationError
Guido Trotter [Tue, 27 Oct 2009 21:17:36 +0000 (17:17 -0400)]
Add errors.ReservationError

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

14 years agoFix pylint 'E' (error) codes
Iustin Pop [Wed, 4 Nov 2009 13:09:53 +0000 (14:09 +0100)]
Fix pylint 'E' (error) codes

This patch adds some silences and tweaks the code slightly so that
“pylint --rcfile pylintrc -e ganeti” doesn't give any errors.

The biggest change is in jqueue.py, the move of _RequireOpenQueue out of
the JobQueue class. Since that is actually a function and not a method
(never used as such) this makes sense, and also silences two pylint
errors.

Another real code change is in utils.py, where FieldSet.Matches will
return None instead of False for failure; this still works with the way
this class/method is used, and makes more sense (it resembles more
closely the re.match return values).

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

14 years agoA few more small documentation updates
Iustin Pop [Fri, 6 Nov 2009 12:21:51 +0000 (13:21 +0100)]
A few more small documentation updates

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

14 years agoRemove obsolete statement in autogen.sh
Iustin Pop [Fri, 6 Nov 2009 12:53:31 +0000 (13:53 +0100)]
Remove obsolete statement in autogen.sh

Nowadays we have actual files (tracket by VCS) in autotools/, so we know
the directory exists.

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

14 years agoAdd use_localtime parameter for xen-hvm and kvm
Jun Futagawa [Thu, 5 Nov 2009 04:22:00 +0000 (13:22 +0900)]
Add use_localtime parameter for xen-hvm and kvm

Currently xen-hvm and kvm use different real time clock by default. To
reduce confusion, this patch adds an optional use_localtime parameter.

If the real time clock on the instance is set to local time, the
parameter use_localtime should be True. The default is False. Note that
the real time clock changes from local to UTC in xen-hvm with the
default parameter.

Signed-off-by: Jun Futagawa <jfut@integ.jp>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

14 years agoDocumentation updates for the global hvparams
Iustin Pop [Wed, 4 Nov 2009 17:06:48 +0000 (18:06 +0100)]
Documentation updates for the global hvparams

This patch does multiple documentation updates for the new framework,
all pretty straightforward.

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

14 years agoRemove the KVM_MIGRATION_PORT configure.ac param
Iustin Pop [Wed, 4 Nov 2009 16:49:39 +0000 (17:49 +0100)]
Remove the KVM_MIGRATION_PORT configure.ac param

Since this is easily configurable at run-time, we remove the
configure-time parameter. If anyone is building custom packages, then
the default can be tweaked by a one-line patch to constants.py.

Note that this also fixes the type of parameter, the default from
_autoconf.py is a string parameter. Shouldn't matter except if a cluster
run code between commit 78411c6 and this one.

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

14 years agoIntroduce 'global hypervisor parameters' support
Iustin Pop [Wed, 4 Nov 2009 16:41:04 +0000 (17:41 +0100)]
Introduce 'global hypervisor parameters' support

This patch adds support for global hypervisor parameters in instance
creation, instance modification, instance query and at instance load
time.

We basically prevent any query on these parameters, discard them at load
time, and do not allow their modification. Together, this should make
any such parameters go away if existing and not allowed to be added.

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

14 years agoFix the init script
Iustin Pop [Fri, 6 Nov 2009 10:55:49 +0000 (11:55 +0100)]
Fix the init script

The rewrite after the introduction of the daemon-util script has a
copy-paste error.

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

14 years agognt-*: Print better error message for uninitialized cluster
Michael Hanselmann [Thu, 5 Nov 2009 13:30:33 +0000 (14:30 +0100)]
gnt-*: Print better error message for uninitialized cluster

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

14 years agoCache JSON encoders and sort keys
Michael Hanselmann [Thu, 5 Nov 2009 12:31:21 +0000 (13:31 +0100)]
Cache JSON encoders and sort keys

The sort_keys argument is supported since simplejson 1.3.

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

14 years agoAdd new “daemon-util” script to start/stop Ganeti daemons
Michael Hanselmann [Tue, 3 Nov 2009 13:42:51 +0000 (14:42 +0100)]
Add new “daemon-util” script to start/stop Ganeti daemons

Until now, Ganeti started and stopped its own daemons using custom functions.
To start, the daemon was just executed and then sent the appropriate signals to
stop it again. Init scripts would have to pay attention to the PID file and
other things.

With this patch, a new script is added (“daemon-util”, installed in
$prefix/lib/ganeti/), centralizing the starting and stopping of daemons. The
provided example init script is adjusted to use this new script. Ganeti's code
no longer calls its own init script.

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

14 years agokvm console: use socat raw mode with escape
Guido Trotter [Thu, 29 Oct 2009 20:58:50 +0000 (16:58 -0400)]
kvm console: use socat raw mode with escape

If this is enabled at configure time, we pass in different parameters to
the socat console, making it a lot more manageable.

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

14 years agoconfigure: check for socat and its escape feature
Guido Trotter [Sat, 31 Oct 2009 21:38:08 +0000 (17:38 -0400)]
configure: check for socat and its escape feature

Currently we use a static value for the socat path, or we trust the
user-provided one. With this patch we still trust any user provided
value, but if none is passed we check for socat on the machine we're
being configured on. This allows us also to check if we can or cannot
use the escape= feature in socat.

If the user has forced the path in, he can also pass --with-socat-escape
in order to force the escape functionality to be used, even if a check
is not done.

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

14 years agoBackport AC_PATH_PROGS_FEATURE_CHECK
Guido Trotter [Tue, 3 Nov 2009 14:37:51 +0000 (09:37 -0500)]
Backport AC_PATH_PROGS_FEATURE_CHECK

In order to allow working with older versions of autoconf we backport
this macro, but only if it's not defined already (by autoconf itself).

This commit can be reverted after we decide support for autoconf 2.61
and below should be deprecated.

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

14 years agoMigration: add check for listening target
Iustin Pop [Wed, 4 Nov 2009 13:21:55 +0000 (14:21 +0100)]
Migration: add check for listening target

This patch adds a check for listening on the remote port in Xen and KVM
migrations. This will be generating a single “load of migration failed”
message for KVM, but otherwise not prevent the migration. For Xen (which
has a dedicated, always listening daemon) this should not create any
problems.

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

14 years agoTLMigrateInstance: add error messagess during Exec
Iustin Pop [Wed, 4 Nov 2009 12:08:43 +0000 (13:08 +0100)]
TLMigrateInstance: add error messagess during Exec

Currently the migration of an instance doesn't show any error until the
end. We add two messages that show better the progress:

node1# gnt-instance migrate -f instance5
Wed Nov  4 04:04:34 2009 Migrating instance instance5
Wed Nov  4 04:04:34 2009 * checking disk consistency between source and target
Wed Nov  4 04:04:35 2009 * switching node node3 to secondary mode
Wed Nov  4 04:04:35 2009 * changing into standalone mode
Wed Nov  4 04:04:35 2009 * changing disks into dual-master mode
Wed Nov  4 04:04:40 2009 * wait until resync is done
Wed Nov  4 04:04:41 2009 * preparing node3 to accept the instance
Wed Nov  4 04:04:41 2009 * migrating instance to node3
Wed Nov  4 04:04:51 2009 Migration failed, aborting
Wed Nov  4 04:04:51 2009 * switching node node3 to secondary mode
Wed Nov  4 04:04:51 2009 * changing into standalone mode
Wed Nov  4 04:04:51 2009 * changing disks into single-master mode
Wed Nov  4 04:04:57 2009 * wait until resync is done
Failure: command execution error:
Could not migrate instance instance5: Failed to migrate instance: Failed
to migrate instance instance5: …

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

14 years agohypervisors: switch to using HV_MIGRATION_PORT
Iustin Pop [Wed, 4 Nov 2009 11:48:10 +0000 (12:48 +0100)]
hypervisors: switch to using HV_MIGRATION_PORT

This changes KVM to use HV_MIGRATION_PORT instead of KVM_MIGRATION_PORT
and enables passing the port for Xen migrations.

Since KVM_MIGRATION_PORT is not used anymore, we stop exporting it from
constants.py.

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

14 years agoIntroduce HV_MIGRATION_PORT hypervisor parameter
Iustin Pop [Wed, 4 Nov 2009 11:29:15 +0000 (12:29 +0100)]
Introduce HV_MIGRATION_PORT hypervisor parameter

This parameter will replace the direct use of KVM_MIGRATION_PORT and the
implicit use of the Xen migration port.

While it doesn't make sense to change this at instance level, we don't
have any other infrastructure for cluster-wide hypervisor parameters, so
we add it here (and document that it usually shouldn't be changed on a
per-instance basis).

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

14 years agohypervisors: change MigrateInstance API
Iustin Pop [Wed, 4 Nov 2009 10:10:32 +0000 (11:10 +0100)]
hypervisors: change MigrateInstance API

Currently the $hypervisor.MigrateInstance takes the instance name. This
patch changes it to take the instance object, such that other instance
properties (especially hvparams) are available to it.

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