History | View | Annotate | Download (15.6 kB)
Add "reason" as a common parameter for all the RAPI calls
Also, this add an infrastructure for having parameters common to all theRAPI calls.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Add infrastructure for adding common RAPI parameters
Some parameters can be common to all the RAPI calls: this commitadds the possibility of specifying them just once, instead ofmanually adding them to the classes describing each call.
Signed-off-by: Michele Tartara <mtartara@google.com>...
Fix bug in rlib2 unit tests
The "queryargs" parameter of the init function of rlib2 classes shouldbe a dictionary, as defined in the ResourceBase parent class (inlib/rapi/baserlib.py).
In the rlib2 and baserlib unit tests, when the queryargs parameter is not...
baserlib: Make "_OPCODE_ATTRS" public
"_OPCODE_ATTRS" will also be used in the Sphinx extension.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Helper to retrieve access permissions for RAPI resource
Merge similar code into a helper function.
Fix wrong type in a docstring of the RAPI subsystem
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
baserlib: Fix two mistakes in docstring
The method names were wrong due to copy & paste.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Replace frozenset with compat.UniqueFrozenset
This is not a trivial s/frozenset/compat.UniqueFrozenset/, but ratheronly replaces “frozenset” where appropriate. Most of the places are“static” information that doesn't change after the module has beenloaded....
Remove some unused Python code
This patch removes code which is no longer used due to refactoring:
- http.InitSsl, last usage removed in commit 33231500 (“Convert RPC client to PycURL”)- rapi.baserlib.MakeParamsDict, last usage remove in commit 4e5a68f8...
Migrate lib/rapi/baserlib.py from constants to pathutils
File system paths moved from constants to pathutils.
Implement support for query only clients in Rapi
This implements the same query=True|False functionality as inGetClient for cli.py, however since the RAPI code is much moreunit-tested (and the unit-test clients are mocked, for the most part,without support for addresses) we have to do many adaptations in the...
RemoteApiHandler: Add support for mocked LUXI client
This will be used for providing a type-checking RAPI client for tests.
Small fixup to rapi docstrings
The fast that most classes don't override the @cvars means that directreferences to FillOpcode can fail (they do on my workstation, but noton buildbot?). Anyway, for safety, it's best to qualify the name.
Additionally a small typo is fixed....
Merge branch 'devel-2.5'
rlib2: Declare all opcodes and equivalents
By declaring all used opcodes or opcodes equivalent to the operationsexecuted in a resource we will be able to ensure all opcodes are coveredby RAPI (with some exceptions).
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
baserlib: Function to retrieve opcodes used by handler
This will be used to verify opcodes used by RAPI.
baserlib: Accept empty body in FillOpcode
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
baserlib: Add more generic base class for opcode resources
This base class, which employs a meta class for the actual work, allowseasier definitions of RAPI resources using opcodes. Follow-up patcheswill change some of the existing RAPI resources.
The long-term goal with these changes is to make it easier to verify the...
baserlib.ResourceBase: Allow overriding of LUXI client
This enables unittesting of RAPI resources.
baserlib: Rename R_Generic to ResourceBase
Apart from making match Ganeti's code style the name is also moredescriptive.
baserlib: Move GetClient/SubmitJob into base class
Unlike stand-alone functions these will be relatively easy to overridefor unittests.
rapi: Merge tag helpers into resource
They were only used in one place and upcoming changes, enabling testingof resource classes, will be easier with this merge.
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 ofDeprecationWarning being emitted even if one uses the recommendedversion of pylint (0.21.1, as stated in devnotes.rst)....
PEP8 style fixes
Identified using the “pep8” utility.
RAPI: Add support for tagging node groups
baserlib.FillOpCode: Allow parameter rename
Some RAPI parameters don't match the name of the underlyingopcode. With this patch they can be renamed while fillingthe opcode.
Rename OpAddTags and LUAddTags
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: René Nussbaumer <rn@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Rename OpDelTags and LUDelTags
baserlib: Add function for filling opcodes
This function makes use of the opcode parameters which now livedirectly in the opcode. A number of RAPI resources can now be simplified.
luxi: convert permission errors into exception
This patch adds handling of permission errors so that we don't showtracebacks when a non-root user runs a gnt-* command. Since in thefuture we'll have different permissions, we need to handle this in RAPItoo....
baserlib: Fix feedback function
The feedback function is called with only one parameter, a tuplewith the message details.
baserlib: Use boolean type for boolean variables
This does not yet fix all issues in the RAPI interface which wereintroduced with the type system. More testing is needed.
Merge branch 'devel-2.1'
RAPI: /2/{nodes,instances}/$name should return 404 for unknown items
Currently they return a 500 Server Error, not really usefulfor detecting nonexistent items.
Conflicts: daemons/ganeti-noded lib/daemon.py lib/rapi/baserlib.py lib/rapi/rlib2.py lib/utils.py
Signed-off-by: Luca Bigliardi <shammash@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
rapi.baserlib: Add function to check variable type
Also add a separate function to retrieve body parameters. Havingit separate (independent of a class instance) will make it easierto unittest users of this function.
Fix lint warnings after my last changes
rapi: Don't access request's private object directly
This way the request handlers don't need as much knowledgeabout the inside of the request and context objects and itmakes the code a bit shorter.
http.server: No longer enfore JSON encoding for body
The HTTP layer shouldn't care about the contents of the request data orresponses. This requires further changes in the RAPI code to handle clientrequests correctly.
ganeti-rapi: Remove serial number/ETag code
It was never used as intended.
Further pylint disables, mostly for Unused args
Many of our functions have to follow a given API, and thus we have tokeep 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 <iustin@google.com>...
Merge branch 'devel-2.0' into devel-2.1
Add targetted pylint disables
This patch adds targeted pylint disables, where it makes sense (eitherdue to limitations in pylint or due to historical usage), and also a fewblanket ones in rapi where all the names are… “different”.
rapi: fix tag operations
This patch fixes the tag PUT/DELETE operations, and additionally changesthe Tags* functions to take only positional and not keyword arguments(the defaults do not make any sense at all, and they are always calledwith all arguments)....
rapi: Add default parameter to _checkIntVariable
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Merge branch 'next' into branch-2.1
Merge branch 'master' into next
rapi: Add generic “force” parameter
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...
Fix pylint warnings
rapi: implement dry-run mode
This patch implements dry-run mode for the operations which modify thestate of the cluster. Dry-run mode is enabled by passing a 'dry-run'query argument with positive integer value.
rapi: rework error handling
Currently the rapi code doesn't have any custom error handling; anyexceptions raised are simply converted into an HTTP 500 error, withoutmuch explanation.
This patch adds a couple of generic SubmitJob/GetClient functions that...
rapi: make tags query not use jobs
Currently the rapi tags query implementation is similar to the commandline one: it submits OpGetTags jobs. This not good, since this being anAPI it can be used a lot and can pollute the job queue with many suchtrivial jobs....
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...
rapi: fix 'bulk' processing and add locking option
This patch fixes the 'bulk' parameter (before any non-emptyspecification 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...
ganeti-rapi: Implement HTTP authentication
Passwords are stored in "$localstatedir/lib/ganeti/rapi_users". Useroptions specify the access permissions of a user (see docstring forganeti.http.ReadPasswordFile), for which only "write" is supportedto grant write access. Every other user has read-only access....
Fix epydoc format warnings
This patch should fix all outstanding epydoc parsing errors; as such, weswitch epydoc into verbose mode so that any new errors will be visible.
Reviewed-by: imsnah
RAPI: Make calls safier
RAPI: Instance modify.
Split parameters filter to the separate function and reuse it in instance creation.
Pass request headers in to RAPI handlers.
Reviewed-by: iustinp
ETag passing support.
rapi: Convert to new HTTP server class
Requests are no longer logged to a separate file.
Reviewed-by: amishchenko
RAPI Implement DELETE for tags
First write operation (add tag) for Ganeti RAPI
Add instance tag handling, improved error logging....oh, yes adopt instance listing for RAPI2!
Generalization of bulk output mapping
Simplify rapi.baserlib.MapFields()
We can use zip for simplifying this function. Actually, at this pointI'm not sure if it needs to be a separate function at all.
Put the poper RAPI baserlib