Currently glanceclient's v2 commands don't support modification
operations on an image's location attribute - the argparse specification
for the location attribute of the image-update command causes the image
id argument to be included in list of locations and so the command
parsing fails (because it causes the image id to appear to be missing).
Furthermore even if the 'locations' argument were to be accepted by
argparse (e.g. by changing the argument specs and using --id to specify
the image id) the command would still fail because the arguments are
passed directly to the schema which expects the value of the 'locations'
argument to be a valid dictionary (there is nobody to convert the
argument string to a python dictionary that the schema expects).
This commit adds the following location related commands to
glanceclient:
--location-add: Add a new location to the list of image locations.
--location-delete: Remove an existing location from the list of
image locations.
--location-update: Update the metadata of existing location.
The glanceclient.v2.images.Controller class has been agumented with
three new methods to support the commands listed above:
- add_location
- delete_locations
- update_location
The server has not been modified, i.e. all location related API requests
are passed to the server via HTTP PATCH requests and handled by the
server's image update function.
The v2 'image' and 'shell' related tests have also been supplemented.
Note that in order to use these options the server must be first
configured to expose location related info to the clients (i.e.
'show_multiple_locations' must be set to 'True").
I also added a mailmap entry for myself.
DocImpact
Closes-bug: #1271452
Co-Author: David Koo (koofoss) <david.koo@huawei.com>
Change-Id: Id1f320af05d9344645836359758e4aa227aafc69
This module is obsolete and has been dropped from oslo-incubator.
Use six instead (which is already done here).
Change-Id: I8e0b49cdfbddcf2d44a601ad06be2e75897905fc
Currently, calls (create, get, etc.) return only the Image to a
caller. In order to log a mapping the request IDs of both glanceclient
and the caller, the x-openstack-request-id header value is needed on
the server side. This change allows that value to be bubbled up and
returned to the caller so that the appropriate logging can occur.
The return_req_id parameter can be set by services that are logging
request IDs. Glance's request ID will then be returned via the
return_req_id parameter.
This is a prerequisite for Log Request ID Mappings nova-spec to
be completed; Change Ib9b820a0feeb0c0e828ed3e4fab8261f8761ba9a
Change I43be05c351f901cee5509c76cff6d69f060c0b3f is an example of
a caller using this.
Implements: blueprint return-req-id
Change-Id: Ia82aa14db5f0e453010514fffb9a25d7b0fc2fd1
Switch to using network_utils for splitting the URL. The code
in oslo-incubator supports ipv6 urls
Change-Id: I76be6173b97eb000319d30b4e9232a5a7c4a5aba
Closes-Bug: #1298137
Head of oslo-incubator is commit id:
2fd457bf2ccbeb2b84ffb204778b6417cd5405ba
includes a fix for gettextutil.Message handling of deep copy
failures and adding a license header
Change-Id: Ie89de1f95bb6fb9d11058413e682c441c39524f1
This will help with porting to Python 3. List of merged commits:
04a1abe59ac39890f57d2eed57d3d1b12bb5d757
12bcdb71ffbe9ee1688beed1f0ddb0c198822682
2cfc1a78d8063cf20083cf7df796d730a576551c
302c7c80b503b8090e8118e45061e8903b5339a9
35dc1d797209f0b22ff3ed3b8a6059961563daee
3b248dd683d83fd564f740ea58565d1bc0bd6cc0
4246ce0f373aa8f8955a99a3b6288a32547d8e80
6650435004af149284f0badb2bb8c89005cc7dab
6d55e26aa379fd043c66d1b7c5bf59a1b4a54632
71c22e9b2fbf04fc91a7343d3de0e0c7f10e3988
84d461e859e4b1eb1a00b9b141df61c37da84d2d
8575d87af49ea276341908f83c8c51db13afca44
885828af2297b20a3f9f8e8f6647f7291f784743
8b2b0b743e84ceed7841cf470afed6a5da8e1d07
9f1e7eb4112067423f845bd99ec52256db1c8bb1
bd5dad97585208ea5e86d636f3dc3b669e361a41
be81d6ba70152e5cdd7e8e9d789b9733c6ff527f
bec3a5eb8157c0c552c6392ccf0da342ffb8da26
c178e567cb48d3bc67dcf06bcbb4c6a97df9f434
Closes-Bug: 1289690
Change-Id: I39fa5e3fa46ffe9448b381ed54759cb4270cc898
It is Python2-specific, and should not be used in code intended to be portable.
Change-Id: Ibebef1a7e51a7444538275d22d444c926b8b4dec
Closes-Bug: 1284677
Make help strings consistent to use "." at end of string.
Fix capitalization of API in one help string.
Change-Id: I7cc5289d881c5e58aad9c69b4668584cdeb0b376
In Python 3, __next__() has replaced next(). Also, call the next() function
rather than the next() method.
Closes-Bug: #1281866
Change-Id: I92b44508c9c875f16ad89ef8410d2c38092ab23d
Some backend stores e.g. RBD, will fail if told to create an
image without a valid size (RBD will fail to write to a zero-size
image). Here we add support to allow the image size to be provided
when doing an upload. The result is that the upload content-length
will be set if available either from checking the supplied file
object or as provided by user.
Closes-Bug: 1220197
Change-Id: Ia1f2ea5680a139750d931591949b3e0058148b4b
This patch fixes a bug where both 'location' and 'progress' are passed
as command line arguments. In this case, the 'data' field is not
present in the fields dict and therefore the progress option cannot be
used. A check is added to make sure the user has specified both a local
image file and the progress flag together.
Change-Id: Ia563139ee8b56d54d480534986e4b619a503fbfc
Closes-Bug: #1259357
Using common method 'bool_from_string' from oslo strutils to replace
utils.string_to_bool.
partially implements blueprint common-client-library-2
Change-Id: I23924db3000feadcfe823c6cc979ea9752a13fa9
When using the cli the Glance client wraps the endpoint in a 'strip
version' function. This means that endpoints of the following forms can
both be used:
https://region-x.images.example.com:443/v1https://region-x.images.example.com:443
When calling the client library directly (as Ceilometer does) however
only endpoints of the second form work. The cli and library should handle
the two cases consistently.
Addresses bug 1243276.
Change-Id: Ice7b581fee32540a7057ba47433a10166a3caed2
When an empty image is created through python-glanceclient using v2 APIs
but updated using v1 APIs, python-glanceclient crashes with a "int()
argument must be a string or a number, not 'NoneType'" message.
This is because v1.images.ImageManager._format_image_meta_for_user
expects the 'size' (and 'min_ram' and 'min_disk') field of an image to
be convertible to 'int' but the server-side v2 APIs set it to 'None' for
an empty image. Therefore the conversion to int fails with the message
above.
This fix modifies _format_image_meta_for_user to check whether or not a
field can be converted to 'int' and, if not, returns 0 (zero) as the
value instead.
Tests have also been added.
Change-Id: I86680bc06c8ce3ee492efeb3f32071da4f293bcd
Closes-bug: #1258160
the client should not log a server 50x response at ERROR level.
It already throws an exception, so the caller can care about what
it wants to do with this. This error will show up regularly in
nova that succeed, and there is no way to disable this message,
which isn't an error from Nova's perspective without turning off
*all* the logs.
Set this to debug instead, because from a caller perspective that's
what you want out of this.
Change-Id: I6d0efb53d1e81adf309f7fa580ec5a8073a811c5
Those modules have been combined in python 3. Therefore,
implementing the six module helps to have support to both versions.
Change-Id: I164a0f19790ff066d16d0cf4f0daa6f1097c848e
Closes-Bug: #1267181
six.iteritems() replaces dictionary.iteritems() on Python 2 and
dictionary.items() on Python 3.
six.string_types replaces basestring() in Python 2 and str
in Python 3.
Change-Id: Ia18510d167df35caec83626718010228e2140bc0
* Fix "TypeError: not all arguments converted during string formatting"
* Add a UT case to cover the path where the bug is in
Change-Id: I91a137c5c3a9a3cc603804bef5eaea14ae281c08
Closes-Bug: #1265730
In the process of unification of the clients code we should
reuse common functionality from Oslo.
Related to blueprint common-client-library-2
Change-Id: I3d82621cced57ad7bc14a2a40e4bef7522f233da
Based on current implement, the cli output format will be bad if
the lines are too long. This issue can be fixed by setting 'max_width'.
However, there is a bug against it, see
https://code.google.com/p/prettytable/source/browse/trunk/CHANGELOG?r=85
line 3. So the requirements.txt is updated as well.
docImpact
Fixes bug 1251283
Change-Id: I0d4192ad9d10a3d6d47a8319463a5edb57719a68