Statistics
| Branch: | Tag: | Revision:

root / lib / cli.py @ 9ebe9556

History | View | Annotate | Download (31.6 kB)

# Date Author Comment
d48031a1 05/26/2009 06:27 pm Iustin Pop

Add a new CONFIRM_OPT option to cli.py

Today we are not very consistent as to what ‘--force’ represents:
sometimes confirmation, sometimes forcing a possible dangerous option,
etc.

This patch adds a new ‘--yes’ option that should be used for all simple
confirmations of genre “yes, I really want to remove the instance”....

23b4b983 05/22/2009 03:58 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...

dcbd6288 05/18/2009 07:39 pm Guido Trotter

Fix gnt-job list argument handling

Currently QueryJob returns "None" when a wrong job ID is passed.
Handle this in gnt-job list, by printing an error for each wrong job,
and still giving output for all the jobs which actually do exist.

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

5fcc718f 02/27/2009 03:06 pm Iustin Pop

Fix some epydoc style issues

99% of the epydoc return tags are "@return:", but each of the modified files
had one "@returns:" line. We fix this for consistency.

Reviewed-by: imsnah

ea5a5b74 02/13/2009 02:28 pm Guido Trotter

Remove two fixed FIXME and convert one to TODO

The cli FIXME is not something broken, but rather some better handling
feature we'd rather have, and the two backend FIXME are done (disks have
their read only parameter set, and the error is raised and thus reaches...

a5728081 02/10/2009 05:06 pm Guido Trotter

Instance parameters: force typing

We want all the hv/be parameters to have a known type, rather than a
random mix of empty string, boolean values, and None, so we declare the
type of each variable and we enforce/convert it.

- Add some new constants for enforceable value types...

2e7b8369 02/05/2009 12:45 pm Iustin Pop

Fix some issues for lockless queries

This patch converts some more jobs with only queries into cheaper luxi
queries (no job created), and fixes some fallout from the lockless
queries changes.

Reviewed-by: ultrotter

ec79568d 02/04/2009 12:30 pm Iustin Pop

Implement lockless query operations

This patch adds the framework for, and enables lockless OpQueryInstances. This
means that instances will be shown in ERROR_up or ERROR_down state, even though
this is not an error (but just an in-progress job).

The framework is implemented as follows:...

26f15862 02/03/2009 04:45 pm Iustin Pop

An attempt at fixing some encoding issues

This patch unifies the hardcoded re-encoding attempts into a single
function in utils.py. This function is used to take either an unicode or
str object and convert it to a ASCII-only str object which can be safely...

479636a3 01/27/2009 05:41 pm Iustin Pop

Rework the multi-instance gnt commands

This patch changes the multi-instance gnt-* commands (gnt-instance
start/stop, gnt-node evacuate/failover) such that the individual
operations are submitted in parallel, ideally improving the speed of the
execution....

4040a784 01/12/2009 06:06 pm Iustin Pop

Skip offline nodes in gnt-cluster commands

This patch makes gnt-cluster copyfile and command skip the offline
nodes.

Reviwed-by: ultrotter, imsnah

f87b405e 12/17/2008 03:18 pm Michael Hanselmann

Add job queue size limit

A job queue with too many jobs can increase memory usage and/or make
the master daemon slow. The current limit is just an arbitrary number.
A "soft" limit for automatic job archival is prepared.

Reviewed-by: iustinp

c41eea6e 12/11/2008 07:13 pm Iustin Pop

Fix epydoc format warnings

This patch should fix all outstanding epydoc parsing errors; as such, we
switch epydoc into verbose mode so that any new errors will be visible.

Reviewed-by: imsnah

fbf0262f 11/28/2008 12:28 pm Michael Hanselmann

jqueue: Allow jobs waiting for locks to be canceled

- Add new "canceling" status
- Notify clients when job is canceled
- Give a return value from CancelJob
- Handle it in the client library

Reviewed-by: iustinp

0e050889 11/27/2008 05:12 am Iustin Pop

Small change to job failure output

Currently, job failures are done by raising OpExecError(job result). For
a one-opcode job that failed, this is very non-intuitive:
Failure: command execution error:
[u'Disk size change not possible, use grow-disk']

This patch changes the output in two ways:...

9fbfbb7b 11/23/2008 05:34 pm Iustin Pop

Enable auto-unit formatting in script output

This patch enables by default the old 'human-readable' option, but in a
slightly different model.

The option is now called "units" and takes either:
- 'h' for automatic formatting
- 'm', 'g' or 't' for mebi/gibi/tebibytes...

