Commit Graph

236 Commits

Author SHA1 Message Date
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
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
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
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
Zuul ac378e0254 Merge "Add multi-store support" 2018-07-25 00:39:14 +00:00
Zuul a97d4194ef Merge "Add support for multihash" 2018-07-24 21:34:18 +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
Chen Hanxiao c159b5ccbc image-list: add checksum algorithm description
We use MD5 for checksum, add this description
in cli helps.

Change-Id: I3469b0dface63f4684ad39421eee4c2a2de4d80b
Signed-off-by: Chen Hanxiao <chenhx@certusnet.com.cn>
2018-07-24 08:45:01 +08:00
Abhishek Kekane 1f1a8176ce Add support for multihash
Related to blueprint multihash

Change-Id: Iff4a5fe224b5d47255d7f23f65bbc08468f47f02
2018-07-23 11:06:57 +00:00
Dougal Matthews b7442c5694 Replace 'raise StopIteration' with 'return'
With PEP 479, the behaviour of StopIteration is changing. Raising it to
stop a generator is considered incorrect and from Python 3.7 this will
cause a RuntimeError. The PEP recommends using the return statement.

More details: https://www.python.org/dev/peps/pep-0479/#examples-of-breakage

Change-Id: Ia067940066a5666926dcf61136b03d721a87666e
2018-06-29 14:31:51 +01: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
Zuul 3142c9ab14 Merge "Update properties URL" 2018-03-22 19:14:59 +00:00
Brian Rosmaita 6cd537e274 Check for container,disk_format on web-download
Fail image-create-via-import requests for the web-download import
method that don't include values for container_format or disk_format.

Closes-bug: #1757927

Change-Id: Ic5c81916823ff32f2dbddd32b40e825de0697dc9
2018-03-22 01:16:41 -04:00
Brian Rosmaita 0661da1ee9 Update properties URL
Help text for some image properties (architecture, os_distro) is
pulled from the glanceclient's local version of the image schema.
The URL for those property definitions has gotten out of sync with
Glance.  This patch updates the URL to be the same as that given
in the Glance image-schema response.

Change-Id: I4e46e78525fe5c00e031a98c47cacc17e5693d53
Closes-bug: #1757918
2018-03-21 22:30:29 -04:00
PranaliD aedabec9e4 Add support for web-download import method
This change adds support for 'web-download' import method
to 'image-import' and 'create-image-via-import' call.
To use this 'web-download' import method, user needs to pass
--uri option 'a valid uri to external image to import in glance'
to 'image-import' and 'create-image-via-imaport' calls.

Co-authored-by: Pranali Deore <pdeore@redhat.com>
Co-authored-by: Erno Kuvaja <jokke@usr.fi>

Change-Id: I0e1d18844f64723608288de473e97710798eb602
2018-03-21 15:09:13 +00:00
Stephen Finucane 4dcbc30e31 Compare against 'RequestIdProxy.wrapped'
Due to the 'glanceclient.common.utils.add_req_id_to_object' decorator,
an instance of 'glanceclient.common.utils.RequestIdProxy' is returned
for most calls in glanceclient. If we wish to compare to None, we have
to compare the contents of this wrapper and not the wrapper itself.

Unit tests are updated to highlight this.

Change-Id: I7dadf32d37ac2bda33a92c71d5882e9f23e38a82
Closes-Bug: #1736759
2018-01-02 11:36:02 +00:00
Jenkins b90236eef8 Merge "image-create-via-import fails with ValueError" 2017-08-24 19:54:41 +00:00
Abhishek Kekane 335f1e9447 image-create-via-import fails with ValueError
CLI image-create-via-import fails with ValueError. The reason
is create command returns RequestIdWrapper object and not image
and response.

Further it fails with AttributeError: 'Namespace' object has
no attribute 'import_method'. The reason is do_import_image() call
requires 'import_method' as input which is not provided at the
moment.

Change-Id: Ic4c4d1f3c5d290b584840e8f9047fb53611a5748
Closes-bug: #1711511
2017-08-24 14:29:37 +00:00
Jenkins b956f48078 Merge "Fix image-import call" 2017-08-24 09:17:30 +00:00
Brian Rosmaita e5b69eff69 Fix image-import call
Change the request body sent from the client to be the format
that the API expects for the image-import call.

