Commit Graph

241 Commits

Author SHA1 Message Date
Zuul 63bb03a145 Merge "Add an optional parameter --append" 2022-02-17 18:51:52 +00:00
Zuul 683b694fff Merge "Add an optional parameter --detail" 2022-02-16 19:32:15 +00:00
Mridula Joshi b8863535a8 Add an optional parameter --append
This patch will add an optional parameter --append to the glanceclient
command md-tag-create-multiple to provide the facility of appending
the tags.
If the parameter is present  it will append the tags to existing one,
else it will overwrite the existing tags.

Depends-On: https://review.opendev.org/c/openstack/glance/+/804966
Change-Id: I1841e7146da76b13f4cd8925e19f59d0eaf08f7a
2022-02-16 14:00:28 +00:00
Mridula Joshi 282ce9c209 Add an optional parameter --detail
This patch appends th --detail parameter to the ``stores-info``
command. With sufficient permissions, display additional
information about the stores.

Depends-On: https://review.opendev.org/c/openstack/glance/+/824438
Change-Id: I6ae08ab3eaab0c2b118aa7607246214b28025dfe
2022-02-02 14:31:44 +00:00
Dan Smith 3f001f5f11 Add support for usage API
This is really a very simple activity of fetching and showing the
results of the usage API in table form for the user.

Depends-On: https://review.opendev.org/c/openstack/glance/+/794860
Change-Id: I3d9360785a759e4a6e7905710400baea80776052
2022-01-31 13:27:54 -08:00
Rajat Dhasmana 5d714bed0b Correct releasenote path for member-get command
This patch moves the releasenote of member-get command to correct
path.

Closes-Bug: #1944798
Change-Id: Ifa76fc993b0ff47131401ba233e77001cd74107c
2021-09-22 10:15:16 -04:00
Mridula Joshi 1eb0bbbed7 Fix undesirable raw Python error
Using the glanceclient without a subcommand while
passing an optional argument triggers the raw Python
error `ERROR: 'Namespace' object has no attribute
'func'`. This bug can be reproduced by issuing the
command `glance --os-image-api-version 2`.
Added a default value to `func` as placeholder
so that a help message is shown instead of the Python error.

Closes-Bug: #1903727
Change-Id: Ie4288262e408192310cbbc240bd1779b265a64fd
2021-08-03 10:35:40 +00:00
Mridula Joshi cb084f5289 Add member-get command
It is observed that python-glanceclient was missing support for GET /v2/image/{image_id}/member/{member_id} API.
This patch adds new command `member-get` to support this missing operation.

Closes-Bug: #1938154

Change-Id: I3709f6a39535aa45bee70f468f015ac60a1375a8
2021-08-02 09:08:50 +00:00
Abhishek Kekane e0a35a1150 Get tasks associated with image
Add support to get tasks associated with specific image.
bp: messages-api

Change-Id: Ia505cf6f47ca6c628e195be3ca5231d22d53040d
2021-03-02 10:02:14 -08:00
James Page 5aca99d653 Update test certificates to use strong signing
Modern OpenSSL (and specifically on Ubuntu) will reject certificates
signed using the sha1 algorithm.  Refresh test CA and associated
certificates using sha256.

Change-Id: Ie22a4630eb0f5993a909efed27088321c1865ca8
2020-08-07 21:31:07 +00:00
Erno Kuvaja 77eab17cf9 Fixes "stores" property added to the image
"stores" property gets added to the image when
`glance image-create-via-import` is called with --stores

