ganeti-local
14 years agocmdlib._CreateDisks fix a broken result.Raise
Guido Trotter [Mon, 21 Sep 2009 10:13:43 +0000 (11:13 +0100)]
cmdlib._CreateDisks fix a broken result.Raise

The format string has the ": %s" at the end, but no argument is passed,
which of course raises a TypeError. Removing ": %s" as it's added by
the RpcResult Raise() method anyway.

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

14 years agoInclude NEWS file in documentation
Michael Hanselmann [Fri, 18 Sep 2009 15:24:27 +0000 (17:24 +0200)]
Include NEWS file in documentation

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

14 years agoConvert NEWS file to RST
Michael Hanselmann [Fri, 18 Sep 2009 15:22:18 +0000 (17:22 +0200)]
Convert NEWS file to RST

- Add markup for titles
- Convert quotes
- Reindent and rewrap to 72 chars per line

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

14 years agoUnify the instance creation code
Iustin Pop [Fri, 18 Sep 2009 12:48:22 +0000 (14:48 +0200)]
Unify the instance creation code

Currently the AddInstance in gnt-instance and ImportInstance in
gnt-backup duplicate all of their code except the actual opcode creation
(the parameters to it). By moving this to cli.py (not optimal location,
but we don't have another one), we can use a single copy of the code,
and simply change based on the mode parameter the few different
opcode parameters.

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

14 years agoUnify multi-instance handling in gnt-instance
Iustin Pop [Fri, 18 Sep 2009 11:45:23 +0000 (13:45 +0200)]
Unify multi-instance handling in gnt-instance

Start, stop and reboot have the same code for dealing with
multi-instance handling. This patch moves all that into a single generic
function, and leaves only the building of the specific opcode for the
operation in the individual functions.

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

14 years agoFix gnt-instance start/stop/… args
Iustin Pop [Fri, 18 Sep 2009 11:01:03 +0000 (13:01 +0200)]
Fix gnt-instance start/stop/… args

The gnt-instance commands that have the multi-filter can take also zero
arguments, if the --all flag is passed. But they currently are declared
with min=1, and this is a regression due to the recent bash completion
changes.

There is also the problem that --primary/--secondary expect a node and
not an instance, but currently the completion doesn't support this
distinction.

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

14 years agoRemove explicit DEBUG_OPT and add it by default
Iustin Pop [Thu, 17 Sep 2009 13:25:55 +0000 (15:25 +0200)]
Remove explicit DEBUG_OPT and add it by default

Since >90% of the commands take the “--debug” option, and all should
actually take it (the gnt-job command is currently missing it), it makes
sense to simply remove this and add it by default in cli.py.

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

14 years agoChange indentation style in commands definitions
Iustin Pop [Thu, 17 Sep 2009 13:13:25 +0000 (15:13 +0200)]
Change indentation style in commands definitions

Currently, the indentation level for a command's definition depends on
the command name length, and this makes the commands dict unpleasant to
the eye. This patch changes it so that a new line begins right after the
left parenthesis starting the command tuple.

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

14 years agoMake ganeti-watcher use the standard debug option
Iustin Pop [Thu, 17 Sep 2009 12:58:53 +0000 (14:58 +0200)]
Make ganeti-watcher use the standard debug option

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

14 years agoMove the “--no-shutdown” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 12:51:58 +0000 (14:51 +0200)]
Move the “--no-shutdown” option to cli.py

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

14 years agoMove the “--ignore-secondaries” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 12:49:42 +0000 (14:49 +0200)]
Move the “--ignore-secondaries” option to cli.py

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

14 years agoMove the “--reboot-type” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 12:48:43 +0000 (14:48 +0200)]
Move the “--reboot-type” option to cli.py

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

14 years agoMove cluster verify options to cli.py
Iustin Pop [Thu, 17 Sep 2009 12:46:13 +0000 (14:46 +0200)]
Move cluster verify options to cli.py

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

