ganeti-local
12 years agognt-instance: Adding instance policy to migrate
René Nussbaumer [Tue, 13 Dec 2011 09:31:04 +0000 (10:31 +0100)]
gnt-instance: Adding instance policy to migrate

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

12 years agognt-instance: Adding instance policy to failover
René Nussbaumer [Tue, 13 Dec 2011 09:12:49 +0000 (10:12 +0100)]
gnt-instance: Adding instance policy to failover

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

12 years agocmdlib: Adding helper for instance policy
René Nussbaumer [Tue, 13 Dec 2011 08:38:47 +0000 (09:38 +0100)]
cmdlib: Adding helper for instance policy

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

12 years agorpc.ConfigRunner: Fix uploading file
Michael Hanselmann [Fri, 6 Jan 2012 12:29:41 +0000 (13:29 +0100)]
rpc.ConfigRunner: Fix uploading file

Commit 601dfcb made some changes to the default encoders. This made
“ConfigRunner.call_upload_file” fail due to a missing encoder. This
patch applies the necessary changes to ConfigRunner and updates the
unittest for “call_upload_file”.

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

12 years agoUpdate GrowDisk docstring
Guido Trotter [Thu, 5 Jan 2012 15:55:40 +0000 (15:55 +0000)]
Update GrowDisk docstring

It forgot about one argument.

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

12 years agoMerge branch 'devel-2.5'
Guido Trotter [Fri, 6 Jan 2012 11:38:29 +0000 (11:38 +0000)]
Merge branch 'devel-2.5'

* devel-2.5:
  KVM: support version reported by 1.0
  doc/admin: Clarify archived jobs

Conflicts:
NEWS: trivial

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

12 years agorpc._PrepareFileUpload: Use FileStatHelper
Michael Hanselmann [Thu, 5 Jan 2012 20:23:51 +0000 (21:23 +0100)]
rpc._PrepareFileUpload: Use FileStatHelper

Use fstat(2) on the file handle instead of doing a separate stat(2).

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

12 years agoMove helper class from watcher to utils.io
Michael Hanselmann [Thu, 5 Jan 2012 20:22:45 +0000 (21:22 +0100)]
Move helper class from watcher to utils.io

“FileStatHelper” can be used together with “ReadFile” to a file's status
while it's opened. This avoids certain race conditions.

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

12 years agoAdd unittest for uploading file via RPC
Michael Hanselmann [Thu, 5 Jan 2012 20:12:24 +0000 (21:12 +0100)]
Add unittest for uploading file via RPC

After some preparing patches this unittest can finally be added.

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

12 years agorpc: Change signature of RpcRunner
Michael Hanselmann [Thu, 5 Jan 2012 20:11:04 +0000 (21:11 +0100)]
rpc: Change signature of RpcRunner

Instead of receiving the whole masterd context, it only gets the
configuration and the lock monitor callback. This simplifies
unittesting.

Additionaly, two new arguments for testing are added.

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

12 years agoruntime: Style fix in docstring
Michael Hanselmann [Thu, 5 Jan 2012 20:09:00 +0000 (21:09 +0100)]
runtime: Style fix in docstring

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

12 years agoAdd unittests for RPC client
Michael Hanselmann [Thu, 5 Jan 2012 19:00:34 +0000 (20:00 +0100)]
Add unittests for RPC client

This patch adds a number of unittests for the RPC client base class.
Some small changes were necessary in “rpc.py” to allow for better
testing.

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

12 years agorpc._RpcClientBase: Add check for number of arguments
Michael Hanselmann [Thu, 5 Jan 2012 18:58:39 +0000 (19:58 +0100)]
rpc._RpcClientBase: Add check for number of arguments

Just an additional check, useful in unittests.

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

12 years agoAdd unittest for RPC compression
Michael Hanselmann [Thu, 5 Jan 2012 16:47:38 +0000 (17:47 +0100)]
Add unittest for RPC compression

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

12 years agorpc: Style fix
Michael Hanselmann [Thu, 5 Jan 2012 18:58:06 +0000 (19:58 +0100)]
rpc: Style fix

“assert” is a statement, not a function.

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

12 years agoMerge branch 'stable-2.5' into devel-2.5
Guido Trotter [Fri, 6 Jan 2012 10:50:45 +0000 (10:50 +0000)]
Merge branch 'stable-2.5' into devel-2.5

* stable-2.5:
  KVM: support version reported by 1.0

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

12 years agocheck-news/NEWS: impose more standards
Guido Trotter [Thu, 5 Jan 2012 18:05:06 +0000 (18:05 +0000)]
check-news/NEWS: impose more standards

