Statistics
| Branch: | Tag: | Revision:

root / test / ganeti.cli_unittest.py @ d3b51156

History | View | Annotate | Download (32 kB)

# Date Author Comment
26a72a48 03/30/2012 03:02 pm Michael Hanselmann

Merge cli.FormatTimestamp and utils.FormatTime

… to some degree at least. Unittests are included.

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

956631b6 02/17/2012 06:54 pm Michael Hanselmann

cli: Handle negative numbers when parsing key-value assignments

To remove the last disk, or to add a NIC to the end, one can use the
index 1. This wouldn't work as intended as “” is a special prefix.

Signed-off-by: Michael Hanselmann <>...

2e5c33db 10/12/2011 02:01 pm Iustin Pop

Rename filter and filter_ to qfilter

We currently use 'filter' as the OpCode, QueryRequest and RAPI field
name for representing a query filter. However, since 'filter' is a
built-in function, we actually have to use filter_ throughout the code
in order to not override the built-in function....

05484a24 07/12/2011 06:23 pm Michael Hanselmann

cli.GetOnlineNodes: Support node group filter, use query2

This patc changes cli.GetOnlineNodes to use query2, which does the
filtering in the master daemon, and adds a new parameter to filter by
node group.

Unittests were added for the old implementation and then adopted to...

f2c6673d 02/22/2011 08:05 pm Michael Hanselmann

Add unittest for cli.FormatResultError

Also make the parameter for verbosity mandatory.

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

f0b1bafe 02/18/2011 04:47 pm Iustin Pop

Change the list formatting to a 'special' chars

And also enable verbose display via the, well, verbose option. Man
page and tests are updated, and the formatting is moved from 4 if
statements to a data structure.

Signed-off-by: Iustin Pop <>...

cfb084ae 01/21/2011 11:04 am René Nussbaumer

Rename QRFS_* to RS_*

This patch renames QRFS_* to RS_* fields so they can be used in other
places (i.e. LUs) without confusion, as this was initially meant for
query operations.

Signed-off-by: René Nussbaumer <>
Reviewed-by: Iustin Pop <>

a6070ef7 01/05/2011 12:39 pm Michael Hanselmann

query2: Add new field status “offline”

This allows “gnt-node list” to show the difference between modes marked
offline and nodes with e.g. RPC errors (“(nodata)”). node1 is the
master, node2's node daemon crashed and node3 is marked offline:

$ gnt-node list -o name,offline,dtotal,dfree...

2466c0fd 12/30/2010 07:51 pm Michael Hanselmann

cli: Change “<…>” in query output to “(…)”

This should reduce the amount of damage in case of accidential copy &
paste.

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

ee3aedff 12/14/2010 03:23 pm Michael Hanselmann

cli: Add infrastructure for query2

A new function for formatting the query results is added,
``FormatTable``. This was determined to be easier and safer than
modifying the existing ``GenerateTable`` function while keeping
backwards compatibility for code not yet converted. The new code makes...

72884fef 10/05/2010 06:08 pm Michael Hanselmann

Merge branch 'devel-2.2'

  • devel-2.2:
    Add simple unittest for utils.CommaJoin
    LUDelTags: Improve formatting of error message
    LUGetTags: Acquire locks in shared mode
    gnt-cluster: Replace hardcoded “xenvg” with value retrieved from master
    Export VG name via LUQueryConfigValues...
845c79d8 10/05/2010 05:59 pm Michael Hanselmann

cli: Move parsing of --net option to separate function

This function will also be used in tools/move-instance.

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

84a5b33c 09/13/2010 06:35 pm Michael Hanselmann

cli: Add option definition for priority

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

a4ebd726 08/23/2010 06:26 pm Michael Hanselmann

Use one function to parse “--fields” option values

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

8a7f1c61 07/12/2010 05:27 pm Michael Hanselmann

Add function to format all job log messages

Just calling utils.SafeEncode on the log message failed when it
wasn't of the type ELOG_MESSAGE and not a string. Now non-message
log entries are formatted using repr().

Signed-off-by: Michael Hanselmann <>...

4e338533 05/10/2010 05:17 pm Michael Hanselmann

cli: Make PollJob generic to support other protocols

By separating the LUXI-specific code and stdio-related code
into separate classes, we can make cli.PollJob protocol-
agnostic, allowing it to be used with RAPI.

This patch also adds unittests for cli.PollJob....

2ebf1568 01/20/2010 03:47 pm Michael Hanselmann

Add unittests for cli.GenerateTable

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

25231ec5 11/03/2009 12:34 pm Michael Hanselmann

Ignore log messages in unittests

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

8b46606c 06/29/2009 05:26 pm Guido Trotter

check_ident_key_val, handle no_ and - prefixes

If an ident member of an IdentKeyVal relationship starts with no_ or -,
handle it the same way we do for a key. Some unittests are added to
check that check_ident_key_val behaves as expected.

This patch also changes ForceDictType to, for now, fail on such an...

4f31882e 06/29/2009 04:14 pm Guido Trotter

_SplitKeyVal with no data return an empty dict

If an empty string is passed to _SplitKeyVal, we should return {},
rather than {'': True}. Also test for the correct behavior.

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

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

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

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