summaryrefslogtreecommitdiff
path: root/glanceclient
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Don't replace the https handler in the poolmanager"0.14.2Jenkins2014-11-052-3/+16
|\
| * Don't replace the https handler in the poolmanagerFlavio Percoco2014-10-302-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to keep the support for `--ssl-nocompression` it was decided to overwrite the https HTTPAdapter in `requests` poolmanager. Although this seemed to work correctly, it was causing some issues when using glanceclient from other services that rely on requests and that were also configured to use TLS. THis patch changes implements a different strategy by using `glance+https` as the scheme to use when `no-compression` is requested. Closes-bug: #1350251 Closes-bug: #1347150 Closes-bug: #1362766 Change-Id: Ib25237ba821ee20a561a163b79402d1375ebed0b
* | Merge "Adds support for Glance Tasks calls"Jenkins2014-10-163-0/+188
|\ \
| * | Adds support for Glance Tasks callsFei Long Wang2014-09-223-0/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add tasks operations on client side to support task create, list all and show. DocImpact Implement blueprint async-glance-workers Change-Id: Ib4b8e347a8a47817e3b427c8ba024e8c32f65155
* | | Merge "Remove network_utils"Jenkins2014-10-092-110/+2
|\ \ \
| * | | Remove network_utilsOleksii Chuprykov2014-10-032-110/+2
| | | | | | | | | | | | | | | | | | | | | | | | Use oslo.utils instead Change-Id: I4830b13794db5570e7dde4a897a7396065028e37
* | | | Merge "Default to system CA bundle if no CA certificate is provided"Jenkins2014-10-081-2/+3
|\ \ \ \ | |/ / / |/| | |
| * | | Default to system CA bundle if no CA certificate is providedRob Crittenden2014-09-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If no CA certificate is provided to be used for validation then fall back to the system-wide CA bundle as presented by python-requests. Change-Id: I05206a868150d4b62b6f1b833310eb9b86b7c4f8 Closes-bug: #1362179
* | | | Merge "Skip non-base properties in patch method"Jenkins2014-10-031-3/+5
|\ \ \ \ | |_|_|/ |/| | |
| * | | Skip non-base properties in patch methodKamil Rykowski2014-09-291-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's currently impossible to update properties which are defined in image schema and which are not a base image property. Proposed fix skips every non-base property when building a json patch, that is used to update image properties through glance API. Change-Id: I3b35cef379fcf437715e2966f9a0d25c1b4e4016 Closes-Bug: #1371559
* | | | Merge "CLI image-update gives a wrong help on '--tags' param"0.14.1Jenkins2014-09-191-1/+1
|\ \ \ \ | |/ / / |/| | |
| * | | CLI image-update gives a wrong help on '--tags' paramZhi Yan Liu2014-07-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The help message tells end user image-update interface accepts 'tags' param and could be used to update tag of image [0], but actually it could trigger an 400 exception [1] due to wrong PATCH calls, and the correct way is to use image-tag-update interface [2] as designed. [0] glance image-update <IMG_ID> --tags <TAG_VALUE> [1] 400 Bad Request Invalid JSON pointer for this resource: '/tags/0' (HTTP 400) [2] glance image-tag-update <IMG_ID> <TAG_VALUE> Change-Id: Iaa8041779510192dc08f7b898b8a1beda29a6398 Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
* | | | Merge "Downgrade log message for http request failures"Jenkins2014-09-171-1/+1
|\ \ \ \ | |_|_|/ |/| | |
| * | | Downgrade log message for http request failuresChris Yeoh2014-08-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Downgrades the log message when an http request fails from error to debug. The logging level changed in the http.py upgrade in I09f70eee3e2777f52ce040296015d41649c2586a which effectively reverted a similar fix commited in I6d0efb53d1e81adf309f7fa580ec5a8073a811c5. We don't want to log at ERROR level because we already have an exception raised and the caller can handle it if wants to. However this error will appear regularly in the Nova logs under normal behavior (say a client specifies an image which does not exist) and there is no way of disabling only the glanceclient error log. This results in a lot of noise in the nova log file. Change-Id: Iec13bff439073a79cb24e9b22fd43603ae4e61b7
* | | | Merge "Update how tokens are redacted"Jenkins2014-09-162-6/+15
|\ \ \ \
| * | | | Update how tokens are redactedTravis Tripp2014-09-152-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using SHA-1 to match how Nova and Swift redact their tokens. Was discussed in the below thread: http://lists.openstack.org/pipermail/openstack-dev/2014-September/045802.html Here's what nova went with: https://review.openstack.org/#/c/99511/ swift seem to be following suit: https://review.openstack.org/#/c/99632/ Change-Id: I3045d6d9d2a13770f4022dbbd474b34eb1032f6e Closes-bug: 1329301
* | | | | Merge "Print traceback to stderr if --debug is set"Jenkins2014-09-161-0/+7
|\ \ \ \ \
| * | | | | Print traceback to stderr if --debug is setLouis Taylor2014-09-151-0/+7
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows easier debugging of client related issues, with a full traceback printed out when an uncaught error occurs in the client. Previously, it could be hard to find the portion of code raising an exception, with just the message from the exception being displayed. Previous behaviour (with a rather artificial client error being raised): $ glance --debug image-list Contrived exception Behaviour after this patch: $ glance --debug image-list Traceback (most recent call last): File "/opt/stack/python-glanceclient/glanceclient/shell.py", line 590, in main args.func(client, args) File "/opt/stack/python-glanceclient/glanceclient/v1/shell.py", line 77, in do_image_list raise(Exception('Contrived exception')) Exception: Contrived exception Contrived exception Change-Id: Id7b76b707e5fc16a0402dcb104ec40787e0ffbe2
* | | | | Handle UnicodeDecodeError in log_http_responseMatt Riedemann2014-09-151-1/+2
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to commit dec9c9f35 and log_curl_request, this ignores decoding errors when logging response headers by passing errors='ignore' to safe_encode. Change-Id: Ic915a7d8334e9473f300c9db670a3a8f5cda8976 Closes-Bug: #1369756
* | | | Merge "Fix v2 requests to non-bleeding edge servers"Jenkins2014-09-136-54/+89
|\ \ \ \
| * | | | Fix v2 requests to non-bleeding edge serversLakshmi N Sampath2014-09-126-54/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case where v2 requests are sent to a server which is not running head of tree which includes the v2 metadef code some 404 cases need to be handled to enable standard requests to complete. This patch aslo improves fetching schemas -- they are now only fetched as needed. Change-Id: I8c871f11b909337bd7df19b77e606772dbc634b2 Closes-bug: #1367326
* | | | | Merge "Import missing gettextutils._ in shell.py"Jenkins2014-09-131-0/+1
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | Import missing gettextutils._ in shell.pyMatthew Booth2014-09-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes-Bug: #1355252 Change-Id: I3aef19235735b3b374b92985f142712cb0f37a35
* | | | | Support for Metadata Definitions Catalog API0.14.0Pawel Koniszewski2014-09-035-18/+789
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | API calls and shell commands added in this patch: - CRUD for metadefs namespaces; - CRUD for metadefs objects; - CRUD for metadefs properites; - CRD for metadefs resource types and resource type associations. Change-Id: I6d15f749038e8fd24fc651f0b314df5be7c673ef Implements: blueprint metadata-schema-catalog-support Co-Authored-By: Facundo Maldonado <facundo.n.maldonado@intel.com> Co-Authored-By: Michal Dulko <michal.dulko@intel.com> Co-Authored-By: Lakshmi N Sampath <lakshmi.sampath@hp.com> Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
* | | | Catch new urllib3 exception: ProtocolErrorPawel Koniszewski2014-09-031-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new version of requests (2.4.0) has updated underlying urllib3 to version 1.9. Unfortunately urllib3 introduced new exception ProtocolError. Because of that unit tests in glance are failing: ProtocolError: ('Connection aborted.', gaierror(-2, 'Name or service not known')) To solve this problem new urllib3 exception is caught in the same place that the old one was. Unfortunately both exception are still in use so I couldn't remove the old one. Change-Id: I55eef98e734c59b9b627f182768a633b2b701e43 Closes-Bug: #1364893
* | | | Fix error when logging http response with python 3Louis Taylor2014-08-261-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python 3 changed the semantics of dict.items() [0], which now returns a iterable 'view' instead of a list of tuples. This has the repercussion that you can no longer check for membership of a key using: key in dict.items() This patch simply replaces that check with a test for the key existing in the dict itself, rather than the items. [0] http://legacy.python.org/dev/peps/pep-3106/ Closes-Bug: 1359880 Change-Id: I7c59b0432725b660c9fa7270cde2e07bf3ea77db
* | | Merge "Enable osprofiler interface in glanceclient shell"Jenkins2014-08-202-4/+40
|\ \ \
| * | | Enable osprofiler interface in glanceclient shellZhi Yan Liu2014-08-192-4/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To help end user uses profiling by glanceclient CLI directly, the change added '--profile <HMAC_KEY>' argument to the shell. This change also fixed a function regression, it was used to pass necessary trace info to glance server via http header: https://github.com/openstack/python-glanceclient/commit/dbb242b776908ca50ed8557ebfe7cfcd879366c8#diff-740dd7d9149f46fe4c01ef0ab7eb3bfbL196 In addition: 1. If client app want to enable profiling feature for glanceclient object, please see: http://paste.openstack.org/show/85722/ 2. Afer adding more trace point into Client object, as fundamental requirement of osprofiler, what we need to notice caller is providing correct messaging notifier in the context code. The relevant change for glance server is ready at: I45a19f5eb5304c2b78a9e12cbc0744941a807304 DocImpact Change-Id: If42b69b2695a5f88536ecbc2c1b3592d9dbd880a Signed-off-by: Zhi Yan Liu <lzy.dev@gmail.com>
* | | | Ensure server's SSL cert is validatedStuart McLaren2014-08-192-3/+12
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A bug was introduced which meant that the server SSL certificate was not being verified. Here we make sure that it is checked (unless the --insecure flag is used). Helps guard against man-in-the-middle attack. Change-Id: I08f30bf3906b6580c871729311343fa8eefda91b Closes-bug: #1357430
* | | Merge "Normalize glanceclient requested service url"Jenkins2014-08-181-3/+4
|\ \ \
| * | | Normalize glanceclient requested service urlZhi Yan Liu2014-08-071-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some proxy or gateway softwares, e.g. jumpgate [0], use url-pattern based approach to match which hanlding logic needs to be triggered for particular service calling when it received a http(s) call as a middleman. The change fixed an issue which caused glanceclient send out the request to a dis-normal url, which contains duplicated "/". The change removed a wrong and duplicated code snippet from curl logging function as well. [0] http://goo.gl/yt52X1 Change-Id: Ic8b3920e11d400771ead7f9c44b615f10b4a5cef Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
* | | | Remove deprecated commands from shellCindy Pallares2014-08-123-603/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove all deprecated commands from the shell since they are no longer used and to keep the command line menu from looking cluttered. Closes-bug: #1314218 Change-Id: I66e82872988e3835e4f290f48dfc80538271426c
* | | | Merge "Add support for Keystone v3"Jenkins2014-08-071-152/+309
|\ \ \ \
| * | | | Add support for Keystone v3Bob Thyne2014-08-051-152/+309
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This enables glanceclient to authenticate using Keystone v3 API and includes the addition of several new CLI arguments. DocImpact Change-Id: I863ba08d312363dc1ce4fc7822fb21ef53df1a4f
* | | | | Fix glance-client to work with IPv6 controllersSudipta Biswas2014-08-061-1/+12
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the glance client can't operate on IPv6 address based openstack controller IPs. The reason for this is the absence of creation of a IPv6 socket in the glance client code (in https.py). The glance client is trying to create sockets from the AF_INET socket family but this will lead to errors when glance client makes a call on the IPv6 IP addresses. In order to fix this limitation, we ensure that if the hostname resolves to IPv6 or an explicit IPv6 address is used to configure the openstack controller - glance client shall be able to detect that and then create a AF_INET6 socket family. In all other cases a AF_INET socket is created. We default to IPv4 sockets in all other cases. Change-Id: I7d5a09675cd5dab2e39f0faeaa7c169291eedac6 Closes-bug: #1348030
* | | | Merge "Use immutable arg rather mutable arg"Jenkins2014-08-031-2/+4
|\ \ \ \ | |_|/ / |/| | |
| * | | Use immutable arg rather mutable argliuqing2014-07-031-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing mutable objects as default args is a known Python pitfall. We'd better avoid this. This commit changes mutable default args with None. Change-Id: I78323383c8b6a9a516a2a217303124870822418b
* | | | Don't stream non-binary requestsMatt Riedemann2014-07-161-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting stream=True with requests can lead to issues with not closing the connection so the urllib3 connection pool is not freed up, so only set stream=True if making a request with application/octet-stream content-type. See the body-content-workflow and keep-alive sections in the requests docs here for more information: http://docs.python-requests.org/en/latest/user/advanced/ Note that commit dbb242b changed the response body_iter code to potentially return a six.StringIO object rather than the old ResponseBodyIterator class and since the images client code is not converting the body_iter into a dict using json.loads, we have to do that directly in the _request method where the body_iter is constructed. Co-authored-by: Flavio Percoco <fpercoco@redhat.com> Change-Id: I86572b69c4511f933c9676108190271874346302 Partial-Bug: #1341777
* | | | Use a correctly formatted example location in helpStuart McLaren2014-07-161-2/+6
| | | | | | | | | | | | | | | | | | | | Change-Id: Iea1ebc13979a61d7bed397fb79e2b2a85f00c400 Closes-bug: 1342753
* | | | Replace old httpclient with requestsAmalaBasha2014-07-1011-544/+457
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This review implements blueprint python-request and replaces the old http client implementation in favor of a new one based on python-requests. Major changes: * raw_request and json_request removed since everything is now being handled by the same method "_request" * New methods that match HTTP's methods were added: - get - put - post - head - patch - delete * Content-Type is now being "inferred" based on the data being sent: - if it is file-like object it chunks the request - if it is a python type not instance of basestring then it'll try to serialize it to json - Every other case will keep the incoming content-type and will send the data as is. * Glanceclient's HTTPSConnection implementation will be used if no-compression flag is set to True. Co-Author: Flavio Percoco<flaper87@gmail.com> Change-Id: I09f70eee3e2777f52ce040296015d41649c2586a
* | | | Enable F841ChangBo Guo(gcb)2014-07-092-3/+2
| |_|/ |/| | | | | | | | | | | | | | | | | F841 detects local variable is assigned to but never used. This commit fixes the violations and enables F841 in gate. Change-Id: Ic4dcac2733dfe334009327ac17aa3952cafaa63a
* | | Merge "Add profiling support to glanceclinet"Jenkins2014-07-081-0/+7
|\ \ \
| * | | Add profiling support to glanceclinetBoris Pavlovic2014-07-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To be able to create profiling traces for Glance, client should be able to send special HTTP header that contains trace info. This patch is as well important to be able to make cross project traces. (Typical case nova calls glance via python client, if profiler is initialized in nova, glance client will add extra header, that will be parsed by special osprofiler middleware in glance api) Don't worry no security issue here, trace information is signed by HMAC key that is setted in api-paste.ini. So only person that knows HMAC key is able to send proper header. Change-Id: Ib13084fbe9b33c2f3dee165f7d6c778546cce6ca
* | | | Resolving the performance issue for image listing of v2 APIZhi Yan Liu2014-07-081-5/+19
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to my diagnosis [1], currently v2 API client consumed a lot of CPU times by JSON schema validation on image model initialization stage for image listing case. Because each image entry will triggers one validation operation which spent most CPU clocks. (My test env has 1002 image entries now, so it's O(N) logic obviously). This fix changed the original logic, it doesn't validate each image entry but do it only on first image entry for each page. This approach is a trade-off, it balanced the data validity and performance. As comparison [3], under the fixed new logic, the execution time of image listing is about four times as fast as old logic. [1] Clock type: CPU Ordered by: totaltime, desc name ncall ttot ..nt/v2/images.py:34 Controller.list 1003 12.08480 ../warlock/core.py:30 image.__init__ 1002 11.91074 ..warlock/model.py:28 image.__init__ 1002 11.90463 ..arlock/model.py:130 image.validate 1002 11.73838 ..nschema/validators.py:388 validate 1002 11.73682 [2] name ncall ttot ..nt/v2/images.py:35 Controller.list 1003 1.100710 ..nceclient/v2/images.py:45 paginate 256.. 1.099965 ../warlock/core.py:30 image.__init__ 1002 0.944762 ..warlock/model.py:28 image.__init__ 1002 0.939725 ..arlock/model.py:130 image.validate 51 0.779653 ..nschema/validators.py:388 validate 51 0.779431 [3] $ time glance --os-image-api-version 2 image-list | grep 'test-' | wc -l 1000 real 0m16.606s user 0m10.629s sys 0m2.540s $ time glance --os-image-api-version 2 image-list | grep 'test-' | wc -l 1000 real 0m4.151s user 0m1.080s sys 0m0.092s Change-Id: Ia6598d3c06a5ff516277053c2b6fa5db744fe9cf Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
* | | Merge "Fix CA certificate handling"Jenkins2014-06-301-1/+1
|\ \ \
| * | | Fix CA certificate handlingStuart McLaren2014-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If --os-cacert was passed to the cli the following error was triggered: "cafile must be None or a byte string". This is because 'load_verify_locations' requires a byte string to be passed in. We fix this by explicitly converting the argument to a byte string. We do this in 'VerifiedHTTPSConnection' rather than sooner, eg during arg handling, as it will no longer be required should we move to a different http library (eg requests). Fixes bug 1301849. Change-Id: I9014f5d040cae9f0b6f03d8f13de8419597560cb
* | | | Merge "Set purge-props header correctly in image update"Jenkins2014-06-241-6/+5
|\ \ \ \
| * | | | Set purge-props header correctly in image updateMaithem2014-06-191-6/+5
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when an image is updated, the purge property header is only set to true in some cases, but when required it isn't set to false Change-Id: I885a82643d2620f393f21c36b3ad95cb7ed43f2c Closes-Bug: 1318079
* | | | Prepend '/' to the delete url for the v2 clientManuel Desbonnet2014-06-231-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and update tests to match. The missing slash results in a non-absolute DELETE request being sent to the API. E.g. DELETE v2/images/62fac489-23b4-4929-87af-2e7236e8542b HTTP/1.1 This is not strictly valid http/1.1 - rfc2616 specifies that the path must be absolute. This doesn't cause a problem for the API server, but this can cause problems if the API server is fronted by something else (see #133161). It also means that the curl command logged in debug mode has a bad url. E.g. curl -i -X DELETE ... http://10.0.0.13:9292v2/images/... Change-Id: Ib0c749dedbfcf07303fcddae4512db61b0f3fd78 Closes-bug: #1327101
* | | Merge "Reuse class Manager from common code"Jenkins2014-06-184-77/+66
|\ \ \