Statistics
| Branch: | Tag: | Revision:

root / lib / cli.py @ 413b7472

History | View | Annotate | Download (58 kB)

# Date Author Comment
ec39d63c 01/20/2010 03:47 pm Michael Hanselmann

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 <>...

9fe72672 01/13/2010 03:03 pm Michael Hanselmann

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 <>
Reviewed-by: Iustin Pop <>

7699c3af 01/05/2010 02:56 pm Iustin Pop

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...

8929d28c 01/04/2010 11:16 am Iustin Pop

Optparse extenders have to obey a given API

So we just silence the warning.

Signed-off-by: Iustin Pop <>
Reviewed-by: Olivier Tharan <>

7260cfbe 01/04/2010 11:15 am Iustin Pop

Add targeted pylint disables

This patch should have only:

- pylint disables
- docstring changes
- whitespace changes

Signed-off-by: Iustin Pop <>
Reviewed-by: Olivier Tharan <>

d984846d 12/28/2009 02:05 pm Iustin Pop

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...
fe267188 12/28/2009 12:43 pm Iustin Pop

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 <>...

460d22be 12/16/2009 11:54 am Iustin Pop

Command line/RAPI support for --no-name-check

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

It also adds it to RAPI and gnt-instance batch-create as a parameter in...

1f864b60 11/25/2009 04:30 pm Iustin Pop

Remove quotes from CommaJoin and convert to it

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

21bcb9aa 11/16/2009 06:52 pm Michael Hanselmann

Fix off-by-one error when modifying instance NIC

For an instance with exactly one NIC:

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

d9a51679 11/05/2009 05:36 pm Michael Hanselmann

gnt-*: Print better error message for uninitialized cluster

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Guido Trotter <>

5c983ee5 11/02/2009 04:14 pm Iustin Pop

Introduce two-argument style for OpPrereqError

This patch introduces a two-argument style for OpPrereqError. Only the
direct raise calls in cmdlib.py are converted, other users will follow.

cli.py is modified to handle both two-argument style and the current...

b989b9d9 10/22/2009 04:40 pm Ken Wehr

Adding '--no-ssh-init' option to 'gnt-cluster init'.

Allows the initialization of a cluster without the creation or distribution
of SSH key pairs. Includes changes for LeaveCluster and RPC.

Signed-off-by: Ken Wehr <>
Signed-off-by: Guido Trotter <>...

4d98c565 10/13/2009 04:02 pm Guido Trotter

gnt-* use the correct opcode slot to build opcodes

gnt-* scripts were building wrong opcodes for commands which had the
shutdown_timeout slot (due to missing testing after renaming). Fixing.

Also change SHUTDOWN_TIMEOUT_OPT dest field name to "shutdown_timeout":...

7e5eaaa8 10/13/2009 01:24 pm Guido Trotter

cli: add SHUTDOWN_TIMEOUT_OPT

Signed-off-by: Guido Trotter <>
Reviewed-by: Michael Hanselmann <>

69b99987 10/12/2009 01:48 pm Michael Hanselmann

Code and docstring style fixes

Found using pylint and epydoc.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Guido Trotter <>

b5762e2a 10/09/2009 06:02 pm Guido Trotter

cli: add a timeout option

Signed-off-by: Guido Trotter <>
Reviewed-by: Michael Hanselmann <>

06073e85 10/05/2009 12:47 pm Guido Trotter

Allow --force-variant for instance add/reinstall

Passing this option makes an undeclared variant be passed to the os "as
is", hoping it'll be able to figure it out (as per the design doc).

Signed-off-by: Guido Trotter <>
Reviewed-by: Olivier Tharan <>

07150497 10/05/2009 12:39 pm Guido Trotter

cli.CalculateOSNames

Given an os and its variants, return a list of "full" os names.

Signed-off-by: Guido Trotter <>
Reviewed-by: Olivier Tharan <>

f1501b3f 10/02/2009 06:52 pm Michael Hanselmann

Replace all xrange() with range()

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

e6345c35 09/25/2009 06:56 pm Iustin Pop

Encode the actual exception raised by LU execution

Currently, the actual exception raised during an LU execution (one of
OpPrereqError, OpExecError, HooksError, etc.) is lost because the
jqueue.py code simply sets that to a str(err), and the code in cli.py...

d77490c5 09/18/2009 05:00 pm Iustin Pop

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,...

29392516 09/18/2009 01:53 pm Iustin Pop

Move more cluster init opts to cli.py

Some of these should be added to cluster modify too.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

14e9e7f3 09/18/2009 01:53 pm Iustin Pop

Move cluster verify options to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

12054861 09/18/2009 01:53 pm Iustin Pop

Move the “--reboot-type” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

ee3f9578 09/18/2009 01:53 pm Iustin Pop

Move the “--ignore-secondaries” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

44c44832 09/18/2009 01:53 pm Iustin Pop

Move the “--no-shutdown” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

064c21f8 09/18/2009 01:53 pm Iustin Pop

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 <>...

a72d0a79 09/18/2009 01:53 pm Iustin Pop

