ganeti-local
14 years agoMake stable release 2.1.0 v2.1.0
Iustin Pop [Tue, 2 Mar 2010 10:15:59 +0000 (11:15 +0100)]
Make stable release 2.1.0

It is about time (rc0 was almost four months ago)…

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

14 years agoAdd NLD constants to Ganeti
Guido Trotter [Fri, 26 Feb 2010 13:49:44 +0000 (14:49 +0100)]
Add NLD constants to Ganeti

This avoids the need for them to be injected in the nbma repository.

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

14 years agoFix two potentially endless loops in http library
Michael Hanselmann [Fri, 26 Feb 2010 12:32:11 +0000 (13:32 +0100)]
Fix two potentially endless loops in http library

The first can be problematic if poll(2) returns POLLHUP|POLLERR on a
socket. Before it would be only be respected for SOCKOP_RECV, but since
they can also occur on other socket operations, esp. in combination with
OpenSSL, letting the socket functions handle POLLHUP|POLLERR seems to be
the right thing.

The second is a typo leading to an endless loop if the first line of an
HTTP connection is empty (simply "\r\n"). Instead of removing the empty
line, it would remove anything after it.

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

14 years agoFix bug in LUQueryConfigValues
Michael Hanselmann [Fri, 26 Feb 2010 09:03:54 +0000 (10:03 +0100)]
Fix bug in LUQueryConfigValues

LUQueryConfigValues supports multiple output fields. If the client asked
for the watcher pause status, it would not get a list, but simply the
value.

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

14 years agoFix typo in LUVerifyCluster when checking node time
Michael Hanselmann [Tue, 23 Feb 2010 16:11:15 +0000 (17:11 +0100)]
Fix typo in LUVerifyCluster when checking node time

The first argument to _ErrorIf should always be True in this case.

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

14 years agoFix ssh host key checking with no-key-check
Iustin Pop [Thu, 18 Feb 2010 09:12:19 +0000 (10:12 +0100)]
Fix ssh host key checking with no-key-check

In case we add a node with “--no-ssh-key-check”, this should override
any default yes/ask values in the system-wide (or user) ssh key check.

Currently this only works in batch mode, whereas in non-batch we only
override a 'no'. The patch fixes SshRunner such that in non-batch mode
we enforce the value of StrictHostKeyChecking in all cases.

Bug found and initial investigation by Theo Van Dinter.

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

14 years agoFix bug introduced in commit 413b747
Michael Hanselmann [Wed, 10 Feb 2010 13:47:52 +0000 (14:47 +0100)]
Fix bug introduced in commit 413b747

While commit 413b747 fixed the issue of poll(2) returning too
soon, it didn't work when the poll(2) call should've been
blocking. This is now fixed and verified.

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

14 years agoFix locking bug causing high CPU usage
Michael Hanselmann [Wed, 10 Feb 2010 12:45:52 +0000 (13:45 +0100)]
Fix locking bug causing high CPU usage

Iustin Pop noticed unusually high CPU usage with 2.1's master
daemon, even with very simple opcodes like OP_TEST_DELAY. As
it turns out, we inadvertently passed seconds as milliseconds
to a call to poll(2). Due to the way the loop around the call
works it didn't break competely, but caused higher CPU usage
by the poll(2) call returning too early.

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

14 years agoFix confd procotol design description
Guido Trotter [Wed, 10 Feb 2010 09:15:04 +0000 (11:15 +0200)]
Fix confd procotol design description

The protocol design for confd was missing a description of the fourcc
code which we use to distinguish between different message types, if we
want to completely change the protocol. Adding them so that someone
implementing it can find out.

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

14 years agoImplement instance rename QA tests
Iustin Pop [Tue, 9 Feb 2010 09:30:40 +0000 (10:30 +0100)]
Implement instance rename QA tests

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

14 years agoFix "gnt-instance rename" functionality
Iustin Pop [Tue, 9 Feb 2010 09:15:51 +0000 (10:15 +0100)]
Fix "gnt-instance rename" functionality