Change-Id: I514e6e3ac2f3a1f56fb7883ed403a04b1e7f13b0
Closes-Bug: #1889666
2020-07-30 18:39:31 +01:00
Zuul a29c6be97d Merge "Do not use the six library." 2020-07-17 19:32:29 +00:00
Zuul dca62b4de1 Merge "Do not use the six library in the tests." 2020-07-16 21:25:14 +00:00
Erno Kuvaja bae1d89cc7 Pass Global Request ID on with session client
Closes-bug: #1886650
Change-Id: I3a08c1beb398ba9f2556b6779c925f679bdc2c49
2020-07-13 22:55:23 +01:00
Cyril Roelandt b513c8db4b Do not use the six library.
Change-Id: I3dbfcfa0f5f590a41ed549afd44537d8ed41433a
2020-06-23 21:51:07 +02:00
Cyril Roelandt 928935e5c0 Do not use the six library in the tests.
Change-Id: Ic8a2a736a733e0151ca82f19bfde428dc04cf255
2020-06-15 21:04:56 +02:00
Brian Rosmaita 56186d6d5a Fail gracefully when MD5 is unavailable
The glanceclient currently assumes that MD5 will always be available.
This is not the case, however, in a FIPS-compliant environment.  This
patch enables the glanceclient to fail gracefully in such a case.

Closes-bug: #1871675
Change-Id: Ibd89989e06cc5be7da71f5f21561d73b5abc4104
2020-05-04 08:56:58 -04:00
Sean McGinnis 6a045884cb Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I446ee142c7a17446372c910f7f2a36d55df18e04
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-04-18 11:58:08 -05:00
Andreas Jaeger 82da2378ea Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Remove hacking and friends from lower-constraints, they are not needed
for installation.

Change-Id: I5ae47a7b11ff29a301e440c15daf30db7738485b
2020-04-02 15:48:09 +02:00
Erno Kuvaja d91bcae8a5 Delete image from specific store
Add support to delete image from specific store.

bp: delete-from-store
Change-Id: Ie57d7de5822264a5ea8a5f4587ab8cfb4afb79de
2020-03-20 07:21:59 +00:00
Abhishek Kekane 2e0396c0c9 Add support for copy-image import method
This change adds support for copy-image import method which will
copy existing images into multiple stores.

Change-Id: I748a8fb3dbaf9c2e4d887a2ecd4325e27a8429c4
bp: copy-image-multiple-stores
2020-02-27 06:49:11 +00:00
Erno Kuvaja c23d86738f Add support for multi-store import
This change adds support for providing multiple target
stores where image can be imported.

Co-authored-by: Erno Kuvaja <jokke@usr.fi>
Co-authored-by: Abhishek Kekane <akekane@redhat.com>

bp: import-multi-stores
Change-Id: I8730364263f1afd5d11fd56939851bda73a892bb
2020-02-27 05:52:49 +00:00
Zuul 40c19aa443 Merge "Rename --backend to --store" 2019-09-13 01:31:30 +00:00
Abhishek Kekane d61d1dd546 Rename --backend to --store
As a part of vocabulary correction renamed --backend parameter to
--store. Modfied corresponding tests as well.

bp:multi-store-vocabulary-correction
Change-Id: I3dc115f5f0f3c4edcca0209e139aa3d1d816357c
2019-05-14 04:47:28 +00:00
jacky06 b8ecb0bc03 Update hacking version
Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: Ifc3b96d98c1a7feff187f953d487e12135887fb9
2019-03-27 09:06:39 +00:00
Zuul 8b9dc5635e Merge "Embed validation data when adding location" 2019-03-07 16:46:55 +00:00
Brian Rosmaita 4511a445d0 Add image-list filter for multihash
This was missed when multihash support was added to the glanceclient.
The os_hash_value is an indexed field in the API.

Includes a release note.

Closes-bug: #1788271

Change-Id: Ibfe28b8c644967b7e0295dfd3f55c3ae1b0cbb2d
2019-01-17 14:22:48 -05:00
Zuul c4c92ecb51 Merge "Show the backend store info" 2018-11-15 07:31:18 +00:00
Liang Fang 5fb14f5ebb Show the backend store info
When running "glance -v image-list" there's no store info listed, so
user cannot know the type of the backend. This patch added an new option
"--include-stores" and is to add the store id to the output of "glance
image-list --include-stores".