Depends-On:  I08783e28719e63b5a4b2115b8fce135e55be460a
Change-Id: I5e34d772d561306c6f103c859740658a825dd189
Closes-bug: #1711259
2017-08-18 15:12:04 +00:00
Abhishek Kekane 0e50837a37 stage call fails with TypeError
image-stage call fails with TypeError saying 'stage() takes exactly
3 arguments (4 given). The reason is stage() also accepts image_size
as a argument which is not provided.

Further it raises 'NoneType' object has no attribute 'headers'. The
reason is stage() internally calls upload method which
returns a object of RequestIdWrapper on body (which is None) and
response. In stage call it again tries to add request id which requires
response object but instead it has a RequestIdWrapper which fails to
retrieve headers.

Change-Id: I4de4be7a55f35c3533b53acd48042c7c95b4bdc0
Closes-bug: #1711090
2017-08-17 11:37:20 +05:30
Erno Kuvaja 52eb529b97 Add missing docstring
Adding missing docstring for image-import command.

Change-Id: Ide95056797230963e9ef63c1cb72d42e697023e7
2017-07-27 21:09:05 +00:00
Jenkins 083931f87f Merge "Add image import features to client" 2017-07-27 21:04:08 +00:00
Erno Kuvaja c0753bdde6 Add image import features to client
This change adds availability of the features introduced on Image
Import Refactoring work. Including:
Discovery call to discover what Import modes are available
Staging call to stage the image for import in 'glance-direct'
Import call to trigger the actual Image Import task
EXPERIMENTAL: Image creation with the new workflow

Change-Id: I2d10ac0cc951c933c3594837b490638e38ff0b12
2017-07-27 18:07:50 +00:00
Jenkins 982857abc8 Merge "Validate input args before trying image download" 2017-07-26 14:15:35 +00:00
Jenkins 7ad13b648a Merge "Fix 'UnicodeEncodeError' for unicode values in url" 2017-07-24 14:36:17 +00:00
Ravi Shekhar Jethani 1df55dd952 Validate input args before trying image download
Currently client is contacting glance service even if the
caller has niether specified any redirection nor '--file'
option. This unnecessary request although isn't causing
any critical issues but can be avoided by simply doing
input validation first.

TrivialFix

Change-Id: I841bebeda38814235079429eca0b1e5fd2f04dae
2017-07-24 14:54:57 +05:30
ji-xuepeng 5fca39dbde Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid usingg
six.iteritems to achieve iterators. We can
use dict.items instead, as it will return
iterators in PY3 as well. And dict.items/keys
will more readable. 2.In py2, the performance
about list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: I71c13040318eca6e5ed993e8aa03f8003986a71c
2017-02-08 16:33:46 +08:00
Jenkins c1f54742f9 Merge "Replace dict.iteritems() with dict.items()" 2017-01-24 22:34:49 +00:00
bhagyashris a884becdd4 Fix 'UnicodeEncodeError' for unicode values in url
Used '%' instead of format() because format() function doesn't
support the parsing of unicode codec like u'\U0001f693' in Python 2.

Python3 parse unicode codec with .format() correctly.

For example:

openstack@openstack-VirtualBox:~$ python2
Python 2.7.6 (default, Oct 26 2016, 20:30:19)

>>> '{0}'.format(u'\U0001f693')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\U0001f693'
in position 0: ordinal not in range(128)

>>> '%s' % (u'\U0001f693')
u'\U0001f693'

NOTE: format() fuction will parse unicode codec in Python 2 after
prefixing 'u' like u'{0}.format(u'\U0001f693') but prfixing 'u'
at every place is not good, so it's better to use the '%' module.

Change-Id: I2fcca96a1356df08453e08487afb62dfec91ba9d
Closes-Bug: #1570766
2017-01-24 12:39:20 +05:30
Jenkins 99cbde26ac Merge "Add support for community images" 2017-01-23 22:19:37 +00:00
Jenkins a76fdcd20a Merge "Add request id to returned objects" 2017-01-23 22:19:31 +00:00
Ravi Jethani 610177a779 Add request id to returned objects
Adding two classes RequestIdProxy and GeneratorProxy derived from
wrapt.ObjectProxy to wrap objects returned from the API.

GeneratorProxy class is used to wrap generator objects returned
by cases like images.list() etc. whereas RequestIdProxy class is
used to wrap non-generator object cases like images.create() etc.