14 years agoMove more cluster init opts to cli.py
Iustin Pop [Thu, 17 Sep 2009 12:41:51 +0000 (14:41 +0200)]
Move more cluster init opts to cli.py

Some of these should be added to cluster modify too.

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

14 years agoMove the “--mac-prefix” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 12:37:06 +0000 (14:37 +0200)]
Move the “--mac-prefix” option to cli.py

The default has also been changed to None as this will be useful once
cluster modify will be able to change this setting too.

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

14 years agoMove the “--no-voting” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 12:32:30 +0000 (14:32 +0200)]
Move the “--no-voting” option to cli.py

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

14 years agoMove the “--yes-do-it” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 12:30:41 +0000 (14:30 +0200)]
Move the “--yes-do-it” option to cli.py

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

14 years agoUnify the “--vg-name” option
Iustin Pop [Thu, 17 Sep 2009 12:24:26 +0000 (14:24 +0200)]
Unify the “--vg-name” option

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

14 years agoUnify the “--candidate-pool-size” option
Iustin Pop [Thu, 17 Sep 2009 12:21:33 +0000 (14:21 +0200)]
Unify the “--candidate-pool-size” option

This required a slight tweak since in init we want a different default.

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

14 years agoUnify the “--nic-parameters” option
Iustin Pop [Thu, 17 Sep 2009 12:17:42 +0000 (14:17 +0200)]
Unify the “--nic-parameters” option

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

14 years agoUnify the “--enabled-hypervisors” option
Iustin Pop [Thu, 17 Sep 2009 12:13:41 +0000 (14:13 +0200)]
Unify the “--enabled-hypervisors” option

This also required a change, as one of the cases used a different
default.

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

14 years agoUnify the “--no-lvm-storage” option
Iustin Pop [Thu, 17 Sep 2009 11:57:50 +0000 (13:57 +0200)]
Unify the “--no-lvm-storage” option

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

14 years agoMove the “--allocatable” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:54:19 +0000 (13:54 +0200)]
Move the “--allocatable” option to cli.py

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

14 years agoMove the node flags options to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:50:20 +0000 (13:50 +0200)]
Move the node flags options to cli.py

This also unifies a little the parameters to the respective options.

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

14 years agoMove the “--no-ssh-key-check” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:46:54 +0000 (13:46 +0200)]
Move the “--no-ssh-key-check” option to cli.py

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

14 years agoMove the “--readd” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:45:58 +0000 (13:45 +0200)]
Move the “--readd” option to cli.py

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

14 years agoUnify the “--secondary-ip” option
Iustin Pop [Thu, 17 Sep 2009 11:45:21 +0000 (13:45 +0200)]
Unify the “--secondary-ip” option

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

14 years agoMove the “--src-…” options to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:43:39 +0000 (13:43 +0200)]
Move the “--src-…” options to cli.py

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

14 years agoMove the “--ignore-size” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:41:31 +0000 (13:41 +0200)]
Move the “--ignore-size” option to cli.py

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

14 years agoMove the “--auto” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:40:03 +0000 (13:40 +0200)]
Move the “--auto” option to cli.py

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

14 years agoMove the “--on-secondary” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:39:22 +0000 (13:39 +0200)]
Move the “--on-secondary” option to cli.py

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

14 years agoMove the “--on-primary” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:38:35 +0000 (13:38 +0200)]
Move the “--on-primary” option to cli.py

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

14 years agoUnify the “--new-secondary” option
Iustin Pop [Thu, 17 Sep 2009 11:36:18 +0000 (13:36 +0200)]
Unify the “--new-secondary” option

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

14 years agoMove the “--ignore-failures” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:33:36 +0000 (13:33 +0200)]
Move the “--ignore-failures” option to cli.py

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

14 years agoMove the “--select-os” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:31:16 +0000 (13:31 +0200)]
Move the “--select-os” option to cli.py

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

14 years agoMove the “--all” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:30:18 +0000 (13:30 +0200)]
Move the “--all” option to cli.py

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