Move the “--on-primary” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

feb09e6a 09/18/2009 01:53 pm Iustin Pop

Move the “--on-secondary” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

e00f7a05 09/18/2009 01:53 pm Iustin Pop

Move the “--auto” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

05586c90 09/18/2009 01:53 pm Iustin Pop

Move the “--ignore-size” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

df62e5db 09/18/2009 01:53 pm Iustin Pop

Move the “--src-…” options to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

8d823629 09/18/2009 01:53 pm Iustin Pop

Unify the “--secondary-ip” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

b8d0f938 09/18/2009 01:53 pm Iustin Pop

Move the “--readd” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

fcdde7f2 09/18/2009 01:53 pm Iustin Pop

Move the “--no-ssh-key-check” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

771734c9 09/18/2009 01:53 pm Iustin Pop

Move the node flags options to cli.py

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

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

e7e09483 09/18/2009 01:53 pm Iustin Pop

Move the “--allocatable” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

831040bf 09/18/2009 01:53 pm Iustin Pop

Unify the “--no-lvm-storage” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

383a3591 09/18/2009 01:53 pm Iustin Pop

Unify the “--enabled-hypervisors” option

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

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

4fbc93dd 09/18/2009 01:53 pm Iustin Pop

Unify the “--nic-parameters” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

e32df528 09/18/2009 01:53 pm Iustin Pop

Unify the “--candidate-pool-size” option

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

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

b58726e8 09/18/2009 01:53 pm Iustin Pop

Unify the “--vg-name” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

1f587d3d 09/18/2009 01:53 pm Iustin Pop

Move the “--yes-do-it” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

58371861 09/18/2009 01:53 pm Iustin Pop

Move the “--no-voting” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

e3646f22 09/18/2009 01:53 pm Iustin Pop

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 <>
Reviewed-by: Michael Hanselmann <>

073271f6 09/18/2009 01:53 pm Iustin Pop

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 <>
Reviewed-by: Michael Hanselmann <>

91e0748c 09/18/2009 01:53 pm Iustin Pop

Unify the “--no-ip-check” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

7d3a9fab 09/18/2009 01:53 pm Iustin Pop

Unify the “--net” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

e3876ccb 09/18/2009 01:53 pm Iustin Pop

Unify the “--disk” (identkeyval) option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

4b038a1e 09/18/2009 01:53 pm Iustin Pop

Unify the “--disks” (disk indices) option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

ff00c1a7 09/18/2009 01:53 pm Iustin Pop

Unify the “--os-size” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

82a786d5 09/18/2009 01:53 pm Iustin Pop

Unify the “--ignore-consistency” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

f2a0828c 09/18/2009 01:53 pm Iustin Pop

Unify the “--non-live” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

990b7886 09/18/2009 01:53 pm Iustin Pop

Unify the “--node” (as instance placement) option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

7edc4637 09/18/2009 01:53 pm Iustin Pop

Unify the “--node” (as list of nodes) option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

f36d7d81 09/18/2009 01:53 pm Iustin Pop

Unify the last “--node” (single node) option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

edeb878a 09/18/2009 01:53 pm Iustin Pop

Move the “--no-start” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

fdcf4d84 09/18/2009 01:53 pm Iustin Pop

Move the “--show-cmd” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

baef337d 09/18/2009 01:53 pm Iustin Pop

Move the “--cleanup” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

99a8c799 09/18/2009 01:53 pm Iustin Pop

Move the “--static” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

2d5e7ae1 09/18/2009 01:53 pm Iustin Pop

Move the “--all” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

67840b40 09/18/2009 01:53 pm Iustin Pop

Move the “--select-os” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

b6e841a8 09/18/2009 01:53 pm Iustin Pop

Move the “--ignore-failures” option to cli.py

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

a14db5ff 09/18/2009 01:53 pm Iustin Pop

Unify the “--new-secondary” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

4f365444 09/18/2009 01:53 pm Iustin Pop

Unify the “--disk-template” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

26023ecd 09/18/2009 01:53 pm Iustin Pop

Unify the “--no-nics” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

4a25828c 09/18/2009 01:53 pm Iustin Pop

Unify the “--file-storage-dir” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

0f87c43e 09/18/2009 01:53 pm Iustin Pop

Unify the “--file-driver” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

4eb62659 09/18/2009 01:53 pm Iustin Pop

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....

d3ed23ff 09/18/2009 01:53 pm Iustin Pop

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 <>
Reviewed-by: Guido Trotter <>

087ed2ed 09/18/2009 01:53 pm Iustin Pop

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....

48f212d7 09/18/2009 01:53 pm Iustin Pop

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...

236fd9c4 09/18/2009 01:53 pm Iustin Pop

Unify the “--hypervisor” (with name) option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

3f75b4f3 09/18/2009 01:53 pm Iustin Pop

Unify the “--no-wait-for-sync” option

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

a0c9776a 09/17/2009 05:37 pm Iustin Pop

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...

9cdb9578 09/17/2009 05:12 pm Iustin Pop

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 <>
Reviewed-by: Michael Hanselmann <>