Commit 91e0748c (Unify the “--no-ip-check” option) broke the options
variable name for ‘--no-ip-check’ but since we don't have a QA test for
instance rename (only burnin test), this was not caught until Issue 86
was opened.

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

14 years agoTLReplaceDisks: Delay iallocator when evacuating node
Michael Hanselmann [Thu, 4 Feb 2010 16:32:21 +0000 (17:32 +0100)]
TLReplaceDisks: Delay iallocator when evacuating node

When evacuating nodes, the iallocator was run for all
instances without taking planned changes into consideration.
This patch delays part of CheckPrereq and running the
iallocator for node evacuation.

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

14 years agoImplement debug level across OS-related RPC calls
Iustin Pop [Wed, 3 Feb 2010 13:24:42 +0000 (14:24 +0100)]
Implement debug level across OS-related RPC calls

This doesn't implement the full functionality, we need to add the debug
level to the opcodes too, but at least won't require changing the RPC
calls during the 2.1 series.

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

14 years agoSecond try to fix LUVerifyCluster
Michael Hanselmann [Wed, 3 Feb 2010 13:24:53 +0000 (14:24 +0100)]
Second try to fix LUVerifyCluster

My previous patch, commit 785d142, fixed the case where a node is marked
offline. With this patch it'll also handle other failures correctly.

 * Hooks Results
   - ERROR: node node2.example.com: Communication failure in hooks
   execution: Connection failed (111: Connection refused)

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

14 years agoLUVerifyCluster: Fix bug with offline nodes
Michael Hanselmann [Wed, 3 Feb 2010 12:50:49 +0000 (13:50 +0100)]
LUVerifyCluster: Fix bug with offline nodes

[…]
 * Other Notes
   - NOTICE: 1 offline node(s) found.
 * Hooks Results
Failure: command execution error:
iteration over non-sequence

Commit a0c9776a introduced an error simulation mode to LUVerifyCluster.
Due to a small mistake, offline nodes weren't skipped when checking the
results of verification hooks and iterating over None raises an
“iteration over non-sequence” error.

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

14 years agoutils: Fix retry delay calculator
Michael Hanselmann [Wed, 3 Feb 2010 12:18:01 +0000 (13:18 +0100)]
utils: Fix retry delay calculator

Before this patch, it would always sleep for at least
the time specified as the upper limit. Now it actually
limits the sleep time.

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

14 years agoBump RPC protocol version to 30
Michael Hanselmann [Mon, 1 Feb 2010 14:52:57 +0000 (15:52 +0100)]
Bump RPC protocol version to 30

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

14 years agoBump version to 2.1.0~rc5 v2.1.0rc5
Michael Hanselmann [Mon, 1 Feb 2010 12:21:10 +0000 (13:21 +0100)]
Bump version to 2.1.0~rc5

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

14 years agoFix missing bridge for xen instances
Alessandro Cincaglini [Fri, 29 Jan 2010 11:47:45 +0000 (11:47 +0000)]
Fix missing bridge for xen instances

Xen instances nic definitions miss the target bridge.

This bug was introduced in commit 503b97a9.

Signed-off-by: Alessandro Cincaglini <alessandro.ciancaglini@gmail.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Signed-off-by: Guido Trotter <ultrotter@google.com>

14 years agoFix flipping MC flag bug
Guido Trotter [Thu, 28 Jan 2010 14:40:44 +0000 (14:40 +0000)]
Fix flipping MC flag bug

Currently unofflining or undraining an already functional master
candidate node, can cause it to demote itself. In order to avoid that we
only trigger the self-promotion check if the node is not currently a
candidate.

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

14 years agoganeti-watcher: ensure confd is running as well
Guido Trotter [Thu, 28 Jan 2010 11:34:50 +0000 (11:34 +0000)]
ganeti-watcher: ensure confd is running as well

Ganeti-confd should be running on all 2.1 nodes.

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

14 years agoBump version to 2.1.0~rc4 v2.1.0rc4
Michael Hanselmann [Fri, 22 Jan 2010 15:56:54 +0000 (16:56 +0100)]
Bump version to 2.1.0~rc4

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