- Always two empty lines before a version.
- Standardize how version names should be called.

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

12 years agoKVM: support version reported by 1.0
Guido Trotter [Thu, 5 Jan 2012 16:20:24 +0000 (16:20 +0000)]
KVM: support version reported by 1.0

This of course was working for all the rcs, but broke with 1.0 itself.

In addition:
  - split between running kvm --version and parsing its output
  - unittest parsing for various known --help outputs
  - updated NEWS file
  - happy 2012 wishes
  - the hope to finish this patch before it's time to say happy easter
    :)

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

12 years agoqa: fix disk parameters tests
Andrea Spadaccini [Thu, 5 Jan 2012 14:56:25 +0000 (14:56 +0000)]
qa: fix disk parameters tests

Fix an error in the disk parameters tests (the arguments to gnt-cluster
were not passed correctly) and move them to separate functions.

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

12 years agoman/gnt-node: Improve powercycle documentation
Michael Hanselmann [Thu, 5 Jan 2012 12:54:37 +0000 (13:54 +0100)]
man/gnt-node: Improve powercycle documentation

Reword a bit, capitalize “SSH”.

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

12 years agorpc_defs: Enable “node_powercycle” for offline nodes
Michael Hanselmann [Thu, 5 Jan 2012 13:05:08 +0000 (14:05 +0100)]
rpc_defs: Enable “node_powercycle” for offline nodes

With this change it's possible to powercycle nodes marked as offline. Of
course the node might not be running the node daemon anymore.

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

12 years agorpc._NodeConfigResolver: Support resolving offline nodes
Michael Hanselmann [Thu, 5 Jan 2012 13:03:47 +0000 (14:03 +0100)]
rpc._NodeConfigResolver: Support resolving offline nodes

This is needed to powercycle a node marked offline.

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

12 years agorpc: Pass resolver options to actual resolver
Michael Hanselmann [Wed, 4 Jan 2012 19:33:55 +0000 (20:33 +0100)]
rpc: Pass resolver options to actual resolver

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

12 years agorpc: Add support for resolver options callback
Michael Hanselmann [Thu, 5 Jan 2012 14:23:49 +0000 (15:23 +0100)]
rpc: Add support for resolver options callback

This adds support for a callback returning name resolver options. This
is required for powercycling offline nodes. While it would be possible
to implement this using a separate RPC client class, doing so would
require some code duplication with the standard “RpcRunner” class.

The callback can generate the options based on the call arguments.

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

12 years agorpc._RpcProcessor: Make read timeout a non-keyword argument
Michael Hanselmann [Wed, 4 Jan 2012 18:59:13 +0000 (19:59 +0100)]
rpc._RpcProcessor: Make read timeout a non-keyword argument

It is always used and can be set to “None” if intended.

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

12 years agoQA: Make the ispec values configurable
René Nussbaumer [Thu, 5 Jan 2012 10:18:37 +0000 (11:18 +0100)]
QA: Make the ispec values configurable

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

12 years agoUpdate the resource model DD with current state
René Nussbaumer [Wed, 4 Jan 2012 13:15:50 +0000 (14:15 +0100)]
Update the resource model DD with current state

On my work for instance policies we decided not to overload --force
more, instead we go with a new flag --ignore-ipolicy. This is just a
small patch to reflect this decision.

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

12 years agoFix failure in distcheck and coverage tests
Bernardo Dal Seno [Thu, 22 Dec 2011 13:49:24 +0000 (14:49 +0100)]
Fix failure in distcheck and coverage tests

autotools/testrunner was missing in distcheck.  Now some changes from
7004106119c5c56c93085ccfb1250b3561b5b6ad have been reverted, and testrunner
is not built anymore.  coverage now uses fakeroot when needed.

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

12 years agoMakefile: Fix parallel distcheck
Michael Hanselmann [Thu, 22 Dec 2011 18:19:28 +0000 (19:19 +0100)]
Makefile: Fix parallel distcheck

Running “make -jN distcheck” for any N > 1 would reliably break when
building the RPC client wrappers. This was due to wrong dependencies in
Makefile.am, fixed by this patch.

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

12 years agodoc/admin: Clarify archived jobs
Michael Hanselmann [Thu, 22 Dec 2011 17:12:59 +0000 (18:12 +0100)]
doc/admin: Clarify archived jobs

Also mention that archived jobs can be viewed using “gnt-job info”.

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

