This replaces the 'glance task-list' command.
$ openstack image task list
We also indicate that the 'image task create' command will never be
implemented. This is an admin-only API that isn't really intended to be
used by humans thus it does not need an OSC command implementation.
Change-Id: Id8a943a5443782fc70c0fbf3639f5aa17b9d30af
The 'image create' operation is actually one of two operations: it can
be either an image service (glance) operation if the '--volume' argument
is *not* passed or a block storage (cinder) operation if it is. Make
this clearer and add a log warning users about options that are
supported by the former but not the latter.
Change-Id: Id153c951a7d18403568bf67e13d5e0a4827428d4
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Simplify some logic by using a common 'dest' for mutually exclusive
options.
Change-Id: Ie5f3600672953f40be52de51e84717c8912ddaf8
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Currently the command ``openstack image create --volume`` calls cinderclient
to upload the volume to image service (glance) but OSC passes ``visibility``
and ``protected`` fields which are only available in microversion 3.1 or
greater. This generates an error if the user is using volume microversion
< 3.1 and wants to create an image from volume.
This patch fixes that by only passing ``visibility`` and ``protected`` fields
when the volume microversion is 3.1 or greater and fail otherwise i.e. the
following 3 cases:
1) visibility/protected argument + mv >= 3.1 = pass
2) visibility/protected argument + mv < 3.1 = fail
3) not visibility/protected argument + any mv = pass
Story: 2010060
Task: 45511
Change-Id: I568a0ea0af8f7f82b16d49a6a1bb0391b99c50dc
Add a "--all" option to "openstack image list", which allows the user to
list all of the images.
Story: 2010071
Change-Id: I56a2e4846d0380d07803305fb830d1a43dfd71b3
Currently in case of passing `--tag` several times, only last one will
be picked up for the filtering. In the meanwhile Glance allow option to
be repeated multiple times to filter based on the multiple tags.
Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/789827
Change-Id: I7379d0b0014f0e3d13b02ee5ec6b642a7a5aa7d1
currently this double-private method of a dependency library
is used in several places (openstack.cloud._utils._is_uuid_like)
openstacksdk deliberatly chose not to depend on oslo.utils to keep
dependenies to the minimum, so it just copied several methods from it,
including the is_uuid_like.
python-openstackclient however already depends on oslo.utils, so
using the public method from oslo.utils should be preferred
and more stable.
Change-Id: I578ffa36ffb00c9d47ee12a149313201973edd32
This was a very difficult command to grok, due to the layering on of
additional features over the years. Make this a little easier to follow
by grouping related logic and making use of argparse features.
Change-Id: I4e1a0aed09ea5d6a8c26ec3e888c9c7b6cefc25a
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
There were a number of 'get_osc_show_columns_for_sdk_resource' defined
in-tree. However, osc-lib has provided this method for some time (since
2.2.0, June 2020 [1] - our minimum version is currently 2.3.0) so
there's no need to provide our own copies. Remove them.
[1] https://github.com/openstack/osc-lib/commit/29a0c5a5
Change-Id: I25695f4f9a379dd691b7eaa1e3247164668ae77e
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
The --protected, --unprotected, --public, --shared, --community,
--private flags were ignored when using --volume.
Change-Id: Id5c05ef7d7bb0a04b9d7a9d821e544e1ff7b3d28
Story: 2008882
openstack-client doesn’t support the upload progress bar.
This patch shows progressbar when create image
if you added '--progress' option like a python-glanceclient.
like this.
[=============================>] 100%
+------------------+---------------------------+
| Field | Value |
+------------------+---------------------------+
| container_format | bare |
| created_at | 2020-09-06T20:44:40Z |
...
How to use
Add the'--progress' option on the 'openstack image create' command.
Code was written by referring to 'python-glanceclient' project
on stable/ussuri branch
Change-Id: Ic3035b49da10b6555066eee607a14a5b73797c00
task: 40003
story: 2007777
Currently, we attempt to unset an image property by setting it to None.
This doesn't work for known properties and is rightly rejected by the
Glance API with the following error:
BadRequestException: 400: Client Error for url:
http://172.20.4.87/image/v2/images/368c5751-2b0b-4a38-a255-fd146fe52d31,
Bad Request
The solution is to actually unset the field by deleting it.
Change-Id: Ie156bedbe0f9244f82c81401679706f484caf9aa
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Story: #2008463
Task: #41493
With 60e7c51df4cf061ebbb435a959ad63c7d3a296bf the behaviour of
`openstack image create` changed so that you can't create an image
with the same name. This patch restores the previous functionality.
Story: 2008229
Task: 41069
Change-Id: Ia0f4920371a918e94d1ccf9fcfcbf90ff885a455
openstacksdk added support for using image import as a fallback
which is transparently supported here, but also provides an
override flag to allow a user to force use of import. Expose that
here.
Depends-On: https://review.opendev.org/737608
Change-Id: Ied938a8f63f305305a20ace42e9f4c84b0a5c00e
There is a much deeper and systemic issue going on here, but let's
start with fixing the immediate issue which is that adding a project
to an image fails trying to look up project information even if the
user passes the project id by id.
_is_uuid_like from sdk isn't perfect, but it'll be good enough
for this.
Change-Id: I541416d737b961c56aa2f584c172528632fd5537
In https://review.opendev.org/#/c/650374/ a work has been started to
switch image service support from glanceclient with all it's
dependencies to the SDK version. With this change version 1 (anyway
deprecated since ages) is also being switched to SDK.
Change-Id: Ic391500af02a73d81d64a9e9113cca85c9e24390
This is a work to switch OSC from using glanceclient to OpenStackSDK.
With this change only v2 is using OpenStackSDK. V1 is still using
glanceclient and will be switched in a separate change.
Remove the direct depend on keystoneauth- let that flow through
openstacksdk.
Depends-on: https://review.opendev.org/#/c/698972
Change-Id: I36f292fb70c98f6e558f58be55d533d979c47ca7
1. As mentioned in [1], we should avoid using 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
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85
Implements: blueprint replace-iteritems-with-items
Related functional tests are converted into JSON format.
Otherwise, it is not easy to check results.
Partial-Bug: #1687955
Partially implement blueprint osc-formattable-columns
Change-Id: Ib82e15738544975fede0c54cc5eaf239f4c67277
In order to see image sharing membership it is required to additionally
pass member_status filter to API. Otherwise only those with status 'all'
will be returned. Thus adding possibility to see images shared with
project to be approved or rejected.
Change-Id: Ifd6e13e5a4ef09fbc29e76d464c93fbdbb178ae4
Only with the admin role you can use the project name with
'image add project'. With the normal member role you have to
use the project id instead. If you try to use the name, you
don't receive an error, but it won't work.
Change-Id: I2d11c07a256917d12c46a7c302c5a5e8752a1df0
Task: 29543
Story: 2002535
Client site fix of --limit option.
This bugfix makes client "image list" command working again with
"--limit" option. This option was ignored and even if user specified it,
still list of all available images was returned.
Story: 2004314
Change-Id: I30a78d65a644c9b7d23706a6637ce77bca2c2386
Depends-On: https://review.openstack.org/#/c/634776/
This extension adds image signing functionality to the "image create" command.
Therefore, new CLI options --sign-key-path and --sign-cert-id have been added.
This patch uses openstacksdk as the signing backend library instead of cursive.
Therefore, requirements and lower_constraints have been updated to use the
openstacksdk version 0.17 or higher.
Depends-On: Idc15b9a12d408bd4b2e096da8402c374be56f9fa
Change-Id: Ia20bc02a49c3fbeb9222e485e3396395f4ab817a
Story: 2002128
Co-Authored-By: Markus Hentsch <markus.hentsch@secustack.com>
"--community" was added to "image create" and "image set" previously,
but was missed in "image list".
Change-Id: I959fdd7f67ae62c8326659ce52389228152ec019
Story: 2001925
Task: 14453
Need to bump osc-lib to 1.10.0
Closes-Bug: #1736696
Depends-On: I2aab5cc1f550848bda2b90ef7ef9a60f07b88996
Change-Id: I7420204f28d36529354e5671bd88587d9b15bb06
pycodestyle 2.40 and later enforce these rules that were not previously
enforced. Rather than just skipping them, this cleans up the trivial
instances of these violations.
This does also include some other updates that were not triggering errors
in an attempt to keep some of the style consistent.
Change-Id: Id7c0a6b8f1f835e69d844b000e3ed751852ada63
Closes-bug: #1762803
The OpenStack client presently has support to add or remove members
from an image, but no way to list image members. This patch addreses
this issue.
Change-Id: Ie85c5de23c6beb21fd6b4c04c83ddf2a116606ef
This is a followup to https://review.openstack.org/#/c/541609/ that
changes most outstanding direct uses of sys.stdout to use the encoded
stdout set up by cliff.
Change-Id: I07cfc418385fc787d3b7d3c32d39676cf81bb91f
a piece of code in image client has some business logic behind
assert, which can be lost when running python in optimized mode (-O).
Change-Id: I2179970df495e1215d691915c51cebe5cb4541a7
Now if Glance v2 cannot find image data it returns an empty
response with 204 status code, instead of raising an error.
Glance client handles this situation and wraps the response
with a RequestIdProxy object, whose 'wrapped' attribute is
None.
But when openstack client tries to parse this object using
glanceclient's save_image util function, it fails with
"NoneType object is not iterable" message, for the
object doesn't contain any data.
This patch adds additional check to prevent such behaviour
and raises SystemExit exception if no data was returned from
the server.
Glance v1 is not affected, because it raises an error if can't
find an image data.
Change-Id: I016a60462ba586f9fa7585c2cfafffd7be38de7b
Closes-Bug: #1741223
The current openstackclient implementation cannot accept 0
for --min-disk and --min-ram with the "openstack image set" command.
If theses options get set to 0, the option parser in openstackclient
wrongly interprets 0 as no option value. The 0 is valid for these
options if administrators want to make it the default(no minimum
requirements).
This patch fix the parser so that it avoids only 'None'.
Change-Id: Ie8ee37484c02c26f54adc56263fcd167c0ce7eb3
Closes-bug: #1719499