14 years agoMove the “--static” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:29:20 +0000 (13:29 +0200)]
Move the “--static” option to cli.py

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

14 years agoMove the “--cleanup” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:28:16 +0000 (13:28 +0200)]
Move the “--cleanup” option to cli.py

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

14 years agoMove the “--show-cmd” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:27:00 +0000 (13:27 +0200)]
Move the “--show-cmd” option to cli.py

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

14 years agoMove the “--no-start” option to cli.py
Iustin Pop [Thu, 17 Sep 2009 11:25:48 +0000 (13:25 +0200)]
Move the “--no-start” option to cli.py

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

14 years agoUnify the last “--node” (single node) option
Iustin Pop [Thu, 17 Sep 2009 11:20:22 +0000 (13:20 +0200)]
Unify the last “--node” (single node) option

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

14 years agoUnify the “--node” (as list of nodes) option
Iustin Pop [Thu, 17 Sep 2009 11:07:35 +0000 (13:07 +0200)]
Unify the “--node” (as list of nodes) option

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

14 years agoUnify the “--node” (as instance placement) option
Iustin Pop [Thu, 17 Sep 2009 10:57:41 +0000 (12:57 +0200)]
Unify the “--node” (as instance placement) option

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

14 years agoUnify the “--non-live” option
Iustin Pop [Thu, 17 Sep 2009 10:54:03 +0000 (12:54 +0200)]
Unify the “--non-live” option

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

14 years agoUnify the “--ignore-consistency” option
Iustin Pop [Thu, 17 Sep 2009 10:51:12 +0000 (12:51 +0200)]
Unify the “--ignore-consistency” option

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

14 years agoUnify the “--os-size” option
Iustin Pop [Thu, 17 Sep 2009 10:48:00 +0000 (12:48 +0200)]
Unify the “--os-size” option

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

14 years agoUnify the “--disks” (disk indices) option
Iustin Pop [Thu, 17 Sep 2009 10:45:08 +0000 (12:45 +0200)]
Unify the “--disks” (disk indices) option

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

14 years agoUnify the “--disk” (identkeyval) option
Iustin Pop [Thu, 17 Sep 2009 10:41:44 +0000 (12:41 +0200)]
Unify the “--disk” (identkeyval) option

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

14 years agoUnify the “--net” option
Iustin Pop [Thu, 17 Sep 2009 10:36:54 +0000 (12:36 +0200)]
Unify the “--net” option

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

14 years agoUnify the “--no-ip-check” option
Iustin Pop [Thu, 17 Sep 2009 10:33:40 +0000 (12:33 +0200)]
Unify the “--no-ip-check” option

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

14 years agoUnify the last “--hypervisor” (as list) option
Iustin Pop [Thu, 17 Sep 2009 10:28:24 +0000 (12:28 +0200)]
Unify the last “--hypervisor” (as list) option

This third form takes a list of name+options, and is used only in
gnt-cluster. Who knew that we have three forms of ‘-H’?

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

14 years agoUnify the “--hypervisor” (with name) option
Iustin Pop [Thu, 17 Sep 2009 10:26:28 +0000 (12:26 +0200)]
Unify the “--hypervisor” (with name) option

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

14 years agoUnify the “--hypervisor” (params only) option
Iustin Pop [Thu, 17 Sep 2009 09:51:56 +0000 (11:51 +0200)]
Unify the “--hypervisor” (params only) option

This unifies the two uses of --hypervisor-parameters with only options
(a=b,…) form. The patch changes a little SetInstanceParms since that
expected opts.hypervisor instead of opts.hvparams.

Note that there is another form of --hypervisor-parameters which also
takes the name, that comes in a separate patch.

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

14 years agoUnify the “--backend-parameters” option
Iustin Pop [Thu, 17 Sep 2009 09:21:31 +0000 (11:21 +0200)]
Unify the “--backend-parameters” option

This is not straight-forward. First, gnt-cluster had
“--backend-parameters” wheres the rest of the script had just
“--backend”. I settled on the full form, since one can always abbreviate
options, but not vice-versa.