12 years agoMerge branch 'devel-2.5'
Michael Hanselmann [Thu, 22 Dec 2011 16:43:40 +0000 (17:43 +0100)]
Merge branch 'devel-2.5'

* devel-2.5:
  jqueue: Factorize checking job processor's result
  jqueue unittest: Rename simple fake-job class
  jqueue: Fix epylint errors introduced in 37d76f1e4
  jqueue: Fix deadlock between job queue and dependency manager
  locking: Add “__repr__” to SharedLock and PipeCondition
  daemon.GenericMain: Don't generate backtrace on conflicting daemons
  utils.io.WritePidFile: Improve error reporting
  utils.ListVisibleFiles: Hide “lost+found” directories
  Fix race condition in test for *FileID functions

Conflicts:
lib/utils/io.py: Trivial

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

12 years agoMerge branch 'stable-2.5' into devel-2.5
Michael Hanselmann [Thu, 22 Dec 2011 16:35:03 +0000 (17:35 +0100)]
Merge branch 'stable-2.5' into devel-2.5

* stable-2.5:
  jqueue: Fix epylint errors introduced in 37d76f1e4
  jqueue: Fix deadlock between job queue and dependency manager

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

12 years agotest/lockperf: Use a list of integers, not booleans
Michael Hanselmann [Thu, 22 Dec 2011 15:00:53 +0000 (16:00 +0100)]
test/lockperf: Use a list of integers, not booleans

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

12 years agoAdd lock performance utility
Michael Hanselmann [Thu, 22 Dec 2011 13:16:57 +0000 (14:16 +0100)]
Add lock performance utility

I had an idea for improving locking performance. To see if it worked I
wrote this tool. Unfortunately the idea didn't quite work (broke
unittests left and right), but the tool is still handy for evaluating
future changes to the “SharedLock” class.

It is not installed or run at build/test time. In its current form it is
intended for manual use. Example output:

---
Total number of acquisitions: 32642
Per-thread acquisitions:
  Thread 0: 6536 (20.0%)
  Thread 1: 6488 (19.9%)
  Thread 2: 6536 (20.0%)
  Thread 3: 6529 (20.0%)
  Thread 4: 6553 (20.1%)
Benchmark CPU time: 5.010s
Average time per lock acquisition: 0.15348ms
Process:
  User time: 4.160s
  System time: 1.030s
  Total time: 5.190s
---

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

12 years agojqueue: Factorize checking job processor's result
Michael Hanselmann [Mon, 19 Dec 2011 15:25:24 +0000 (16:25 +0100)]
jqueue: Factorize checking job processor's result

This allows for more unittesting.

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

12 years agojqueue unittest: Rename simple fake-job class
Michael Hanselmann [Mon, 19 Dec 2011 15:26:08 +0000 (16:26 +0100)]
jqueue unittest: Rename simple fake-job class

Also add a parameter for priority, to be used in an upcoming
patch.

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

12 years agonoded: Fix /etc/hosts group ownership
Bernardo Dal Seno [Tue, 13 Dec 2011 15:01:24 +0000 (16:01 +0100)]
noded: Fix /etc/hosts group ownership

When Ganeti was compiled with the option of running as a different
user/group, the group ownership of /etc/hosts was set to gnt-daemons.  Now
permissions for /etc/hosts are preserved (or set correctly).

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

12 years agounit tests: Add tests for uid and gid handling in utils.WriteFile
Bernardo Dal Seno [Tue, 13 Dec 2011 16:17:10 +0000 (17:17 +0100)]
unit tests: Add tests for uid and gid handling in utils.WriteFile

These tests need fakeroot.  If it's not present, they are not run (they
don't fail).

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

12 years agounit tests: Add tests for file mode handling in utils.WriteFile
Bernardo Dal Seno [Tue, 13 Dec 2011 14:51:02 +0000 (15:51 +0100)]
unit tests: Add tests for file mode handling in utils.WriteFile

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

12 years agoutils.WriteFile: Add new parameter to preserve file permissions
Bernardo Dal Seno [Tue, 13 Dec 2011 14:49:38 +0000 (15:49 +0100)]
utils.WriteFile: Add new parameter to preserve file permissions

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

12 years agounit tests: added fakeroot support
Bernardo Dal Seno [Tue, 13 Dec 2011 16:16:42 +0000 (17:16 +0100)]
unit tests: added fakeroot support

Tests ending in "-runasroot" or "-runasroot.py" are run through fakeroot,
so activity that needs root privileges can be tested.

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