14 years agoKVM: fix pylint warning
Guido Trotter [Fri, 22 Jan 2010 13:45:58 +0000 (14:45 +0100)]
KVM: fix pylint warning

Specify string format arguments as logging function parameters

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

14 years agoKVM: be more resilient on broken migration answers
Guido Trotter [Fri, 22 Jan 2010 11:37:24 +0000 (12:37 +0100)]
KVM: be more resilient on broken migration answers

Before, when doing kvm live migrations we use to accept an "unknown
status" but to reject anything that didn't match our regexp. Since we've
seen "info migrate" return a completely empty answer, we'll be more
tolerant of completely unknown results (while still logging them) and at
the same time we'll limit the number of them which we're willing to
accept in a row.

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

14 years agoAdd unittests for cli.GenerateTable
Michael Hanselmann [Wed, 20 Jan 2010 12:42:41 +0000 (13:42 +0100)]
Add unittests for cli.GenerateTable

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

14 years agocli: Fix bug when not using headers
Michael Hanselmann [Wed, 20 Jan 2010 12:41:21 +0000 (13:41 +0100)]
cli: Fix bug when not using headers

Commit 9fe72672 added code to not write spaces at the end of each line.
Unfortunately it didn't work properly when not printing headers—there would
still be spaces.

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

14 years agodaemon-util: Fix quoting issue
Michael Hanselmann [Tue, 19 Jan 2010 16:02:32 +0000 (17:02 +0100)]
daemon-util: Fix quoting issue

This patch fixes a quoting issue in daemon-util:

