Commit Graph

213 Commits

Author SHA1 Message Date
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
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
Mike Fedosin e77322c179 Don't update tags every time
This code removes unnecessary PATCH requests
for tags updating if they were not modified.

Change-Id: I8eced32f39d0c98e0b26014e7b2341ab6580ff01
Closes-bug: 1587999
2016-06-01 21:02:29 +03:00
Ihar Hrachyshka 3a0007a1c3 Fixed grammar in image-download command description
Change-Id: Ie18e1bee3376fdc01685c6f1d3a949c6934296b3
2016-06-01 10:07:47 +00:00
Jenkins 9ffebbb25e Merge "Enable hacking checks" 2016-04-20 17:13:16 +00:00
Tin Lam cd5925bc60 Enable hacking checks
Enabled following hacking checks from tox.ini:
- H233 Python 3.x incompatible use of print operator
- H303 no wildcard import
- H404 multi line docstring should start with a summary

Change-Id: I2553bcd3e80c00acc08d135a1d2dadfb6cda49fe
Partial-Bugs: #1475054
2016-04-18 16:23:59 +00:00
Dao Cong Tien 9faa9d47aa Fix typos in docstrings and comments
Update a comment to be more meaningful

Change-Id: Ie1aa46917c1a253db92a0dc819803a1d3e795b07
2016-04-11 09:08:02 +07:00
Jenkins 04e1ea73a5 Merge "Ship the default metadata schema in the client" 2016-03-24 18:35:28 +00:00
wangxiyuan d3de9ed16a Ship the default metadata schema in the client
Now the help message of namespace and resource_type are wrong,
we could see a <unavailable> error when try to get the help
information, such as "glance help md-namespace-create".

See the patch[1] to get more information. the patch[1] added
image schema, but the metadata schema are needed as well.

This patch adds the current metadata schema into client, so that
help text can't be rendered when there schema is not available in
the system.

[1]: https://review.openstack.org/#/c/209536/3

Change-Id: I2ab94d8768114a7e5c475310ba094af653627658
Closes-Bug: #1536430
2016-03-24 09:04:20 +00:00
Tom Cocozzello c6904d0332 Docs are generated incorrectly
When docs are generated with pbr command 'warnerrors = True'
there are many doc problems that are shown. This patch fixes
these problems.

Change-Id: Idb804ab924782b6d7d379494987bdba2acbce568
Closes-Bug: #1557235
2016-03-22 13:28:14 +00:00
Jenkins d59e341a4c Merge "Fix location update" 2016-03-11 22:52:56 +00:00
Fei Long Wang 8b6dbb2065 Fix location update
After commit Ieb03aaba887492819f9c58aa67f7acfcea81720e, the command
location-update is totally broken now. This patch removes the updating
for an image from non-empty to empty since it's not supported now.
And also removing the default value of metadata for location-update
cli command because now the only purpose of location-update is updating
the location's metadata, so it doesn't make sense to give it a default
value which may update existing metadata by mistake.

Closes-Bug: #1537626

Change-Id: I9ce98e6c63996bbfdbc56761055e37a871f9d3e2
2016-03-11 12:51:13 +00:00
Danny Al-Gaaf 860908c517 Catch InUseByStore case in do_image_delete
In case do_image_delete() is called on an image that is
in use and can't be deleted by the driver a HTTPConflict
error is raised in glance. Catch this error and print a
propper error message.

Closes-Bug: #1551037

Change-Id: Id17098f27511df8e05e56b8df21e748921223bd9
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2016-03-09 23:27:02 +01:00
Jenkins 6aaa6f2f8c Merge "Handle 403 forbidden on download" 2016-02-29 13:04:08 +00:00
Stuart McLaren 5b9f21b38b Handle 403 forbidden on download
A download of a deactivated image may result in a 403.
The cli should catch this error rather than stack trace.

We also catch other unexpected http responses.

Change-Id: If33fbc3a56cdb02b3ab32a6479a67fff20b4b1a9
Closes-bug: 1523612
2016-02-24 18:31:38 +00:00
Jenkins c58b4cc984 Merge "Auto-generated squash commit" 2016-02-12 00:10:58 +00:00
Flavio Percoco e91d8ec4b8 Auto-generated squash commit
Fix misspellings

Upstream-Change-Id: Ie7ecbe4b33dd0e1ef94b0be85ec3af790cc6fcd7

Correct spelling mistake

Change interable to iterable.

Upstream-Change-Id: I468a87a3df9ed00ed82f1ba0d6abbbc6944cf613

Change-Id: I4de8426cd19ef0bc7c00fe57f8bc3303d0a4f8a4
Co-Authored-by: venkatamahesh <venkatamaheshkotha@gmail.com>
Co-Authored-by: Irina <yuyuesh@cn.ibm.com>
2016-02-11 12:26:55 -04:30
Jenkins 7f9c6d62a5 Merge "v2 - "readOnly" key should be used in schemas" 2016-02-08 10:16:32 +00:00
zwei 22e3bf0234 v2 - "readOnly" key should be used in schemas
If it has a value of boolean true,
    this keyword indicates that the instance property SHOULD NOT be changed,
    and attempts by a user agent to modify the value of this property are expected to be rejected by a server.
    The value of this keyword MUST be a boolean.
    The default value is false.

    Further link for reference: http://json-schema.org/latest/json-schema-hypermedia.html#anchor15

Closes-Bug: #1521581
Depends-On: I279fba4099667d193609a31259057b897380d6f0
Change-Id: I96717506259c0d28500b8747369c47029b1dd9b6
2016-02-04 15:06:13 +08:00
kairat_kushaev 56c27d1cb8 Change metavar for location commands in V2
Currently location-add, location-delete and location-update
shows <ID> in help messages as metavar for image id. It may be
not clear to the users so we need to change this to <IMAGE_ID>.

Change-Id: I59c787e449fa34bc792de179993c55f59734b9fe
Closes-Bug: #1535220
2016-01-20 12:04:29 +03:00
Jenkins ab234553cf Merge "Add help the ability to sort images with multiple keys" 2016-01-18 23:23:33 +00:00
kairat_kushaev a8d7ded8fb Enhance description of instance-uuid option for image-create
Current description of instance-uuid may confuse users because
they may think that instance-uuid can serve as basis for image
but it just stores instance-uuid as image-metadata.
So we need to enhance the description in glanceclient.

Change-Id: I55829d106c9d25374df6538b3071104ee5f215f2
Closes-Bug: #1496822
2016-01-18 12:41:17 +03:00
Jenkins 0b7a6d2379 Merge "Remove location check from V2 client" 2016-01-15 05:27:21 +00:00
kairat_kushaev cea67763c9 Remove location check from V2 client
Glance client has a custom check that generates exception if
location has not been returned by image-get request.
This check should on server side and it should be managed by
policy rules when do location-add action.
That also allows to increase possibility of migrating Heat
to v2[1].

NOTE: After this patch, we'll raise a HTTPBadRequest from
server side instead of HTTPConflict when a user adds a
duplicate location.

[1]: https://review.openstack.org/#/c/240450/

Co-Authored-By: wangxiyuan <wangxiyuan@huawei.com>

Change-Id: I778ad2a97805b4d85eb0430c603c27a0a1c148e0
Closes-bug: #1493026
2016-01-15 01:24:48 +00:00
Jenkins 2db882c41c Merge "Add docker to image_schema on glance v2 cli" 2016-01-14 15:24:07 +00:00