12 years agojqueue: Fix epylint errors introduced in 37d76f1e4
Michael Hanselmann [Wed, 21 Dec 2011 16:01:08 +0000 (17:01 +0100)]
jqueue: Fix epylint errors introduced in 37d76f1e4

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

12 years agoSwitch blockdev_getmirrorstatus_multi to per-node bodies
Iustin Pop [Wed, 21 Dec 2011 13:48:13 +0000 (14:48 +0100)]
Switch blockdev_getmirrorstatus_multi to per-node bodies

Even for a small 4-node node-group, this reduces the payload of this
RPC call by half for each node; for a big node group, previous testing
(using a different patch) showed a general reduction in traffic over
the entire cluster verify from 9MB to ~2MB.

We only need to change the RPC call, not its return value, since that
was already in an "optimised" form.

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

12 years agoChange internal RPC client body values
Iustin Pop [Wed, 21 Dec 2011 13:11:32 +0000 (14:11 +0100)]
Change internal RPC client body values

Currently, all RPC payloads sent by the client to the remote node
daemons must be identical, due to how the data is passed
internally. This is deficient in both use (from the programmer's point
of view) and from the network traffic (cluster verify/disk data
gathering has a total payload which is O(n²) in size of the nodes
being queried, instead of O(n)).

This patch changes the RPC internals so that we always pass
dictionaries indexed by target node name. For the default use case,
when the payload is identical, we only serialise the payload once, so
the extra overhead is just a dict with the node names and values all
pointing to the same object. For different payloads, we will encode
the body multiple times, but hopefully the bodies will be smaller.

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

12 years agoExtend RPC definition change with another parameter
Iustin Pop [Wed, 21 Dec 2011 12:58:29 +0000 (13:58 +0100)]
Extend RPC definition change with another parameter

This will be used in a later patch for parameter pre-processing. For
now we just add the parameter as 'None' and add a consistency check
for the parameter definitions.

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

12 years agohv_kvm: Make string containing regex a raw string
Michael Hanselmann [Wed, 21 Dec 2011 15:43:28 +0000 (16:43 +0100)]
hv_kvm: Make string containing regex a raw string

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

12 years agohv_kvm: Style fixes
Michael Hanselmann [Wed, 21 Dec 2011 14:50:51 +0000 (15:50 +0100)]
hv_kvm: Style fixes

Change a few lines to match rest of code.

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

12 years agotest/hv_kvm: Code style, additional tests
Michael Hanselmann [Wed, 21 Dec 2011 14:47:13 +0000 (15:47 +0100)]
test/hv_kvm: Code style, additional tests

Change code style to match rest of Ganeti code and add
two tests checking for single-line messages.

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

12 years agohv_kvm.QmpMessage: Use dict.get
Michael Hanselmann [Wed, 21 Dec 2011 14:45:59 +0000 (15:45 +0100)]
hv_kvm.QmpMessage: Use dict.get

No need to look up the key twice.

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

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

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

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

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

12 years agojqueue: Fix deadlock between job queue and dependency manager
Michael Hanselmann [Mon, 19 Dec 2011 15:26:55 +0000 (16:26 +0100)]
jqueue: Fix deadlock between job queue and dependency manager

When an opcode is about to be processed its dependencies are
evaluated using “_JobDependencyManager.CheckAndRegister”. Due
to its nature that function requires a lock on the manager's
internal structures. All of this happens while the job queue
lock is held in shared mode (required for the job processor).

When a job has been processed any pending dependencies are re-added
to the job workerpool. Before this patch that would require
the manager's lock and then, for adding the jobs, the job queue
lock. Since this is in reverse order it will lead to deadlocks.

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

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

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

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

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

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

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

12 years agolocking: Add “__repr__” to SharedLock and PipeCondition
Michael Hanselmann [Mon, 19 Dec 2011 14:21:04 +0000 (15:21 +0100)]
locking: Add “__repr__” to SharedLock and PipeCondition

These help when debugging.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Later patches will implement the rest of the parameters.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

12 years agodaemon.GenericMain: Don't generate backtrace on conflicting daemons
Michael Hanselmann [Thu, 8 Dec 2011 14:35:23 +0000 (15:35 +0100)]
daemon.GenericMain: Don't generate backtrace on conflicting daemons

Instead, print a nicer error message. This should fix issue 200.

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

12 years agoutils.io.WritePidFile: Improve error reporting
Michael Hanselmann [Thu, 8 Dec 2011 14:33:31 +0000 (15:33 +0100)]
utils.io.WritePidFile: Improve error reporting

If the PID file is already locked by another process, try to read
the content and report it as part of the error message.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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