Statistics
| Branch: | Tag: | Revision:

root / lib / rapi / baserlib.py @ 68a856ef

History | View | Annotate | Download (14.4 kB)

# Date Author Comment
e4f4896b 09/15/2011 04:40 pm Guido Trotter

Merge branch 'devel-2.5'

  • devel-2.5: (33 commits)
    htools: remove dead code
    hail: don't select the primary as new secondary
    hail: add an extra safety check in relocate
    Fix RAPI documentation for gnt-instance console
    Add SPICE compression and streaming options...
f6ce0ba2 09/14/2011 06:29 pm Michael Hanselmann

rlib2: Declare all opcodes and equivalents

By declaring all used opcodes or opcodes equivalent to the operations
executed in a resource we will be able to ensure all opcodes are covered
by RAPI (with some exceptions).

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

b8ab1c7f 09/14/2011 06:29 pm Michael Hanselmann

baserlib: Function to retrieve opcodes used by handler

This will be used to verify opcodes used by RAPI.

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

c6e1a3ee 09/09/2011 06:04 pm Michael Hanselmann

baserlib: Accept empty body in FillOpcode

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

ab85ce39 09/09/2011 06:04 pm Michael Hanselmann

baserlib.ResourceBase: Allow overriding of LUXI client

This enables unittesting of RAPI resources.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

c08fd0d6 09/09/2011 06:04 pm Michael Hanselmann

baserlib: Add more generic base class for opcode resources

This base class, which employs a meta class for the actual work, allows
easier definitions of RAPI resources using opcodes. Follow-up patches
will change some of the existing RAPI resources.

The long-term goal with these changes is to make it easier to verify the...

26ff6ee2 09/09/2011 05:40 pm Michael Hanselmann

baserlib: Rename R_Generic to ResourceBase

Apart from making match Ganeti's code style the name is also more
descriptive.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

be1ddd09 09/09/2011 05:40 pm Michael Hanselmann

baserlib: Move GetClient/SubmitJob into base class

Unlike stand-alone functions these will be relatively easy to override
for unittests.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

f87ec53f 09/09/2011 05:40 pm Michael Hanselmann

rapi: Merge tag helpers into resource

They were only used in one place and upcoming changes, enabling testing
of resource classes, will be easier with this merge.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

b459a848 08/30/2011 11:24 am Andrea Spadaccini

DeprecationWarning fixes for pylint

In version 0.21, pylint unified all the disable-* (and enable-*)
directives to disable (resp. enable). This leads to a lot of
DeprecationWarning being emitted even if one uses the recommended
version of pylint (0.21.1, as stated in devnotes.rst)....

e687ec01 08/25/2011 01:53 pm Michael Hanselmann

PEP8 style fixes

Identified using the “pep8” utility.

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

414ebaf1 04/21/2011 04:08 pm Michael Hanselmann

RAPI: Add support for tagging node groups

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

b166ef84 02/15/2011 01:09 pm Michael Hanselmann

baserlib.FillOpCode: Allow parameter rename

Some RAPI parameters don't match the name of the underlying
opcode. With this patch they can be renamed while filling
the opcode.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

d1602edc 01/18/2011 01:47 pm Iustin Pop

Rename OpAddTags and LUAddTags

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

3f0ab95f 01/18/2011 01:47 pm Iustin Pop

Rename OpDelTags and LUDelTags

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

cfaeaaf7 01/05/2011 01:27 pm Michael Hanselmann

baserlib: Add function for filling opcodes

This function makes use of the opcode parameters which now live
directly in the opcode. A number of RAPI resources can now be simplified.

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

5a1c22fe 07/28/2010 08:16 pm Iustin Pop

luxi: convert permission errors into exception

This patch adds handling of permission errors so that we don't show
tracebacks when a non-root user runs a gnt-* command. Since in the
future we'll have different permissions, we need to handle this in RAPI
too....