The final output may like:
+-----+------+-------------+-----+----------+--------+-----+------+
| ID  | Name | Disk_format | ... | Size     | Status |Owner|Stores|
+-----+------+-------------+-----+----------+--------+-----+------+
| xxx | img1 | raw         | ... | 10737418 | active | xxx | ceph |
| xxx | img2 | raw         | ... | 5086345  | active | xxx | file |
+-----+------+-------------+-----+----------+--------+-----+------+

Change-Id: If86ef714c3aa03ce43ef29f26892f431f4766560
Co-authored-by: Jack Ding <jack.ding@windriver.com>
Signed-off-by: Liang Fang <liang.a.fang@intel.com>
2018-11-08 17:50:26 -08:00
imacdonn 1156346dc2 Don't quote colon in HTTP headers
Since the introduction of quoting of header content in
https://review.openstack.org/568698, the 'x-image-meta-location' header
has been broken, because urllib.quote() is really intended to be applied
to only the path section of a URL, but in this case, it gets applied to
the entire URL, and catches the colon that separates the scheme from the
remainder of the URL.

This change adds the colon to the list of characters that should not get
quoted. Since a colon can be directly represented in ASCII, this should
not invalidate the previous change.

Change-Id: I76a1c9a361b6c9f6eb95ae766b8c3bcf2267703a
Closes-Bug: #1788942
2018-11-01 21:38:19 +00:00
imacdonn 3f7171dc14 Embed validation data when adding location
Add support for embedding of checksum, os_hash_algo and os_hash_value when
adding a location to an image.

Depends-On: https://review.openstack.org/597648
Change-Id: Ibbe2f2bb226f52cc6b2ab591913b1797d2b086c0
2018-10-24 00:16:58 +00:00
Brian Rosmaita 8fd7e8c664 Use "multihash" for data download validation
When the Glance "multihash" is available on an image, the
glanceclient should use it instead of MD5 to validate data
downloads.  For cases in which the multihash specifies an
algorithm not available to the client, an option is added
to the image-download command that will allow fallback to
the legacy MD5 checksum verification.

Change-Id: I4ee6e5071eca08d3bbedceda2acc170e7ed21a6b
Closes-bug: #1788323
2018-09-07 14:50:24 -04:00
wangxiyuan eba4bb06d9 Skip quote '=' for token header
If the token is encoded by base64, it may contain '=' char
as well.

We should skip quoting it.

Change-Id: I1ca63d251fa366f0e8e58128d45b729a2489b65c
Partial-Bug: #1783290
2018-07-26 11:41:27 +08:00
Zuul c26c6380d0 Merge "Do not quote '+' for token header" 2018-07-25 20:39:53 +00:00
Abhishek Kekane d7fbd0a516 Add support for hide old images
Added --hidden argument to list, create and
update call.

Related to blueprint hidden-images
Change-Id: I1f2dcaa545c9da883186b20a96a70c7df994b994
2018-07-25 10:27:28 -04:00
wangxiyuan 818362147d Do not quote '+' for token header
The token in request header may contain url char, such as '+',
if quote it, '+' will change to '%2B' which will lead to 401 error.

Our CI doesn't notice this bug because Keystone use fernet token
which doesn't contain url char by default. But token format in
keystone is plugable, some out-tree token formats may contain
url char (for example, PKI/PKIZ token).

So we should skip quote token to avoiding information changing.

Closes-bug: #1783290
Change-Id: I5aa71b3e2b9b19581e46ccf8a80eda5d637f17d1
2018-07-25 16:22:43 +08:00
Zuul ccbd86ba13 Merge "Unit tests for multi-store support" 2018-07-25 00:55:36 +00:00
Zuul ac378e0254 Merge "Add multi-store support" 2018-07-25 00:39:14 +00:00
Abhishek Kekane ce5a929b9b Unit tests for multi-store support
Related to blueprint multi-store