00430f8e 11/21/2008 05:36 pm Iustin Pop

Make cli.py use FieldSet for matching fields

This changes cli.py to FieldSet usage so that gnt-instance list will
format nicely the disk.size/*, and the count of disks/nics.

Reviewed-by: ultrotter

4331f6cd 11/21/2008 12:45 pm Michael Hanselmann

Reuse HTTP client pool for RPC

ganeti-masterd: Add initialization and shutdown of RPC pool. It needs
to be shutdown before forking.

ganeti.cli: Add decorator function to initialize and shutdown RPC pool.

ganeti.rpc: Add functions to initialize and shutdown RPC pool. Throw...

71c1af58 11/18/2008 12:06 pm Iustin Pop

Allow querying of variable number of parameters

This patch adds support for querying in gnt-instance list of:
- disk.count
- nic.count
- disk.size/$N
- nic.(ip|mac|bridge)/$N

The patch also disables the exception raised when the header description...

d8353c3a 10/23/2008 05:19 pm Iustin Pop

Fix gnt-* command with --submit

Currently we don't catch the JobSubmittedException (although the code to
format it nicely is there). The patch adds the exception name to the
catch list and makes --submit work.

Reviewed-by: imsnah

82d9caef 10/20/2008 03:50 pm Iustin Pop

Remove the logger.py module

Since now we use only one function from the logger module
(SetupLogging), we move it to utils.py (which is already imported by all
users of this function), and we remove the module.

Reviewed-by: imsnah

46fbdd04 10/20/2008 03:33 pm Iustin Pop

Convert cli.py to logging

We also add two function for printing messages, so that scripts won't
have to import logger to get these. They are a simple extension over the
logger ones, as they accept the call style from logging:
ToStdout("Message: %s", msg)...

686d7433 10/15/2008 01:52 pm Iustin Pop

Implement the job queue drain flag

We add a (per-node) queue drain flag that blocks new job submission.
There is not yet an interface to add/remove the flag (will come in next
patches).

Reviewed-by: imsnah

a604f165 10/14/2008 02:29 pm Iustin Pop

Add cli function for beparams validation

This is used to validate the parameters in both “gnt-instance add” and
“gnt-backup import”.

Reviewed-by: ultrotter

fcd62d84 10/14/2008 09:38 am Iustin Pop

Implement parameter removal in SplitKeyVal

This patch adds paramter removal in SplitKeyVal, by prefixing a
value-less key with "-"; this is needed in resetting parameters back to
cluster defaults, but care must be applied now that None can come from
the parser....

a8469393 10/13/2008 03:17 pm Iustin Pop

Add two new options types for CLI usage

For the new 2.0-style command line options, we need to parse strings of
the type:
ident:key=val[,...]
and
key=val[,...]

This patch adds two new option builders for these two, which return
(ident, {key=val,}) and {key=val,} for the above two formats. It also...

07cd723a 10/06/2008 07:42 pm Iustin Pop

Implement job auto-archiving

This patch adds a new luxi call that implements auto-archiving of jobs
older than a certain age (or -1 for all completed jobs), and the gnt-job
command that makes use of this (with 'all' for -1).

Reviewed-by: imsnah

2241e2b9 10/06/2008 06:59 pm Iustin Pop

Add a simple timespec parsing function

This function will be used for auto-archiving jobs via the command line.
The function is pretty simple, we only support up to weeks since months
and higher are not 'precise' entities, and dealing with them would
require us to start using calendar functions....

e0ec0ff6 10/06/2008 04:40 pm Iustin Pop

Fix gnt-job list with empty timestamps

In case the job object doesn't have a timestamp (which is a separate
issue), the listing should not break. We fix this by changing the
FormatTimstamp function itself to return '?' in case the timestamp
doesn't look good (note that it still can break if non-integers are...

53c04d04 10/01/2008 11:29 am Iustin Pop

Change the results from cli.PollJob

Curently PollJob accepts a generic job, but will return (history
artifact) only the first opcode result. This is wrong, as it doesn't
allow polling of a job with multiple results.

Its only caller (for now) is also changed, so no functional changes...

3386e7a9 09/30/2008 12:36 pm Iustin Pop

Abstract the timestamp formatting into cli.py

Currently we format the timestamp inside the gnt-job info function. We
will need this more times in the future, so move it to cli.py as a
separate, exported function.

Reviewed-by: imsnah

e9d741b6 09/10/2008 06:43 pm Iustin Pop

Rewrite the 'only submit job' handling in scripts

The "sys.exit(0)" was not nice as you couldn't differentiate it from
other exit codes. We change this to a specially defined exception for
this, so that multi-opcode commands can handle this nicely.

Reviewed-by: imsnah

082c5adb 08/28/2008 06:35 pm Michael Hanselmann

Fix error message when masterd is not listening

Reported by Iustin.

Reviewed-by: iustinp

6c5a7090 08/27/2008 11:34 am Michael Hanselmann

Make sure that client programs get all messages

This is a large patch, but I can't figure out how to split it without
breaking stuff. The old way of getting messages by always getting the
last one didn't bring all messages to the client if they were added...

853e7f3d 08/11/2008 07:28 pm Michael Hanselmann

cli: Use new RPC call instead of polling

This means commands will not take at least one second anymore.

Reviewed-by: ultrotter

d5e317ba 08/11/2008 07:27 pm Michael Hanselmann

jqueue: Change log message time format

See the comment in the patch.

Reviewed-by: ultrotter

281606c1 08/07/2008 12:07 pm Michael Hanselmann

Fix cli.PollJob

feedback_fn wasn't passed to it.

Reviewed-by: iustinp

94428652 08/04/2008 12:47 pm Iustin Pop

Implement job submission for scripts

This patch adds the infrastructure for executing a job in background,
instead of foreground, via a new “--submit” option. The behaviour is
that the job ID is printed and the script will immediately exit.

The patch also converts gnt-node list to this model (yes, this will be a...

0a1e74d9 07/31/2008 05:52 pm Iustin Pop

Split cli.SubmitOpCode in two parts

The current SubmitOpCode function is not flexible enough to be used for
submitters that don't want to wait for the job finish.

The patch splits this in two, a SendJob function and a PollJob one, and
the old SubmitOpCode becomes a wrapper. Note that the new SendJob takes...

b33e986b 07/30/2008 06:06 pm Iustin Pop

Make gnt-* commands fail nicely on non-masters

This patch adds a check that we are on the master after failing to
connect to the socket, and log nicely the master name.

Reviewed-by: ultrotter

38206f3c 07/30/2008 05:04 pm Iustin Pop

Fix pylint-detected issues

This is mostly:
- whitespace fix (space at EOL in some files, not all, broken
indentation, etc)
- variable names overriding others (one is a real bug in there)
- too-long-lines
- cleanup of most unused imports (not all)...

59f187eb 07/30/2008 03:32 pm Iustin Pop

Unify SetupDaemon/SetupLogging

The 'old-style' info, error, debug logs do not make much sense. This
patch unifies the SetupLogging and SetupDaemon functions. As a result,
all the commands logs to a 'commands.log' file.

The patch also changes the log setup to keep going if there's an error...

e2212007 07/14/2008 04:38 pm Iustin Pop

Improve cli.SubmitOpCode

Currently, the feedback_fn argument to SubmitOpCode is no longer used.
We still need it in burnin, so we re-enable it by making the code call
that function with the msg argument in case feedback_fn is callable. The
patch also modifies burnin to accept the new argument format (msg is not...

f1048938 07/14/2008 04:15 pm Iustin Pop

First version of user feedback fixes

This patch contains a raw version for fixing feedback_fn.

The new mechanism works as follows:
- instead of a per-Processor feedback_fn, there's one for each
ExecOpCode, so that feedback for different opcodes go via possibly...

af30b2fd 07/11/2008 01:25 pm Michael Hanselmann

Make "gnt-job list" work again

"gnt-job list" was broken after my recent changes in the RPC
between clients and the master. This patch makes it work again.

Reviewed-by: iustinp

0bbe448c 07/09/2008 01:34 pm Michael Hanselmann

Change masterd/client RPC protocol

- Introduce abstraction class on client side
- Use constants for method names
- Adopt legacy function SubmitOpCode to use it

Reviewed-by: iustinp

2cb687ad 07/03/2008 03:06 pm Iustin Pop

Reuse the luxi client in cli.SubmitOpCode

By a mistake, we don't reuse the luxi client. As such, we open and close
the connection at each poll cycle and spam the server logs.

Reviewed-by: ultrotter

03a8dbdc 06/21/2008 09:49 pm Iustin Pop

Implement handling of luxi errors in cli.py

Currently the generic handling of ganeti errors in cli.py (GenericMain
and FormatError) only handles the core ganeti errors, and not the client
protocol errors (which live in a separate hierarchy).

This patch adds handling of luxi errors too, and also adds another luxi...

2a2060ff 06/13/2008 03:46 pm Michael Hanselmann

Replace logging functions with calls to logging module

- Shorter code
- Reorder arguments to logger.SetupLogging calls to make more sense

Reviewed-by: iustinp

c4dbb30a 06/12/2008 01:06 pm Michael Hanselmann

Remove unreachable code from cli.SubmitOpCode

Reviewed-by: iustinp

4e713df6 05/13/2008 04:41 pm Iustin Pop

CLI: retry: remove command opts/args in "gnt-X"

This new version of the patch removes only the listing of the usage in
the "gnt-X" list, but keeps the strings in since we'll want to enhance
and use them in "gnt-X $cmd --help".

Reviewed-by: ultrotter

9a033156 05/13/2008 04:04 pm Iustin Pop

Revert "CLI: remove command opts/args in "gnt-X""

This reverts commit 976.

Reviewed-by: ultrotter

57d0151e 05/13/2008 03:24 pm Iustin Pop

CLI: remove command opts/args in "gnt-X"

[Forward-port of the 1.2 branch patch]

This patch removes all the parameters and options from the output
"gnt-X" (i.e. the subcommand list for command). This is done in order to
uniformize the output, currently only some parameters are shown and they...

a4af651e 04/28/2008 04:02 pm Iustin Pop

Move the 'cmd' lock from cli.py to ganeti-masterd

This patch removes the lock and the lock options from cli.py and moves
them to the master.

Later during development we can remove it completely, but for now it's
good to protect any other tool that uses the lock directly....

685ee993 04/28/2008 04:01 pm Iustin Pop

Convert cli.SubmitOpCode to use the master

This patch converts the cli.py SubmitOpCode method to use the unix
protocol and thus execute the opcodes via the master.

The patch allows a partial burnin to work with the master. Currently the
query opcodes, since they are executed via the SubmitOpCode, are...

a14a17fc 04/07/2008 02:15 pm Iustin Pop

Move some checks from cli.py to luxi.py

The idea of cli.py and luxi.py is that all protocol checks should be in
luxi, and cli.py should just offer some helpful shortcuts for the
command line scripts.

This patch removes the result checks from cli and adds some other checks...

ceab32dd 04/01/2008 04:05 pm Iustin Pop

Add submit function to lib/cli.py

This patch adds function that submit jobs or queries over the unix socket
interface to lib/cli.py. The will be used by the scripts instead of the
SubmitOpCode function.

Reviewed-by: ultrotter

d8a4b51d 01/28/2008 04:32 pm Iustin Pop

Improve the documentation of query output fields

The gnt-node and gnt-instance list commands have a customizable list of
output fields, but the list is not up to date (in the man page) and not
easily understandable from the ‘--help’ output.

This patch updates the man pages and adds the available fields and...

70a35b6f 01/25/2008 05:36 pm Guido Trotter

Add a missing parenthesis

It was wrongly deleted when converting

if a in dict.keys():
to
if a in dict:

Reviewed-by: imsnah

de47cf8f 01/21/2008 06:28 pm Guido Trotter

Add support for command aliases

Passing a new aliases dict to generic main we can easily support aliases for
compatibility reasons or simply useability.

Reviewed-by: iustinp

36c68ff1 12/12/2007 05:18 pm Iustin Pop

Handle ^C while trying to acquire the lock

When waiting for the lock and pressing ^C, the user will get a backtrace
as the KeyboardInterrupt exception is not handled. The patch adds a
simple method of handling it.

Note that this is not about ^C in any other place....

f362096f 11/29/2007 06:03 pm Iustin Pop

Make utils.RunCmd log failures when using debug

This patch adds logging of command failures to the debug log in case the
user either started the command (gnt-*) or the node daemon with the
debug flag.

Reviewed-by: imsnah

60d49723 11/06/2007 07:04 pm Michael Hanselmann

Remove --secondary-node option.

Replace --secondary-node option with an optional parameter for --node.

e2e521d0 11/05/2007 11:22 pm Iustin Pop

Small cleanup for error formatting

Reviewed-by: ultrotter

65fe4693 11/05/2007 05:06 pm Iustin Pop

Miscellaneous style fixes

This patch fixes some minor pylint warnings (unused variables, wrong
indentation, etc.) and a real bug in the recovery for drbd8 rename
procedure.

Reviewed-by: imsnah

1a8c0ce1 10/29/2007 10:09 pm Iustin Pop

Change the signature of some methods of mcpu.Processor

This patch moves the passing of the feedback_fn argument from the
(Exec|Chain)OpCode to the initialization of the Processor instance.

Reviewed-by: imsnah

01ca31ae 10/10/2007 06:06 pm Iustin Pop

Some small fixes to utils.GenerateTable

This adds:
- fix the case when a dumb caller didn't stringify its values
- explicitly raise a ProgrammerError in case a field is missing from
the headers dictionary

Reviewed-by: imsnah

3023170f 10/10/2007 05:04 pm Iustin Pop

Fix AskUser to not die on extra input

Currently, AskUser dies with -ESPIPE if the user gives more than one
character plus newline. This is because the python library, while
returning only two chars from the readline(2) call, will cache the rest
of the input, and when we do a write, it will try to seek back to just...

2f31098c 10/10/2007 01:00 pm Iustin Pop

Remove the shebang from modules

Since modules are not directly executables, remove the shebang from
them. This helps with lintian warnings.

Also make the autogenerated _autoconf.py contain two comment lines at
the beginning, like the other modules.

Reviewed-by: ultrotter

0c434948 10/09/2007 12:13 pm Iustin Pop

Fix a wrong exception name

This was introduced in rev 208.

Reviewed-by: imsnah

73702ee7 10/09/2007 12:13 pm Iustin Pop

Separate error formatting out of cli.GenericMain

This patch moves the error formatting into a separate function that will
be exported so that scripts that execute multiple opcodes can create the
same output as for GenericMain. Also, GenericMain becomes more readable....

9f33ef86 10/09/2007 10:39 am Iustin Pop

Enhance cli.SubmitOpcode to use custom parameters

This patch allows the SubmitOpcode function to take a pre-created
Processor instance and a different feedback function. This is helpful
when submitting more than one opcode from a shell script.

Reviewed-by: imsnah

b9ea6acb 10/08/2007 06:12 pm Iustin Pop

Add handler for errors.TagError

This patch adds a simple handler for TagError that prints the error
(better than having a stack dump).

Reviewed-by: imsnah

810c50b7 10/08/2007 06:12 pm Iustin Pop

Add source file option for {add,remove}-tags

This patch adds a '--from' option to the {add,remove}-tags commands that
allows the command to read from a file or from stdin (when passing a
dash for the filename).

Reviewed-by: imsnah

846baef9 10/08/2007 06:11 pm Iustin Pop

Implement command-line tags support

This patch adds generic functions for tag manipulations to cli.py and
modifies gnt-{cluster,node,instance} to export {list,add,remove}-tags
commands that use those.

Reviewed-by: imsnah

334d1483 10/08/2007 05:42 pm Iustin Pop

Extend GenericMain with a way to override options

This allows scripts to pass options to generic functions (options that
are not visible in the command line).

Reviewed-by: imsnah

89e1fc26 09/21/2007 04:37 pm Iustin Pop

Remove requirement that host names are FQDN

We currently require that hostnames are FQDN not short names
(node1.example.com instead of node1). We can allow short names as long
as:
- we always resolve the names as returned by socket.gethostname()
- we rely on having a working resolver...

47988778 09/19/2007 05:24 pm Iustin Pop

Improve the cli.AskUser() function

This patch improves the AskUser function by allowing it to:
- choose from multiple choices (instead of only y/n)
- give help to the user
- preserve line breaks and whitespace formatting in the message

With this patch, an instance removal looks like this:...

16be8703 08/17/2007 12:14 pm Iustin Pop

Change cli.OutputTable to cli.GenerateTable

Since the table generation might be useful elsewhere, let's change it to
return the data instead of directly printing it.

Its callers have also been updated.

Reviewed-by: imsnah

3ecf6786 08/14/2007 06:17 pm Iustin Pop

Style changes for pep-8 and python-3000 compliance.

This changes the raising of exceptions from:
raise Exception, value
to
raise Exception(value)

as the first form will be removed in python-3000 and the second form is
preferred now.

The changes also involve a few cases of changing from raising standard...

fe7b0351 07/26/2007 07:09 pm Michael Hanselmann

- Move --force option to cli.py
- Implement “gnt-instance reinstall”
- Fix two typos

Reviewed-by: iustinp

098c0958 07/26/2007 02:40 pm Michael Hanselmann

Comment formatting updates.

Reviewed-by: iustinp

137161c9 07/24/2007 04:29 pm Michael Hanselmann

Use generic function to output tables.

Reviewed-by: iustinp

dcb93971 07/24/2007 02:45 pm Michael Hanselmann

- Implement “gnt-node volumes”
- Create all --output options using a constant
- Put node checking code from opcodes into a single function
- Do the same for output fields

Reviewed-by: iustinp

a8083063 07/16/2007 04:39 pm Iustin Pop

Initial commit.