4abc4f1e 09/17/2009 05:11 pm Iustin Pop

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 <>...

2d3ed64b 09/04/2009 06:58 pm Michael Hanselmann

Add bash completion for --node node1[:node2]

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Luca Bigliardi <>

5c566e17 08/28/2009 06:35 pm Michael Hanselmann

Merge branch 'next' into branch-2.1

  • next:
    Add script to clean archived jobs after 21 days
    rapi: export more static node information
    Pass the correct signal to handlers
    cli: Use ToStdout/ToStderr instead of print
    Fix small typo in gnt-node
    Simplify handling of boolean args in rapi...
63d44c55 08/28/2009 06:24 pm Michael Hanselmann

Bash completion: Implement dynamic option value completion

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Olivier Tharan <>

bcb66fca 08/27/2009 06:21 pm Iustin Pop

Encode the actual exception raised by LU execution

Currently, the actual exception raised during an LU execution (one of
OpPrereqError, OpExecError, HooksError, etc.) is lost because the
jqueue.py code simply sets that to a str(err), and the code in cli.py...

dff85078 08/26/2009 07:09 pm Michael Hanselmann

cli._Argument: Remove unused, optional “suggest” parameter

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

83ec7961 08/24/2009 06:01 pm Michael Hanselmann

Add ArgHost class

It expands to the hostnames known by bash.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

4a265c08 08/24/2009 06:01 pm Michael Hanselmann

Re-introduce constants for most often used arguments

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

c38c44ad 08/24/2009 04:53 pm Michael Hanselmann

Make all options use cli_option

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

a8005e17 08/24/2009 04:52 pm Michael Hanselmann

Change scripts to use new argument definitions

This can be used to generate the bash completion script automatically.
In the future it may allow for better command line validation as well.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

863d7f46 08/24/2009 04:51 pm Michael Hanselmann

cli: Add new classes for argument definitions

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

552c8dff 08/18/2009 11:54 am Michael Hanselmann

cli: Merge ikv_option and keyval_option into cli_option

Merging them gets rid of two public functions in cli.py and optparse explicitly
supports more than one option type per class.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

73b90123 08/17/2009 06:26 pm Michael Hanselmann

cli: Use ToStdout/ToStderr instead of print

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>
(cherry picked from commit 03298ebe95f393fc77f8acce62e5aa0b95a2bdd0)

03298ebe 08/17/2009 04:57 pm Michael Hanselmann

cli: Use ToStdout/ToStderr instead of print

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

775c6d3e 07/24/2009 03:01 pm Guido Trotter

Merge branch 'next' into branch-2.1

  • next:
    lvmstrap: Change diskinfo to use GenerateTable
    Get rid of constants.RAPI_ENABLE
    Remove references to utils.debug
    ganeti-rapi, replace hardcoded exit value
    Add the bind-address option to ganeti-rapi
    noded: Abstract hard-coded sys.exit value...
68b1fcd5 07/23/2009 12:07 pm Guido Trotter

Remove references to utils.debug

Various modules set it to True when called in debugging mode, but the
utils module supports no such global.

Signed-off-by: Guido Trotter <>
Reviewed-by: Michael Hanselmann <>

25f9901f 07/19/2009 07:47 pm Iustin Pop

Merge commit 'origin/next' into branch-2.1

Conflicts:
lib/cli.py: trivial extra empty line

b59252fe 07/19/2009 03:03 pm Iustin Pop

Switch gnt-debug submit-job to JobExecutor

Currently gnt-debug submits jobs individually, but in 2.1 JobExecutor
uses the optimized SubmitManyJobs luxi call and as such should be used
whenever multiple jobs need to be submitted.

This patch converts gnt-debug submit-job to use it and also removes an...

f2921752 07/19/2009 02:53 pm Iustin Pop

Modify cli.JobExecutor to use SubmitManyJobs

This patch changes the generic "multiple job executor" to use the many
jobs submit model, which automatically makes all its users use the new
model.

This makes, for example, startup/shutdown of a full cluster much more...

2f7140ba 07/08/2009 12:28 pm Guido Trotter

Merge branch 'next' into branch-2.1

  • next:
    Create a new --no-voting option for masterfailover
    ganeti-masterd: allow non-interactive --no-voting
    Fix pylint warnings
    Add custom pylintrc
    bootstrap: Don't leak file descriptor when generating SSL certificate...
5bbd3f7f 07/07/2009 03:51 pm Michael Hanselmann

Fix some typos

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

cc208ed0 06/29/2009 05:41 pm Guido Trotter

Merge branch 'master' into branch-2.1

  • master:
    Fix adjustement of candidates in cluster modify
    Add a new node list field
    Fix HTTP server library handling of credentials
    Fix a typo in backend.InstanceReboot docstring
    Fix handling of 'vcpus' in instance list...
3126878d 06/29/2009 05:26 pm Guido Trotter

GenericMain, handle ParameterError from _ParseArgs

Before this case was not covered, and printed a stack trace.

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>