Second, the help in some cases was different, e.g. start instance
had “Temporary backend parameters” and modify had “Change backend
parameters”. I think this kind of distinctions are better served in the
man page. Alternatively, if we could copy options easily, one could
re-instantiate them with a changed help line.

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

14 years agoUnify the “--os-type” option
Iustin Pop [Thu, 17 Sep 2009 09:11:22 +0000 (11:11 +0200)]
Unify the “--os-type” option

This was already unified inside gnt-instance, I just moved that
definition (and upper-cased it) into cli.py.

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

14 years agoUnify the “--iallocator” option
Iustin Pop [Thu, 17 Sep 2009 09:07:23 +0000 (11:07 +0200)]
Unify the “--iallocator” option

This patch also changes the gnt-debug's “--algorithm” into
IALLOCATOR_OPT, since it was the only non-standard use of this (due to
historical reasons). Since it's just a debug option,
backwards-compatibility is not critical here.

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

14 years agoUnify the “--file-driver” option
Iustin Pop [Thu, 17 Sep 2009 09:04:00 +0000 (11:04 +0200)]
Unify the “--file-driver” option

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

14 years agoUnify the “--file-storage-dir” option
Iustin Pop [Thu, 17 Sep 2009 09:02:07 +0000 (11:02 +0200)]
Unify the “--file-storage-dir” option

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

14 years agoUnify the “--no-nics” option
Iustin Pop [Thu, 17 Sep 2009 08:59:55 +0000 (10:59 +0200)]
Unify the “--no-nics” option

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

14 years agoUnify the “--disk-template” option
Iustin Pop [Thu, 17 Sep 2009 08:57:46 +0000 (10:57 +0200)]
Unify the “--disk-template” option

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

14 years agoUnify the “--no-wait-for-sync” option
Iustin Pop [Thu, 17 Sep 2009 08:57:03 +0000 (10:57 +0200)]
Unify the “--no-wait-for-sync” option

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

14 years agoExplain the reason for fqdn hostnames
Guido Trotter [Thu, 17 Sep 2009 20:58:23 +0000 (21:58 +0100)]
Explain the reason for fqdn hostnames

The install guide asks the user to use the fqdn in the hostname, but
doesn't explain why. This has been asked multiple times, so adding an
explanation there.

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

14 years agoRemove RpcResult.RemoteFailMsg completely
Michael Hanselmann [Wed, 16 Sep 2009 16:16:05 +0000 (18:16 +0200)]
Remove RpcResult.RemoteFailMsg completely

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

14 years agoAdd locking improvements to Ganeti 2.1 design document
Michael Hanselmann [Wed, 16 Sep 2009 16:10:12 +0000 (18:10 +0200)]
Add locking improvements to Ganeti 2.1 design document

Also increase the table of contents' depth to 4.

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

14 years agoAdd an error-simulation mode to cluster verify
Iustin Pop [Thu, 17 Sep 2009 08:33:48 +0000 (10:33 +0200)]
Add an error-simulation mode to cluster verify

One of the issues we have in ganeti is that it's very hard to test the
error-handling paths; QA and burnin only test the OK code-path, since
it's hard to simulate errors.

LUVerifyCluster is special amongst the LUs in the fact that a) it has a
lot of error paths and b) the error paths only log the error, they don't
do any rollback or other similar actions. Thus, it's enough for this LU
to separate the testing of the error condition from the logging of the
error condition.

This patch does this by replacing code blocks of the form:

  if x:
    log_error()
    [y]

into:

  log_error_if(x)
  [if x:
    y
  ]

After this change, it's simple enough to turn on logging of all errors
by adding a special case inside log_error_if such that if the incoming
opcode has a special ‘debug_simulate_errors’ attribute and it's true, it
will log unconditionally the error.

Surprisingly this also turns into an absolute code reduction, since some
of the if blocks were simplified. The only downside to this patch is
that the various _VerifyX() functions are now stateful (modifying an
attribute on the LU instance) instead of returning a boolean result.