e51ca051 07/12/2010 05:27 pm Michael Hanselmann

baserlib: Fix feedback function

The feedback function is called with only one parameter, a tuple
with the message details.

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

b939de46 07/01/2010 03:12 pm Michael Hanselmann

baserlib: Use boolean type for boolean variables

This does not yet fix all issues in the RAPI interface which were
introduced with the type system. More testing is needed.

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

31ff0247 05/17/2010 02:17 pm Michael Hanselmann

Merge branch 'devel-2.1'

  • devel-2.1:
    RAPI: /2/{nodes,instances}/$name should return 404 for unknown items
    ganeti-masterd: Improve error logging for client requests
    Return disk_template from LUQueryInstanceData
    RAPI client: Rename Get{Node,Instance}Info, add new GetInstanceInfo...
e8ebbd2b 05/17/2010 01:52 pm Michael Hanselmann

RAPI: /2/{nodes,instances}/$name should return 404 for unknown items

Currently they return a 500 Server Error, not really useful
for detecting nonexistent items.

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

1c54156d 05/13/2010 07:40 pm Luca Bigliardi

Merge branch 'devel-2.1'

Conflicts:
daemons/ganeti-noded
lib/daemon.py
lib/rapi/baserlib.py
lib/rapi/rlib2.py
lib/utils.py

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

af6433c6 05/13/2010 04:58 pm Michael Hanselmann

rapi.baserlib: Add function to check variable type

Also add a separate function to retrieve body parameters. Having
it separate (independent of a class instance) will make it easier
to unittest users of this function.

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

2feecf12 01/22/2010 06:08 pm Michael Hanselmann

Fix lint warnings after my last changes

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

627ad739 01/22/2010 04:36 pm Michael Hanselmann

rapi: Don't access request's private object directly

This way the request handlers don't need as much knowledge
about the inside of the request and context objects and it
makes the code a bit shorter.

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

ab221ddf 01/22/2010 04:17 pm Michael Hanselmann

http.server: No longer enfore JSON encoding for body

The HTTP layer shouldn't care about the contents of the request data or
responses. This requires further changes in the RAPI code to handle client
requests correctly.

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

c10e2751 01/22/2010 04:17 pm Michael Hanselmann

ganeti-rapi: Remove serial number/ETag code

It was never used as intended.

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

2d54e29c 01/04/2010 11:17 am Iustin Pop

Further pylint disables, mostly for Unused args

Many of our functions have to follow a given API, and thus we have to
keep a given signature, but pylint doesn't understand this. Therefore,
we silence this warning.

The patch does a few other cleanups.

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

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

64246438 10/13/2009 03:03 pm Iustin Pop

rapi: fix tag operations

This patch fixes the tag PUT/DELETE operations, and additionally changes
the Tags* functions to take only positional and not keyword arguments
(the defaults do not make any sense at all, and they are always called
with all arguments)....

3fb8680a 07/30/2009 07:36 pm Michael Hanselmann

rapi: Add default parameter to _checkIntVariable

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

539210af 07/17/2009 02:41 pm Guido Trotter

Merge branch 'next' into branch-2.1

  • next:
    Fix another issue with hypervisor_name change
    Update NEWS and version for 2.0.2 release
    Improve the description of node flags in man page
    Add enabled hypervisors to TestConfigRunner
    Add a few more checks to verify config...
2a061e15 07/17/2009 02:40 pm Guido Trotter

Merge branch 'master' into next

  • master:
    Update NEWS and version for 2.0.2 release
    Improve the description of node flags in man page
    Change default stripe count to 1
    Use full-stripe size in LVM growth
    RAPI: implement instance reinstall
3427d34f 07/13/2009 05:58 pm Michael Hanselmann

rapi: Add generic “force” parameter

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

e5b7c4ca 07/13/2009 12:47 pm Iustin Pop

RAPI: implement instance reinstall

