Merge branch 'stable-2.10' into master
Replace errors re-export in luxi.py with proper imports
Instead of re-exporting errors in luxi.py, import rpc/errors.py in themodules that use them.
Signed-off-by: Petr Pudlak <pudlak@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Split Luxi Client into a generic and a specific part
The generic part will be reused in WConfd.
Signed-off-by: Petr Pudlak <pudlak@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Instance queries: remove opcodes and LU
Removes the remains of the instance queries.
Signed-off-by: Helga Velroyen <helgav@google.com>Reviewed-by: Hrvoje Ribicic <riba@google.com>
Export and network queries: remove opcodes and LUs
Removes the remains of the export (aka backup) and networkqueries.
Group queries: remove opcodes and LUs
Removes the remains of the group query code.
Node queries: remove opcodes and LUs
Removes the remains of the node query code.
Adjust console behavior wrt to operation state
Unlike its cli counterpart, the rapi console operation didnot properly take into account whether the instance isactually running. This patch fixes this problem.
Signed-off-by: Helga Velroyen <helgav@google.com>...
User query client necessary for instance queries
There were some places left when code querying for instanceinformation did not use the query client yet.
Use a query client for node queries where necessary
To remove the node query's python implementation soon, thispatch makes all users of the queries call the haskellimplementation instead of the python one.
Remove --enable-split-query option
Switching from python to haskell queries, this patchremoves the option to dis/enable the haskell queriesat configure time.
RAPI: Make use of request_body in Reboot/Remove
Until now, the shutdown_timeout parameter could only be passed toShutdownInstance() inside kwargs, causing it to be included in therequest body. Based on that, extend RebootInstance() andRemoveInstance() so that they can take extra arguments (e.g....
RAPI: Pass depends body arg (if any) to opcode
Most rlib2 classes override the default _GetDefaultData() method withcustom methods that parse a request's body and query args and return a(body, specific_static) tuple eventually passed to FillOpCode().Job dependencies are defined in the `depends` body argument that might...
Add --compress option to instance_move
instance_move now supports the --compress option with which it'spossible to select the compression mode to use during the instance move.
Signed-off-by: Thomas Thrainer <thomasth@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Merge branch 'stable-2.8' into stable-2.9
Make RAPI export device names and UUIDs
Add UUIDs and names of instance's disks and NICs to the list of instancefields that are returned from RAPI.
Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>Reviewed-by: Helga Velroyen <helgav@google.com>
Merge branch 'stable-2.8' into master
Merge branch 'stable-2.7' into stable-2.8
Conflicts:...
Expose bulk parameter for GetJobs in RAPI client
This patch exposes the bulk argument of the jobs resource onthe RAPI python wrapper, making it possible to retrieve statusinformation about all jobs with a single call.
Signed-off-by: Leon Handreke <lhandreke@google.com>...
Fix RAPI to include missing network fields
Fix RAPI interface to include missing network fields. Specifically, fixinstance queries to include the network name for instance NICs. Also fixnetwork queries to include missing common fields, like uuid and serial....
Export CPUs used by the node OS
They are exported through the LUXI, RAPI, and IAllocator interfaces.
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Klaus Aehlig <aehlig@google.com>
Export node spindles
Node spindles (queried live) are exported through the LUXI, RAPI, andiallocator interfaces.
Export instance disk spindles
Instance disk spindles can be queried via LUXI and RAPI, and are exportedthrough the allocator interface. This is a prerequisite for htools tohandle spindles.
The length of a RAPI query including all the instance fields now has become...
Reason trail implementation for "start"
Opcode-specific implementation of the reason trail for the instancestartup operation.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Reason trail implementation for "shutdown"
Opcode-specific implementation of the reason trail for the instance shutdownoperation.
Reason trail implementation for instance reboot
This commits allows ganeti to correctly forward the reason trail informationregarding instance reboot.
Signed-off-by: Michele Tartara <mtartara@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
Add "reason" as a common parameter for all the RAPI calls
Also, this add an infrastructure for having parameters common to all theRAPI calls.
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>...
Remove old "reason" implementation
Remove the useless parts of the old, partial, implementation of the support fortracking the reason of instances state change, before implementing the newreason trail support, as per the design document.
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...
Remove use of deprecated function
cgi.parse_qs() is deprecated in python 2.6 and substituted byurlparse.parse_qs().
This patch modifies the code to use the new function.
Merge branch 'devel-2.7'
Trivial merge: no conflicts...
Update "FIXME" string in RAPI
We are not ready for this change yet. Let's push it to 2.8.
rapi client: add target_node to migrate instance
This allows migrating to any node, as it is already possible forfailover, when instances are externally mirrored.
Signed-off-by: Daniel Krambrock <danielk_lists@z9d.de>Signed-off-by: Guido Trotter <ultrotter@google.com>...
Enable split queries for the network
Now that all fields are implemented, and (I think) behave equivalentto the Python implementation, we can switch on the split queries fornetworks.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Helga Velroyen <helgav@google.com>
GanetiRapiClient: fix the no_remember option
There was a typo which prevented the correct option from being passed toRAPI
Signed-off-by: Daniel Krambrock <danielk_lists@z9d.de>Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Fix style violations in commit 4a90bd4, small changes
- Commit 4a90bd4 contained a rather large number of style violations: - Indentation/sequence formatting - Wrapping of long lines - Docstrings whose first line was wrapped - A stray backslash in a docstring...
RAPI: Add flag to require authentication
Most RAPI resources do not require authentication for the “GET” method.In some setups it can be desirable to always require authentication.This patch adds a command line parameter to always require it.
Some unrelated minor typos in the “ganeti-rapi” man page are also fixed....
Allow generating different RAPI resource lookup tables
Until now the RAPI resource table returned by“rapi.connector.GetHandlers” always uses fixed strings or compiledregular expressions as dictionary keys. Now that a table of all RAPIresources (and their access rights) should be written for the...
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.
Status change reason support for Reboot
Add support to the Reboot command for specifying the reason for the laststatus change.
Some features are implemented as functions, even if used only once, becausethey will be used by the future patches introducing reason support for all...
Revert "Disable live-RPC queries under split query"
This reverts commit fb251c2c4c582ec0d6c00a6f6c5e134ed5196e03. On themaster branch we want to continue to have them enabled.
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>
Remove network_type slot (Issue 363)
This slot was not used by Ganeti so the same info can beprovided via tags. In order not to break configuration datawe add a FromDict() method in Network config object thatremoves the deprecated network_type (if found) and then invoke...
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>
Disable live-RPC queries under split query
Currently, the node listing RPC is very slow due to missingparallelisation. For the 2.7 release, we reset these back to masterd,hoping to revert them by the time 2.8 is ready.
There are a number of queries that I've left pointing to confd, as...
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...
Enable job queries via confd in gnt-node and RAPI
This patch is enabling split queries for jobs for gnt-node and rapiaccess (only for job listing, not job waiting).
Change value for ECODE_TEMP_NORES
Unfortunately there was a bug in commit 518a45e whereby ECODE_TEMP_NOREShad the same value as ECODE_NORES, leading to failures in a Haskelltest. Of course this would also have affected other users of the constant.
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
Export error codes from RAPI client module
Until now the error codes were not available from the RAPI clientmodule. A newly added unit test ensures all error codes are contained in“ECODE_ALL”, as well as ensuring consistency between the RAPI client and...
Small style fixes (' vs ") in network code
This is just trivial fixes; I think I caught all of them.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Fixes to pass py-apidoc (make commit-check)
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>Reviewed-by: Iustin Pop <iustin@google.com>
Fixes to pass pep8 (make lint)
Fixes to pass unittests (make check)
Add tags in network objects
Support: - gnt-network add --tags. - gnt-network list-tags/add-tags/remove-tags/. - gnt-network list -o +tags
Rapi support for networks
Support: - GetNetwork(s) - CreateNetwork - ConnectNetwork - DisconnectNetwork - RemoveNetwork
rapi: Add new user option for querying
This was requested in issue 301. Before this patch, requests to“/2/query/*” and “/2/instances/*/console” would require authenticationwith a user with write access. Since that is not strictly necessary, anew user option named “read” is added....
rlib2: Document two previously undocumented functions
Commit 208a6cff just included empty docstrings.
Merge branch 'devel-2.6'
Merge branch 'stable-2.6' into devel-2.6
rapi.testutils: Add utility to format HTTP headers
Once again this will be used by forthcoming RAPI test.
rapi.testutils: Return headers from mock utility
A newly added test for RAPI will also verify the returned headers. Atest in ganeti.rapi.client_unittest.py is split into smaller stand-alonetests.
http: Add wrapper for mimetools.Message
A newly added piece of code will also have to parse headers, so havingthis wrapper saves us from copying this part of code.
Add new constant for pending job status
This constant contains the job status' “queued”, “waiting” and“cancelled”.
Enable query socket usage in gnt-node/gnt-group
This switches gnt-node/gnt-group (and their equivalent RAPI resources)to go over the query socket.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Adding RAPI client for instance multi allocation
It was very easy to refactor CreateInstance to repurpose some part of itfor the instance multi allocation request. So we do this.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Populate the instance dict with opcode infos
This is needed so we can load it as an opcode. However, this informationshould not be available on the client, so we inject that info when wereceive the request.
Provided unittest to verify behaviour.
Signed-off-by: René Nussbaumer <rn@google.com>...
Adding RAPI resource for multi-allocation
This is straightforward.
Migrate lib/rapi/baserlib.py from constants to pathutils
File system paths moved from constants to pathutils.
RAPI client: Fix typo in docstring
Also update the copyright header.
Complete and enable the haskell QueryClusterInfo call
Since we have now access to all cluster parameters, we can "fill" theparameters, and can finally enable it in CLI/RAPI.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Agata Murawska <agatamurawska@google.com>
Enable tags query over the query socket
This patch adds the tags field to the objects which were missing it(all except Cluster), implements handling the LuxiCall QueryTags, andthen enables the use of the query socket in cli.ListTags, used by allcommands, and in the RAPI client....
Switch RAPI to use same tags listing as CLI
Currently, RAPI uses queries (as in QueryNode with field tags) forgetting the tags, whereas the CLI uses the QueryTags Luxicommand. Since this discrepancy is not good, let's switch RAPI to usethe same method as the CLI....
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...
rapi client: accept arbitrary shutdown arguments
The "ignore_offline_nodes" parameter is unsupported. Rather thanexplicitely adding it, just pass all keyword arguments in the body ofthe query, and rapi on the other side will do the right thing.
Supports for old arguments that were passed via the query is unchanged....
RAPI regression beparams/memory fix
For compatibility with the old Ganeti version, we want to keep thebeparams/memory field around for another release. This patch fixes thisregression.
Signed-off-by: René Nussbaumer <rn@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Export more information in RAPI group queries
Sadly we don't have a way to test that, for example, all(G|N|I)Q_CONFIG fields are exported in RAPI, so for now we don't testthis; but we should, in the future.
Signed-off-by: Iustin Pop <iustin@google.com>...
Fix GenericCurlConfig when pycurl is linked against nss
Redhat links its pycurl against NSS/ so this check fails and thereforemakes ganeti-watcher unusable.
Even though this seems to fix the problem and works, further testing onthis might be needed.
Add more RAPI test utilities
This patch adds a mock RAPI client to test input values to methods. Allmethods either raise an exception if there was a problem or return None.Third-party code can use this to test their input values to the RAPIclient.
rapi.testutils.FakeCurl: Add header support
With this patch headers are constructed from the PycURL optionsand passed to the mock implementation.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
Move _FakeCurl from tests/ganeti.rapi.client to ganeti.rapi.testutils
This is preparation for the mock system, where we need the same cURLmock.
Signed-off-by: René Nussbaumer <rn@google.com>Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
RemoteApiHandler: Add support for mocked LUXI client
This will be used for providing a type-checking RAPI client for tests.
Change CertificateError to subclass GanetiApiError
Signed-off-by: Chris Schrier <schrierc@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Include PycURL error code in GanetiApiError.
Signed-off-by: Chris Schrier <schrierc@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
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....
Export ndparams in RAPI node query
rapi.testutils: Add exported functions to verify opcode input/result
These can be used by third-party code to verify mock code. Further workon mocks is forthcoming, so this is only a start.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>...
rapi.client: Removing constants not needed anymore
They were not referenced through the whole code and were marked internalonly.
RAPI client: Replace body value assignments with helper
RAPI client: Export feature constants
Users of the RAPI client may want to use feature strings too, thereforethey should be explicitely public.
RAPI client: Use utilities for building query parameters
Instead of repeating a “if cond: query.append(…)” pattern, utilityfunctions are added and used.
Group query now calculates ipolicy
Signed-off-by: Agata Murawska <agatamurawska@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
RAPI: Fix issue when replacing disks
This is another fallout from a suboptimal merge.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Andrea Spadaccini <spadaccio@google.com>
Merge branch 'devel-2.5'
Merge branch 'stable-2.5' into devel-2.5
RAPI: Make node evacuation actually work
Commit e1f23243 changed te LU and opcode for node evacuation to receivea “mode” parameter (among other things). Commit de40437a changed theRAPI code accordingly, but did so for an earlier version of the firstpatch. Obviously this couldn't work, so here's the fix....