Last note: yes, this discovered some error cases in the logging.

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

14 years agoIntroduce parseable error codes in LUVerifyCluster
Iustin Pop [Wed, 16 Sep 2009 09:55:07 +0000 (11:55 +0200)]
Introduce parseable error codes in LUVerifyCluster

Currently the output of cluster verify can be parsed for 'ERROR'
messages, but that is the only indication we get (error or no error). In
order to allow monitoring tools to separate different error conditions,
this patch introduces a new output format (“gnt-cluster verify
--error-codes”) that changes the output from human-friendly to
machine-friendly. In this mode, an error line changes from:
  ERROR: node node1: drbd minor 1 of instance inst1.is not active

to:
  ERROR:ENODEDRBD:node:node1:drbd minor 1 of instance inst1 is not active

i.e. the error message is a ‘:’-separated field, with ERROR in the first
place, the error code in the second, the object type (cluster, node,
instance) in the third, the name of the object (for nodes/instances) in
the fourth, and then the text message.

The patch also removes some of the verbosity of the operation
(“Verifying instance X”, “Verifying node X”) since on big clusters these
informational messages can quickly fill up an entire screen. The
original behaviour can be restored via the ‘--verbose’ option.

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

14 years agoUnify the multiple 'verbose' options
Iustin Pop [Tue, 15 Sep 2009 09:42:51 +0000 (11:42 +0200)]
Unify the multiple 'verbose' options

Currently multiple files define a 'verbose' option. This patch moves all
these definitions to a single VERBOSE_OPT option which is exported from
cli.py.

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

14 years agoRewrite the lib/cli.py export list
Iustin Pop [Tue, 15 Sep 2009 09:40:02 +0000 (11:40 +0200)]
Rewrite the lib/cli.py export list

Right now, the export list is a mess, it's not sorted, and the exported
items are in random places. This patches does grow the length of the
list, but at least it's more clear.

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

14 years agoShow "--help" in bash completion
Michael Hanselmann [Wed, 16 Sep 2009 15:39:03 +0000 (17:39 +0200)]
Show "--help" in bash completion

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

14 years agoRemove RpcResult.failed attribute
Michael Hanselmann [Wed, 16 Sep 2009 13:15:22 +0000 (15:15 +0200)]
Remove RpcResult.failed attribute

It's redundant with RpcResult.fail_msg. This change survived QA, burnin and
unittests.

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

14 years agoConfd: add primary IPs queries
Luca Bigliardi [Wed, 16 Sep 2009 13:19:18 +0000 (14:19 +0100)]
Confd: add primary IPs queries

Extend confd to answer queries about nodes primary IPs and master candidates
primary IPs.

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

14 years agoganeti-confd: remove partial imports
Guido Trotter [Wed, 16 Sep 2009 11:00:03 +0000 (12:00 +0100)]
ganeti-confd: remove partial imports

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

14 years agoConfd client library
Guido Trotter [Tue, 15 Sep 2009 16:33:23 +0000 (17:33 +0100)]
Confd client library

Initial confd client library implementation.  This initial version uses
asyncore, and supports answers via a callback.

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

14 years agoMove fourcc packing/unpacking to main confd module
Guido Trotter [Tue, 15 Sep 2009 12:50:19 +0000 (13:50 +0100)]
Move fourcc packing/unpacking to main confd module

This way it can be used by the client as well

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

14 years agoAdd unittests for confd constants
Guido Trotter [Tue, 15 Sep 2009 11:20:40 +0000 (12:20 +0100)]
Add unittests for confd constants

Checking that the fourcc code is indeed a fourcc code, and that request
codes and reply statuses are distinct.

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

14 years agoganeti-confd: explicitely log failed big sends
Guido Trotter [Mon, 14 Sep 2009 16:13:45 +0000 (17:13 +0100)]
ganeti-confd: explicitely log failed big sends