This patch adds instance reinstall to RAPI, with two optional parameters:
- ‘os', in order to change the OS on reinstall
- ‘nostartup’, in order to leave the instance down after reinstall

The call will first shutdown the instance, the reinstall it, and unless...

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...
7c4d6c7b 07/07/2009 03:54 pm Michael Hanselmann

Fix pylint warnings

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

6f59b964 06/19/2009 04:24 pm Iustin Pop

rapi: implement dry-run mode

This patch implements dry-run mode for the operations which modify the
state of the cluster. Dry-run mode is enabled by passing a 'dry-run'
query argument with positive integer value.

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

59b4eeef 05/25/2009 01:12 pm Iustin Pop

rapi: rework error handling

Currently the rapi code doesn't have any custom error handling; any
exceptions raised are simply converted into an HTTP 500 error, without
much explanation.

This patch adds a couple of generic SubmitJob/GetClient functions that...

25e39bfa 05/25/2009 12:14 pm Iustin Pop

rapi: make tags query not use jobs

Currently the rapi tags query implementation is similar to the command
line one: it submits OpGetTags jobs. This not good, since this being an
API it can be used a lot and can pollute the job queue with many such
trivial jobs....

6e99c5a0 02/13/2009 05:54 pm Iustin Pop

RAPI: fixes related to write mode

This patch fixes many small issues related to write functions:
- update documentations w.r.t. how to add users
- update the instance add function for latest API
- add instance delete
- fix addition of tags
- update some error messages...

3d103742 02/04/2009 09:14 pm Iustin Pop

rapi: fix 'bulk' processing and add locking option

This patch fixes the 'bulk' parameter (before any non-empty
specification was considered True, in conflict with the documentation,
i.e. bulk=0 still did bulk queries).

The patch also adds optional locking on the instance/node listing (does...

b5b67ef9 12/19/2008 02:58 pm Michael Hanselmann

ganeti-rapi: Implement HTTP authentication

Passwords are stored in "$localstatedir/lib/ganeti/rapi_users". User
options specify the access permissions of a user (see docstring for
ganeti.http.ReadPasswordFile), for which only "write" is supported
to grant write access. Every other user has read-only access....

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

21f04e5e 11/26/2008 01:25 pm Oleksiy Mishchenko

RAPI: Make calls safier

Reviewed-by: imsnah

d50b3059 11/19/2008 01:09 pm Oleksiy Mishchenko

RAPI: Instance modify.

Split parameters filter to the separate function and reuse it in instance creation.

7a8f64da 10/21/2008 11:32 pm Oleksiy Mishchenko

Pass request headers in to RAPI handlers.

Reviewed-by: iustinp

713faea6 10/17/2008 04:06 pm Oleksiy Mishchenko

ETag passing support.

Reviewed-by: imsnah

16a8967d 10/16/2008 07:54 pm Michael Hanselmann

rapi: Convert to new HTTP server class

Requests are no longer logged to a separate file.

Reviewed-by: amishchenko

15fd9fd5 07/31/2008 03:58 pm Oleksiy Mishchenko

RAPI Implement DELETE for tags

Reviewed-by: imsnah

441e7cfd 07/31/2008 12:06 pm Oleksiy Mishchenko

First write operation (add tag) for Ganeti RAPI

Add instance tag handling, improved error logging.
...oh, yes adopt instance listing for RAPI2!

Reviewed-by: iustinp

51ee2f49 07/23/2008 05:16 pm Oleksiy Mishchenko

Generalization of bulk output mapping

Reviewed-by: iustinp

dca1764e 07/23/2008 03:13 pm Iustin Pop

Simplify rapi.baserlib.MapFields()

We can use zip for simplifying this function. Actually, at this point
I'm not sure if it needs to be a separate function at all.

Reviewed-by: imsnah

c2dca9af 07/22/2008 05:12 pm Oleksiy Mishchenko

Put the poper RAPI baserlib

Reviewed-by: imsnah