Change-Id: Ib22cc5fd4eee0326c307abb236ef31a39edfa6a6
2018-07-24 11:02:19 +00:00
Abhishek Kekane 71bfd7bfad Add multi-store support
Added multi-store support. User can now use '--backend'
option to pass desired store while creating, uploading or
importing image to speific store backend.

Added new command 'stores-info' which will return available
stores information to the user.

Related to blueprint multi-store
Change-Id: I7370094fc4ed47205b5a86a18b22aaa7b9457e5b
2018-07-24 10:54:18 +00:00
Abhishek Kekane 1f1a8176ce Add support for multihash
Related to blueprint multihash

Change-Id: Iff4a5fe224b5d47255d7f23f65bbc08468f47f02
2018-07-23 11:06:57 +00:00
Doug Hellmann e484311923 update shell tests to not rely on the serialization order of a dict
Under python 3 with ordering randomized we cannot depend on the JSON
output matching exactly. Instead we de-serialize the data structure
that was written and compare the structures, which will always match.

Change-Id: I134b62413a7cde25f3efda6a2452c1e3d11d41d0
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-06-07 17:51:28 -04:00
Cyril Roelandt abfe0f4bf3 Image show: print human readable string when the virtual size is unknown
Currently, when the virtual size of an image is not known, "None" is displayed.
To a regular user, it feels like a programming error. We try and make things
clearer by using a "human readable" string instead.

Change-Id: Id7b8799356857d9bc58cc8a3677024fe1a7f4f56
Partial-Bug: #1665037
2018-05-31 18:52:20 +02:00
Zuul 1ef5e5d169 Merge "Removes unicode 'u' response from "glance image-tag-update"" 2018-05-18 16:23:20 +00:00
Brian Rosmaita ee029a9b92 Handle HTTP headers per RFC 8187
According to RFC 8187, HTTP headers should use 7-bit ASCII encoding.
The glanceclient was encoding them as UTF-8, which can leave the 8th
bit nonzero when representing unicode, and which presents problems
for any recipient following the standard and decoding the headers as
ASCII.

This change requires keystoneauth1 3.6.2, which has a fix for a
bug that made it unable to handle bytes in headers.  The dependency
is a patch bumping the keystoneauth1 version in upper-constraints.

Depends-on: https://review.openstack.org/#/c/569138/

Change-Id: I0d14974126fcb20e23a37347f4f1756c323cf2f5
Closes-bug: #1766235
2018-05-17 15:53:34 -04:00
Zuul 94aa58e89e Merge "Split glanceclient functional tests" 2018-04-12 17:17:19 +00:00
Zuul 939e532a3a Merge "Update local copy of image schema for 2.6" 2018-04-11 04:34:37 +00:00
Brian Rosmaita e89fcae346 Update local copy of image schema for 2.6
Update the local copy of the image schema to reflect Image API 2.6.

Change-Id: Ib0e56027927880d0fa198ffd8ea4b57e39f9d0fe
Closes-bug: #1762044
Depends-on: https://review.openstack.org/#/c/559501/
2018-04-08 14:48:36 -04:00
Brian Rosmaita 46dd4dd60f Make image-import fail faster
Add checks to image-import command so that it provides better user
feedback in failure situations.

Change-Id: I8b6b32c3d1d1a745aa68ff8dc629419dff9bb130
Closes-bug: #1758718
2018-04-04 14:36:13 -04:00
Brian Rosmaita 79543a67ed Make image-create-via-import fail faster
Add checks to the image-create-via-import commmand so that it provides
better user feedback and doesn't begin the import workflow unless the
input has a chance of succeeding.  Preserves backward compatibility
with the current image-create command by (1) allowing an image record
only to be created when no import-method is specified AND no data is
supplied, and (2) doing the glance-direct workflow when no import-
method is specified AND data is provided.  Also adds the ability for
the import-method to be set as an env var OS_IMAGE_IMPORT_METHOD.

Change-Id: I0a225f5471a9311217b5d90ebb5fd415c369129a
Closes-bug: #1758149
2018-04-04 13:51:40 -04:00