Make sure that if we try to send packages which are too big (which
shouldn't happen) this gets properly logged in the config file.

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

14 years agoAdd a magic fourcc code to confd packets
Guido Trotter [Mon, 14 Sep 2009 15:59:03 +0000 (16:59 +0100)]
Add a magic fourcc code to confd packets

This will make it easier to change the protocol later on

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

14 years agoAsyncUDPSocket: Move to a well defined UDP size
Guido Trotter [Mon, 14 Sep 2009 15:42:33 +0000 (16:42 +0100)]
AsyncUDPSocket: Move to a well defined UDP size

Currently we read maximum 4K packets, and don't check packets when
sending them. With this patch we move to a well defined maximum size of
60K.

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

14 years agoConfdAsyncUDPServer: fix a docstring
Guido Trotter [Mon, 14 Sep 2009 14:54:37 +0000 (15:54 +0100)]
ConfdAsyncUDPServer: fix a docstring

It refers to an older input variable

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

14 years agoAbstract AsyncUDPSocket to daemon
Guido Trotter [Mon, 14 Sep 2009 13:13:17 +0000 (14:13 +0100)]
Abstract AsyncUDPSocket to daemon

This allows this extended asyncore+udp module to be used also in other
daemons, and in the confd client library

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

14 years agoConfdAsyncUDPServer: defer handling writes
Guido Trotter [Mon, 14 Sep 2009 10:49:49 +0000 (11:49 +0100)]
ConfdAsyncUDPServer: defer handling writes

Currently if we fail writing to the socket (perhaps because a signal was
delivered) we lose the data we were sending. Although this is not too
bad (it's udp, and data may get lost anyway) we try to avoid this by
just putting the packets to write in a queue and handling that through
the normal asyncore methods.

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

14 years agoConfdAsyncUDPServer: handle signals at read time
Guido Trotter [Mon, 14 Sep 2009 10:40:36 +0000 (11:40 +0100)]
ConfdAsyncUDPServer: handle signals at read time

Currently if a signal is delivered during an attempted read, an
exception is logged in the logfile. There is no need for this, so we
handle this case explicitely.

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

14 years agoFix authorized_keys generation at cluster init
Luca Bigliardi [Wed, 16 Sep 2009 12:37:09 +0000 (13:37 +0100)]
Fix authorized_keys generation at cluster init

Copy pub_key in authorized_keys.

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

14 years agoMove developer notes into normal documentation
Michael Hanselmann [Tue, 15 Sep 2009 12:14:23 +0000 (14:14 +0200)]
Move developer notes into normal documentation

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

14 years agojqueue: Remove unused run_op_index attribute
Michael Hanselmann [Mon, 14 Sep 2009 15:51:25 +0000 (17:51 +0200)]
jqueue: Remove unused run_op_index attribute

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

14 years agoExport new lock_status field to gnt-job
Michael Hanselmann [Tue, 15 Sep 2009 11:09:31 +0000 (13:09 +0200)]
Export new lock_status field to gnt-job

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

14 years agoKeep lock status with every job
Michael Hanselmann [Tue, 15 Sep 2009 11:00:41 +0000 (13:00 +0200)]
Keep lock status with every job

This can be useful for debugging locking problems.

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

14 years agoMove OpCode processor callbacks into separate class
Michael Hanselmann [Tue, 15 Sep 2009 11:02:56 +0000 (13:02 +0200)]
Move OpCode processor callbacks into separate class

There are two major arguments for this:
- There will be more callbacks (e.g. for lock debugging) and extending the
  parameter list is a lot of work.
- In the jqueue module this allows us to keep per-job or per-opcode variables in
  a separate class. Instead of having to clean up the worker class after
  processing one job, these references will automatically go out of scope.

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

14 years agoReplace last hardcoded 'nodelist' with NV_NODELIST
Iustin Pop [Mon, 14 Sep 2009 11:32:54 +0000 (13:32 +0200)]
Replace last hardcoded 'nodelist' with NV_NODELIST

LUAddNode has this usage remaining, as it's the only other LU to use
call_node_verify (beside LUVerifyCluster).

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

14 years agoTreat virtual LVs as inexistent
Iustin Pop [Mon, 14 Sep 2009 11:25:18 +0000 (13:25 +0200)]
Treat virtual LVs as inexistent

Currently, “gnt-cluster verify” and “gnt-cluster verify-disks” use the
list of LVs as returned by backend.GetVolumeList to determine whether an
LV exists or not. However, LVs can also be ‘virtual’, which is handled
correctly (i.e. as missing) by the bdev code, but not by this function.

This patch changed GetVolumeList to simply skip virtual LVs; this makes
cluster verify and verify-disks report these correctly as missing. The
only downside is that an user could get confused (lvs reports the volume
as existing, but ganeti as missing). However, this is better than simply
considering virtual LVs as “good”.

No other code beside these two gnt-cluster operations uses the
GetVolumeList function, so we don't change the behaviour of the rest of
the code (e.g. replace-disks, instance info, etc.).

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

14 years agolocking: Acquire SharedLock in shared mode in separate function
Michael Hanselmann [Mon, 14 Sep 2009 11:05:21 +0000 (13:05 +0200)]
locking: Acquire SharedLock in shared mode in separate function

This is for some more symetry with
SharedLock.__exclusive_acquire.

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

14 years agoRpcResult: Fix cases where “failed” wouldn't be set to True
Michael Hanselmann [Wed, 9 Sep 2009 15:51:35 +0000 (17:51 +0200)]
RpcResult: Fix cases where “failed” wouldn't be set to True

This broke “gnt-instance replace-disks --auto” when the instance
is down.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

14 years agolocking: Add level name dict
Michael Hanselmann [Mon, 7 Sep 2009 16:40:53 +0000 (18:40 +0200)]
locking: Add level name dict

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

14 years agoMerge commit 'origin/next' into branch-2.1
Michael Hanselmann [Mon, 14 Sep 2009 10:26:17 +0000 (12:26 +0200)]
Merge commit 'origin/next' into branch-2.1

* commit 'origin/next':
  Fix gnt-node modify online help
  Fix gnt-job info entry in gnt-job(8)
  locking: Don't swallow exceptions
  Add check for duplicate MACs in instance add
  scripts/gnt-node: fix a help string
  Optimise multi-job submit
  Extend gnt-debug with more debugging options

Conflicts:
scripts/gnt-debug: Trivial
scripts/gnt-node: Trivial

14 years agoFix gnt-node modify online help
Guido Trotter [Mon, 14 Sep 2009 10:12:39 +0000 (11:12 +0100)]
Fix gnt-node modify online help

This completes what was began in commit
862b1b2b4c698cec8ad816793172fac9aa7f4cdf

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

14 years agoFix gnt-job info entry in gnt-job(8)
Guido Trotter [Fri, 11 Sep 2009 12:33:07 +0000 (13:33 +0100)]
Fix gnt-job info entry in gnt-job(8)

It currently reports "cancel" in its syntax, which is obviously a
cut&paste error.

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

14 years agolocking: Don't swallow exceptions
Michael Hanselmann [Fri, 11 Sep 2009 14:28:13 +0000 (16:28 +0200)]
locking: Don't swallow exceptions

This is an indentation bug.

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

14 years agocheck-python-code: Report EOL whitespace
Michael Hanselmann [Fri, 11 Sep 2009 12:31:45 +0000 (14:31 +0200)]
check-python-code: Report EOL whitespace

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Luca Bigliardi <shammash@google.com>

14 years agoCheck for tabs and long lines in Python code
Michael Hanselmann [Fri, 11 Sep 2009 11:01:26 +0000 (13:01 +0200)]
Check for tabs and long lines in Python code

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

14 years ago.gitignore: Ignore distcheck directories
Michael Hanselmann [Fri, 11 Sep 2009 12:35:49 +0000 (14:35 +0200)]
.gitignore: Ignore distcheck directories

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Luca Bigliardi <shammash@google.com>