$ EXTRA_MASTERD_ARGS=--no-voting /etc/init.d/ganeti restart
[…]
* ganeti-masterd...
/…/ganeti/daemon-util: line 65: local: `--no-voting': not a valid identifier

The reason was that the generated variables were not quoted properly and
the troublesome line expanded to
“local args=$MASTERD_ARGS $EXTRA_MASTERD_ARGS” instead of the correct
“local args="$MASTERD_ARGS $EXTRA_MASTERD_ARGS"”.

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

14 years agoBump version to 2.1.0~rc3 v2.1.0rc3
Michael Hanselmann [Wed, 13 Jan 2010 15:45:14 +0000 (16:45 +0100)]
Bump version to 2.1.0~rc3

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

14 years agoFix long-standing race condition bug in locking unittest
Michael Hanselmann [Thu, 14 Jan 2010 16:57:52 +0000 (17:57 +0100)]
Fix long-standing race condition bug in locking unittest

Every once in a while we saw failures in the locking unittest, but
weren't able to determine the cause. This patch fixes it by using
threading.Event instead of plain threading.Condition to notify another
thread. In most cases, threading.Condition must be used with another
variable to keep the actual state.  threading.Event does this for us.
Otherwise it can happen that the waiter only gets the lock after
condition was notified.

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

14 years agoconfd client: copy the peers in UpdatePeerList
Guido Trotter [Thu, 14 Jan 2010 15:53:54 +0000 (15:53 +0000)]
confd client: copy the peers in UpdatePeerList

Since the peer list is shuffled by the client, we don't keep a reference
to the list which was passed in, but copy it internally.

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

14 years agotestutils: Print name of test program before running it
Michael Hanselmann [Thu, 14 Jan 2010 10:13:12 +0000 (11:13 +0100)]
testutils: Print name of test program before running it

While the name can be looked up in Makefile.am, this
is useful when an automated test just hangs and needs
to be killed.

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

14 years agoDon't use hardcoded name for pylint
Michael Hanselmann [Thu, 14 Jan 2010 09:56:43 +0000 (10:56 +0100)]
Don't use hardcoded name for pylint

Look it up at configure time instead.

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

14 years agoPartially revert "Makefile.am: Run pylint on all Python code"
Michael Hanselmann [Thu, 14 Jan 2010 09:49:31 +0000 (10:49 +0100)]
Partially revert "Makefile.am: Run pylint on all Python code"

This partially reverts commit e4e7c7df3a2356103c2442a91d628ca0470fb267,
which made newer pylint versions fail.

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

14 years agobuild-bash-completion: Take care of pylint warnings
Michael Hanselmann [Thu, 14 Jan 2010 09:49:56 +0000 (10:49 +0100)]
build-bash-completion: Take care of pylint warnings

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

14 years agoMakefile.am: Run pylint on all Python code
Michael Hanselmann [Wed, 13 Jan 2010 16:38:28 +0000 (17:38 +0100)]
Makefile.am: Run pylint on all Python code

That is, all Python code except unittests. In particular,
autotool/build-bash-completion was missing from the
previous list.

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

14 years agoSmall improvements for release script
Michael Hanselmann [Wed, 13 Jan 2010 16:37:15 +0000 (17:37 +0100)]
Small improvements for release script

- Print usage if no tree-ish (tag, branch or commit) was
  specified.
- Use “gntrelease.XXXXXXXXXX” as temporary directory
  template. This makes it easier to find all of them.
- Compute MD5 checksum. This doesn't cost a lot and
  might come in handy one day.

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

14 years agocheck-python-code: Use “set -e” to abort on errors
Michael Hanselmann [Wed, 13 Jan 2010 16:34:57 +0000 (17:34 +0100)]
check-python-code: Use “set -e” to abort on errors

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

14 years agobuild-bash-completion: Fix a few pylint warnings
Michael Hanselmann [Wed, 13 Jan 2010 16:33:56 +0000 (17:33 +0100)]
build-bash-completion: Fix a few pylint warnings

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

14 years agoGenerate hmac file with a newline at the end
Guido Trotter [Wed, 13 Jan 2010 16:15:41 +0000 (16:15 +0000)]
Generate hmac file with a newline at the end

This makes it slightly easier to cut&paste its content.

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

14 years agojqueue: Don't return negative number for unchecked jobs when archiving
Michael Hanselmann [Wed, 13 Jan 2010 13:43:20 +0000 (14:43 +0100)]
jqueue: Don't return negative number for unchecked jobs when archiving

When the queue was empty, the calculation for unchecked jobs while
archiving would return -1. ``last_touched`` is set to 0, the job ID list
(``all_job_ids``) is empty. Calculating ``len(all_job_ids) -
last_touched - 1`` resulted in -1.

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

14 years agocli.GenerateTable: Don't write EOL spaces
Michael Hanselmann [Wed, 13 Jan 2010 11:34:54 +0000 (12:34 +0100)]
cli.GenerateTable: Don't write EOL spaces

With this change, there won't be unnecessary space characters
at the end of lines.

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

14 years agoImprove logging for workerpool tasks by providing __repr__
Michael Hanselmann [Wed, 13 Jan 2010 11:08:03 +0000 (12:08 +0100)]
Improve logging for workerpool tasks by providing __repr__

Before it would log something like “starting task
(<ganeti.http.client._HttpClientPendingRequest object at 0x2aaaad176790>,)”,
which isn't really useful for debugging. Now it'll log “[…]
<ganeti.http.client._HttpClientPendingRequest
req=<ganeti.http.client.HttpClientRequest 172.24.x.y:1811 PUT /node_info at
0x2aaaaab7ed10> at 0x2aaaaab823d0>”.

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

14 years agoworkerpool: Simplify log messages
Michael Hanselmann [Wed, 13 Jan 2010 10:56:16 +0000 (11:56 +0100)]
workerpool: Simplify log messages

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

14 years agoworkerpool: Use worker name as thread name
Michael Hanselmann [Wed, 13 Jan 2010 10:38:03 +0000 (11:38 +0100)]
workerpool: Use worker name as thread name

This way it shows up in debug logs.

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

14 years agoworkerpool: Make worker ID alphanumeric
Michael Hanselmann [Wed, 13 Jan 2010 10:37:44 +0000 (11:37 +0100)]
workerpool: Make worker ID alphanumeric

Having a proper name instead of just a number makes debugging
easier.

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

14 years agolocking: Fix race condition in LockSet
Michael Hanselmann [Wed, 13 Jan 2010 10:10:17 +0000 (11:10 +0100)]
locking: Fix race condition in LockSet

This patch fixes a race condition when acquiring all locks in
a LockSet instance. The list of lock names needs to be sorted
to guarantee a consistent locking order, but the names were not
sorted when acquiring all locks in the set.

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

14 years agomcpu: Log lock status with sorted names
Michael Hanselmann [Tue, 12 Jan 2010 14:13:05 +0000 (15:13 +0100)]
mcpu: Log lock status with sorted names

Reading and comparing sorted lists is easier when debugging locking problems.

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

14 years agolocking: Append to list outside error handling block
Michael Hanselmann [Tue, 12 Jan 2010 14:12:27 +0000 (15:12 +0100)]
locking: Append to list outside error handling block

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

14 years agolocking: Don't fail in error handling if lock isn't owned
Michael Hanselmann [Tue, 12 Jan 2010 14:11:40 +0000 (15:11 +0100)]
locking: Don't fail in error handling if lock isn't owned

In case an exception was thrown while acquiring the lock, not necessarily all
owned locks are also really acquired. Before this change, an exception could be
masked by another exception thrown here. There is no good clean-up strategy
when acquiring a lock fails with an exception in either case.

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

14 years agoProvide example default files and install one for development
Michael Hanselmann [Tue, 12 Jan 2010 10:39:59 +0000 (11:39 +0100)]
Provide example default files and install one for development

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

14 years agoMerge branch 'devel-2.1' into stable-2.1
Iustin Pop [Tue, 12 Jan 2010 10:24:03 +0000 (11:24 +0100)]
Merge branch 'devel-2.1' into stable-2.1

14 years agoNormalize MAC addresses to all lower.
René Nussbaumer [Mon, 11 Jan 2010 12:21:43 +0000 (13:21 +0100)]
Normalize MAC addresses to all lower.

This change will normalize the MAC to all lower after validation.

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 agoIntroduce a Luxi call for GetTags
Iustin Pop [Tue, 5 Jan 2010 08:01:27 +0000 (09:01 +0100)]
Introduce a Luxi call for GetTags

This changes from submitting jobs to get the tags (in cli scripts) to
queries, which (since the tags query is a cheap one) should be much
faster.

The tags queries are already done without locks (in the generic query
paths for instances/nodes/cluster), so this shouldn't break tags query
via gnt-* list-tags.

On a small cluster, the runtime of gnt-cluster/gnt-instance list tags
more than halves; on a big cluster (with many MCs) I expect it to be
more than 5 times faster. The speed of the tags get is not the main
gain, it is eliminating a job when a simple query is enough.

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

14 years agoLURenameCluster: run post hook on all nodes
Iustin Pop [Tue, 5 Jan 2010 09:19:47 +0000 (10:19 +0100)]
LURenameCluster: run post hook on all nodes

Since the cluster name might be used for various purposes on nodes, we
should let all nodes "know" about a cluster rename by running the post
hook on all nodes. This will make cluster rename slightly
slower/costlier, but it is not/shouldn't be an operation that is run
very often.

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

14 years agoAllow passing options to pylint in the lint rule
Iustin Pop [Mon, 4 Jan 2010 11:49:16 +0000 (12:49 +0100)]
Allow passing options to pylint in the lint rule

This allows automated builders to override the format, for example.

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

14 years agoFix unused imports or add silences where needed
Iustin Pop [Tue, 29 Dec 2009 18:03:22 +0000 (19:03 +0100)]
Fix unused imports or add silences where needed

In some cases pylint doesn't parse the import correctly, so we add
silences; but there are also many cases of unused imports, which we
simply remove.

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

14 years agobdev: Add a TODO and a pylint silence
Iustin Pop [Tue, 29 Dec 2009 18:01:33 +0000 (19:01 +0100)]
bdev: Add a TODO and a pylint silence

A piece of old code in bdev.py uses a for loop over a single variable
because we can 'break' out of the loop or exit on the 'else' path. This
is not a nice usage of the for loop, it should be converted to a
standard if...elif...else structure.

In the meantime we silence a warning from pylint (it is actually
invalid, IMHO) and add a TODO.

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

14 years agoconfd: add a TODO and a pylint disable
Iustin Pop [Tue, 29 Dec 2009 18:00:42 +0000 (19:00 +0100)]
confd: add a TODO and a pylint disable

Two variables are used in a strange way in ExecConfd. Until that is
clarified, add a TODO and a silence for the unused variable warning.

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

14 years agopylint: Temporarily disable W0201
Iustin Pop [Tue, 29 Dec 2009 17:58:25 +0000 (18:58 +0100)]
pylint: Temporarily disable W0201

There seems to be a bug in pylint relating to W0201 (“Attribute '%r'
defined outside __init__”) being re-enabled by simple comments and not
being able to be disabled again.

Until that is fixed, we disable this warning.

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

14 years agoDisable R0922 in pylint
Iustin Pop [Tue, 29 Dec 2009 17:52:29 +0000 (18:52 +0100)]
Disable R0922 in pylint

R0922, “Abstract class is only referenced 1 times”, cannot be disabled
in the source code, and thus
lib/http/auth.py:HttpServerRequestAuthentication gives this warning
(it's actually also referenced from the tests, but we do not include
them).

Therefore we need to disable it at pylintrc level.

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

14 years agoFurther pylint disables, mostly for Unused args
Iustin Pop [Tue, 29 Dec 2009 16:53:57 +0000 (17:53 +0100)]
Further pylint disables, mostly for Unused args

Many of our functions have to follow a given API, and thus we have to
keep a given signature, but pylint doesn't understand this. Therefore,
we silence this warning.

The patch does a few other cleanups.

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

14 years agopylint: disable the similarities checker
Iustin Pop [Tue, 29 Dec 2009 16:49:36 +0000 (17:49 +0100)]
pylint: disable the similarities checker

This is a very slow checker, estimated to be O(n²) by its author; so
using it all the time is not good. It can be re-enabled on the command
line via “--disable-checker=”.

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

14 years agoLUDiagnoseOS._DiagnoseByOS: remove unused arg
Iustin Pop [Tue, 29 Dec 2009 16:21:19 +0000 (17:21 +0100)]
LUDiagnoseOS._DiagnoseByOS: remove unused arg

The node_list argument to _DiagnoseByOS is not used, and is obsoleted by
the fact that the rlist argument already has the valid nodes as keys
(assuming RPC behaviour didn't change). Thus, we remove it and silence
the warning.

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

14 years agodaemons: handle arguments correctly and uniformly
Iustin Pop [Tue, 29 Dec 2009 16:05:23 +0000 (17:05 +0100)]
daemons: handle arguments correctly and uniformly

Of all daemons, only rapi did abort when given argument. None of our
daemons use any arguments, but they accepted them blindly. This is a
very bad experience for the user.

This patch adds checking and exiting in all daemons, in a uniform way.
One other option would have been to add a flag to GenericMain
(noargs=True).

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

14 years agohv_xen/_GetConfigFileDiskData: remove unused arg
Iustin Pop [Tue, 29 Dec 2009 15:40:23 +0000 (16:40 +0100)]
hv_xen/_GetConfigFileDiskData: remove unused arg

The disk template is not needed, all that's used is the disk data. As
such, remove this parameter from the function.

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

14 years agojqueue/_CheckRpcResult: log the whole operation
Iustin Pop [Tue, 29 Dec 2009 15:33:11 +0000 (16:33 +0100)]
jqueue/_CheckRpcResult: log the whole operation

Currently only the rpc call, but not its description (which also shows
the argument) is logged. We change this to log failmsg too, and this
also silences a warning.

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

14 years agoOptparse extenders have to obey a given API
Iustin Pop [Tue, 29 Dec 2009 15:16:33 +0000 (16:16 +0100)]
Optparse extenders have to obey a given API

So we just silence the warning.

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

14 years agobackend._OSOndiskAPIVersion: remove obsolete arg
Iustin Pop [Tue, 29 Dec 2009 15:12:44 +0000 (16:12 +0100)]
backend._OSOndiskAPIVersion: remove obsolete arg

The 'name' argument is not used anymore, probably since before 2.0.
Since this is an internal function, we can just remove it (from its
caller too).

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

14 years agopylint cleanups: dangerous initializers
Iustin Pop [Tue, 29 Dec 2009 15:05:19 +0000 (16:05 +0100)]
pylint cleanups: dangerous initializers

Plus a silence for a wrong "uninitialized var".

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

14 years agoConvert to static methods (where appropriate)
Iustin Pop [Tue, 29 Dec 2009 15:04:31 +0000 (16:04 +0100)]
Convert to static methods (where appropriate)

Many methods are simple pure functions, and not depending on the object
state. We convert these to staticmethods.

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

14 years agoRemove more unused variables
Iustin Pop [Tue, 29 Dec 2009 15:03:44 +0000 (16:03 +0100)]
Remove more unused variables

This removes unused variables in the rest of the code (outside lib/).

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

14 years agoAdd targeted pylint disables
Iustin Pop [Tue, 29 Dec 2009 15:01:57 +0000 (16:01 +0100)]
Add targeted pylint disables

This patch should have only:

- pylint disables
- docstring changes
- whitespace changes

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

14 years agoburnin: move decorators out of classes
Iustin Pop [Tue, 29 Dec 2009 14:02:32 +0000 (15:02 +0100)]
burnin: move decorators out of classes

Similar to commit c881c5, we move the decorators out of classes, such
that they become simple functions instead of methods. This more clean,
since only the wrapped functions need to be methods/have access to
‘self’.

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

14 years agoRename an ConfdInotifyEventHandler init argument
Iustin Pop [Tue, 29 Dec 2009 11:18:20 +0000 (12:18 +0100)]
Rename an ConfdInotifyEventHandler init argument

'file' is a builtin keyword/type. Like many others, it should not be
used as a variable/argument name.

No code is actually passing in this argument so renaming it is simple.

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

14 years agoIntroduce a makefile lint rule
Iustin Pop [Tue, 29 Dec 2009 11:04:27 +0000 (12:04 +0100)]
Introduce a makefile lint rule

This runs pylint over all the python files. Yes, it takes a long while,
but it's the only way to properly analyze the source codes as only in
this way pylint can see all uses of the various modules/classes/etc.

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

14 years agoImplement all hv functions in hv_chroot/hv_fake
Iustin Pop [Tue, 29 Dec 2009 10:23:32 +0000 (11:23 +0100)]
Implement all hv functions in hv_chroot/hv_fake

The chroot and fake hypervisors were missing:

- the powercycle node functionality
- proper handling of migration requests

The powercycle was just used as in the other hypervisors (use the
standard linux powercycle). The migration for chroot was disabled
explicitly, whereas for the fake one it was implemented to simulate
correctly. This required some work on the fake hypervisor, but now the
implementation of start/stop/etc. is much more clean.

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

14 years agoUpdate the _autoconf.py make rule for pylint
Iustin Pop [Tue, 29 Dec 2009 09:43:44 +0000 (10:43 +0100)]
Update the _autoconf.py make rule for pylint

This adds targeted pylint disables, but since _autoconf.py is
autogenerated we need to do this in Makefile.am (hence the separate
patch).

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

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 agoinstall.rst: note about the default parameters
Guido Trotter [Wed, 16 Dec 2009 10:51:32 +0000 (10:51 +0000)]
install.rst: note about the default parameters

As we know, those are just defaults, mostly chosen by replicating the
only behavior we supported before allowing customization. They may need
changes, to work in specific environments (which is why we introduced
them in the first place).

This tries to address issue 83, which was caused by the default
parameters not being correct for the target cluster.

Signed-off-by: Guido Trotter <ultrotter@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>