In all cases the returned object will have the same behavior as
the wrapped(original) object. However now the returned objects
will have an extra property 'request_ids' which is a list of
exactly one request id.

For generator cases the request_ids property will be an empty list
until the underlying generator is invoked at-least once.

Co-Authored-By: Abhishek Kekane <abhishek.kekane@nttdata.com>

Closes-Bug: #1525259
Blueprint: return-request-id-to-caller
Change-Id: If8c0e0843270ff718a37ca2697afeb8da22aa3b1
2017-01-20 14:50:42 +05:30
Evgeny Antyshev 6ab6a740ff Add ploop in disk_format
"ploop" image format is supported in upstream Glance
https://review.openstack.org/341633

And similar patch has been added in python-openstackclient:
https://review.openstack.org/411405

Co-Authored-By: yuyafei <yu.yafei@zte.com.cn>
Change-Id: I1471224df97cf5fecfe7f02e549855af81c45848
Related-Bug: 1650342
2017-01-19 14:31:01 +00:00
Li Wei efb5e2aa32 Add vhdx in disk_format
vhdx is also a format of the disk valid value in v2 version,
so add it in disk_format.

Related-Bug: 1635518
Co-Authored-By: Stuart McLaren <stuart.mclaren@hpe.com>
Change-Id: I7d82d4a4bdb180a53e86552f6f6b3bed908e6dc0
2017-01-10 07:41:02 +00:00
Luong Anh Tuan 1a5fac7da2 Replace dict.iteritems() with dict.items()
Following Python 3 guide https://wiki.openstack.org/wiki/Python3
Thus, we should replace task.iteritems() with task.items()

Change-Id: If617c3a87836930dc78a4ce7dd45a9b7804e0d24
2016-12-20 11:02:42 +07:00
Alexander Bashmakov 20ab7b8201 Add support for community images
This patch adds support for community images retrieval and
creation in the Glance client.

Depends-On: I94bc7708b291ce37319539e27b3e88c9a17e1a9f
Change-Id: I81e83eab5a9d30643c354f0cb6df425cf7a7bae3
2016-11-10 22:55:33 +00:00
Jenkins d4196325eb Merge "Revert "Don't update tags every time"" 2016-08-20 19:16:37 +00:00
Steve Martinelli b78285761d Revert "Don't update tags every time"
This reverts commit e77322c179.

Change-Id: Ida826a2aa888beeb76dbe657b2ccd6cb088157ed
2016-08-19 06:10:14 +00:00
KATO Tomoyuki 3a10936248 Update doc URL
Docs team changed URL for search engine optimization.

Change-Id: I68e2a5d666da55722d5ee2fa4aec2326c0de0946
2016-08-19 07:31:05 +09:00
Jenkins 5de07c3395 Merge "Fix warlock model creation" 2016-08-12 15:15:46 +00:00
Jenkins 7936f173c0 Merge "Don't update tags every time" 2016-08-08 09:09:22 +00:00
dineshbhor 98bbbb88e7 Replace OpenStack LLC with OpenStack Foundation
Change-Id: I5877db07031b12d8fa7ed774ac09d24f8906ea86
Closes-Bug: #1214176
2016-07-26 15:17:14 +05:30
Jenkins 1763e33d3d Merge "Update outdated image shema" 2016-07-16 10:27:18 +00:00
KATO Tomoyuki b660d3247a Update docs URL
Change-Id: Id8b1b97a85534c4398b3c49648c6e2f2df3ee20e
Related:-Bug: #1602266
2016-07-13 09:00:24 +09:00
Sabari Kumar Murugesan d7db97c926 Fix warlock model creation
Commands like glance md-namespace-show <namespace> fail because
of a breaking change in warlock 1.3.0's model creation factory
method.

Warlock introduced a new kwarg 'resolver' in model_factory method
but changed its position with the 'base_class' kwarg. Since we
were calling the model_factory method with positional arg, this
broke the model creation.

Closes-Bug: #1596573

Change-Id: Ic7821f4fdb1b752e0c7ed2bc486299a06bf485c1
2016-07-06 18:18:42 -07:00
Mike Fedosin 29cfd07e17 Update outdated image shema
Image schema that is located in glance client
is seriously outdated, we need to updated it
and bring it in line with the server version.

Change-Id: I5a79a84a9c07b9ee821a71a5bd2d61cb4299ad72
2016-06-28 20:59:05 +03:00