58 Commits

Author SHA1 Message Date
Yamini Sardana
db5d72947c Updated help for v2 member-update api
help message for v2 glance member-update api
now displays the Valid Values of member status
variable.

The valid values are: pending, accepted, rejected

Change-Id: Ibe6f55c933668451b407ed9a19c520c3fbf1912a
Closes-bug: #1420707
2015-03-17 11:45:43 +05:30
Mike Fedosin
3f3066be97 Extend images CLI v2 with new sorting syntax
This code enables new syntax for sorting output with multiple
keys and directions based on API Working group sorting
guidelines.

It's a client code to consume API modified in change
Ie4ccfefa0492a3ac94cc7e22201f2f2be5c1cdbb

Example:
glance --os-image-api-version 2 --sort name:desc,size:asc

Implements-blueprint: glance-sorting-enhancements
DocImpact
Depends-On: Ie4ccfefa0492a3ac94cc7e22201f2f2be5c1cdbb
Change-Id: I36a9fa9f0508fea1235de2ac3a0d6a093e1af635
2015-03-16 19:31:49 +03:00
Mike Fedosin
bbd27d5276 Add the ability to specify the sort dir for each key
Adds client code to consume API modified in change
Ib43b53abfba7cb5789d916a014376cf38fc5245b

Extends CLI for v2 with multiple sort dirs
Example:
glance --os-image-api-version 2 image-list \
--sort-key name --sort-dir asc --sort-key size --sort-dir desc

Implements-blueprint: glance-sorting-enhancements
DocImpact
Depends-On: Ib43b53abfba7cb5789d916a014376cf38fc5245b
Change-Id: Ia20716f3c75299f796879299da317b2e81496088
2015-03-16 14:29:06 +03:00
Mike Fedosin
fc79467ff6 Adds the ability to sort images with multiple keys
Adds client code to consume API modified in change
Ib7a6aeb2df3bc5d23fe8e070290b5bfcab00c0f5

Extends CLI for v2 with multiple sort keys
Example:
glance --os-image-api-version 2 image-list --sort-key name --sort-key size

Implements-blueprint: glance-sorting-enhancements
Change-Id: If79779a4c52c8dc5c4f39192d3d247335a76ba24
DocImpact
Closes-Bug: 1221274
2015-03-13 18:35:00 +03:00
Jenkins
23c8d1818a Merge "v2: read limit for list from --limit in shell" 2015-03-06 22:38:24 +00:00
Jenkins
c7c4ac9e85 Merge "v2: Allow upload from stdin on image-create" 2015-03-06 19:55:15 +00:00
Jenkins
8eaf97d42e Merge "Fix v2 image create --file documentation" 2015-03-06 19:49:13 +00:00
Louis Taylor
a9a692b351 v2: read limit for list from --limit in shell
Previously this was read from the --page-size argument, which lead to
incorrect behaviour.

Change-Id: I08ecda95eca0ff524e28a1d5371ce6c73dfc548e
Closes-Bug: #1429088
2015-03-06 13:18:11 +00:00
Kirill
6e0b1f4d2b removed excessive call to os.path.exists
os.path.isfile checks for existance anyway so
there is no point in checking both isfile and exists

Change-Id: Idbc2d22a807d5413db6e27ff0f6b5a87a5af8fa3
2015-03-03 01:03:28 +03:00
Jenkins
654ba87a89 Merge "Glance image delete output" 2015-02-20 14:48:49 +00:00
Abhishek Talwar
f7cdc3eefe Glance image delete output
Deleting an already deleted image using admin user is throwing an
error "404 Not Found" which is confusing. Deleting an image that does
not exist throws "No image with a name or ID of 'image-id' exists."

Updated the code so that trying to delete an already deleted image
throws "No image with an ID of 'image-id' exists." error.

Closes-Bug: #1333119
Change-Id: I8f9a6174663337a0f48aafa029a4339c32eb2134
Co-Authored-By: Abhishek Talwar <abhishek.talwar@tcs.com>
Co-Authored-By: Kamil Rykowski <kamil.rykowski@intel.com>
2015-02-17 11:27:24 +01:00
Jenkins
5b2603d74e Merge "Disable progress bar if image is piped into client" 2015-02-04 23:41:11 +00:00
Flavio Percoco
93c9bc1fe0 Add a --limit parameter to list operations
In v2, we use the link header during paginations to know when there are
more images available in the server that could be returned in the same
request. This way, it's possible to iterate over the generator returned
by list and consume the images in the server.

However, it's currently not possible to tell glanceclient the exact
number of images we want, which basically means that it'll *always* go
through the whole list of images in the server unless the limit is
implemented by the consumer.

DocImpact
Change-Id: I9f65a40d4eafda6320e5c7d94d03fcd1bbc93e33
Closes-bug: #1415035
2015-01-29 10:37:55 +00:00
Stuart McLaren
6d21959e15 v2: Allow upload from stdin on image-create
For example:

$ glance --os-image-api-version 2 image-create < /tmp/data

This is consistent with v1.

DocImpact
Closes-bug: 1408033

Change-Id: Ifed4ece9e4e02a46d80b49a8e4fc372f1a304241
2015-01-07 17:47:31 +00:00
Stuart McLaren
4c7c7adb3f Fix v2 image create --file documentation
Help for 'v2 image create --file' should refer to upload,
not download.

DocImpact

Change-Id: I2ae00e3242fb10001e216cde93fdf9c6f18ad13e
Closes-bug: 1408028
2015-01-06 17:13:42 +00:00
Louis Taylor
9054324442 Disable progress bar if image is piped into client
Previously, running:

    cat something.img | glance image-create --progress --container-format=bare --disk-format=raw

or

    cat something.img | glance --os-image-api-version 2 image-upload --progress <image id>

would result in an error. This error was caused by the length of the
input being unknown, so the overall progress cannot be found.

This patch disables the progress bar whenever the size of the input file
cannot be determined.

Change-Id: I6bfef7441864b638194126880241cc2c96d5b18b
Closes-Bug: #1402746
2015-01-06 10:36:01 +00:00
Erno Kuvaja
8e02b2a641 Allow --file in image-create with v2 Image API
Allows passing --file and --progress to glance image-create with Image API v2.

if --file is present the image-create effectively calls image-upload with the
newly created image's id and the '--file' + '--progress' paramaters. The image
metadata will be printed after the upload call instead of after creation.

In a case argumented file does not exist the image will not be created and
error will be printed instead.

DocImpact
Closes-Bug: #1324067

Change-Id: I5d41fb2bbeb4e56213ae8696b84bf96b749414f8
2014-11-26 09:34:48 +00:00
Jenkins
3756388af4 Merge "Add --property-filter option to v2 image-list" 2014-11-20 01:50:38 +00:00
Michal Dulko
d0851c32ed Remove readonly options from v2 shell commands
This commit is removing the read-only properties from shell options to
prevent user from doing invalid requests using the client.

Change-Id: I17e9578e705bd3cf628fe39630ebecc4ea43e392
Closes-Bug: 1350802
2014-11-14 11:46:39 +00:00
Louis Taylor
4194a55a09 Add --property-filter option to v2 image-list
The option is present in the v1 shell, but missing from the v2 shell. This
allows the user to filter based on any image property.

Example:

    $ glance --os-image-api-version 2 image-list --property-filter os_distro=NixOS

DocImpact
Closes-Bug: #1383326

Change-Id: Ia65a08520e3eaf3ecd9b9018be9f6a8e2d3d4f0b
2014-11-14 10:45:31 +00:00
Jenkins
cfe0623520 Merge "Adds support for Glance Tasks calls" 2014-10-16 03:37:48 +00:00
Fei Long Wang
7ef1b7c9b1 Adds support for Glance Tasks calls
Add tasks operations on client side to support task create,
list all and show.

DocImpact
Implement blueprint async-glance-workers

Change-Id: Ib4b8e347a8a47817e3b427c8ba024e8c32f65155
2014-09-22 15:23:55 +12:00
Jenkins
8a877b2752 Merge "CLI image-update gives a wrong help on '--tags' param" 2014-09-19 09:14:31 +00:00
Pawel Koniszewski
33dcea81b2 Support for Metadata Definitions Catalog API
API calls and shell commands added in this patch:
- CRUD for metadefs namespaces;
- CRUD for metadefs objects;
- CRUD for metadefs properites;
- CRD for metadefs resource types and resource type associations.

Change-Id: I6d15f749038e8fd24fc651f0b314df5be7c673ef
Implements: blueprint metadata-schema-catalog-support
Co-Authored-By: Facundo Maldonado <facundo.n.maldonado@intel.com>
Co-Authored-By: Michal Dulko <michal.dulko@intel.com>
Co-Authored-By: Lakshmi N Sampath <lakshmi.sampath@hp.com>
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
2014-09-03 11:45:57 -06:00
Zhi Yan Liu
8770586e7a CLI image-update gives a wrong help on '--tags' param
The help message tells end user image-update interface accepts 'tags'
param and could be used to update tag of image [0], but actually it
could trigger an 400 exception [1] due to wrong PATCH calls, and the
correct way is to use image-tag-update interface [2] as designed.

[0] glance image-update <IMG_ID> --tags <TAG_VALUE>

[1] 400 Bad Request
    Invalid JSON pointer for this resource: '/tags/0'
        (HTTP 400)

[2] glance image-tag-update <IMG_ID> <TAG_VALUE>

Change-Id: Iaa8041779510192dc08f7b898b8a1beda29a6398
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
2014-07-10 13:54:35 +08:00
ChangBo Guo(gcb)
1db17aaad9 Enable F841
F841 detects local variable is assigned to but never used.
This commit fixes the violations and enables F841 in gate.

Change-Id: Ic4dcac2733dfe334009327ac17aa3952cafaa63a
2014-07-09 14:10:23 +08:00
Jenkins
3b694ca89f Merge "Add support for location parameters in v2 commands" 2014-06-17 09:13:41 +00:00
Jenkins
2739317260 Merge "progress flag not supported in v2 API" 2014-06-17 05:38:14 +00:00
David Koo
323d32cc6d Add support for location parameters in v2 commands
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
2014-06-16 21:56:41 +00:00
Christian Berendt
afcf3a5611 fixed typos found by RETF rules
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos

Change-Id: I70245e5ddf342762eb76d8e2e74b6363767726ef
2014-05-05 10:55:02 +02:00
wanghong
8619100597 progress flag not supported in v2 API
Currently only download method supports --progress flag in v2 API.
This patch let upload method in v2 API support this flag too.

Change-Id: I1d22379c320adb47a2178697e546413b9257f987
Closes-Bug: #1286265
2014-04-16 06:20:08 +00:00
Jenkins
59c1103655 Merge "Improve help strings" 2014-03-16 17:16:54 +00:00
Andreas Jaeger
2c53246184 Improve help strings
Make help strings consistent to use "." at end of string.

Fix capitalization of API in one help string.

Change-Id: I7cc5289d881c5e58aad9c69b4668584cdeb0b376
2014-02-26 13:57:58 +01:00
Alex Gaynor
d465d60867 Replace file with open, which is Python 3 compatible
Change-Id: I471ae9b372f88a508d4654b1a18c6da90397a828
2014-02-13 06:59:18 -08:00
Edward Hope-Morley
4a41358cea Add support for image size in v2 api upload
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
2014-02-03 11:10:50 +00:00
Yassine Lamgarchal
2c2fdcbb39 Python 3: use six.iteritems() instead of iteritems()
six.iteritems() replaces dictionary.iteritems() on Python 2 and
dictionary.items() on Python 3.

Change-Id: Ie5efa65c0a992e8136087a7b78ab8e8ce967326e
2014-01-09 14:52:19 +01:00
Fei Long Wang
336feeb523 Get better format for long lines with PrettyTable
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
2014-01-06 20:48:54 +08:00
Jenkins
9a649d46ea Merge "Replace OpenStack LLC with OpenStack Foundation" 2013-11-15 06:33:28 +00:00
eddie-sheffield
32d9c42816 Add CLI for V2 image create, update, and upload
Provides command line support for image-create, image-update,
and image-upload using the Glance V2 API. This includes building
help text for create and update based on the image jsonschema
as fetched from the server.

Also fixes bug caused by default warlock patch generation not
matching what Glance expects when updating a core property
which had not originally been set when the image was created.

Related to bp glance-client-v2

Change-Id: I841f9e3d05802f4b794cb6f4849abe03ff0324d9
2013-10-02 13:22:55 -04:00
ZhiQiang Fan
2517203975 Replace OpenStack LLC with OpenStack Foundation
Change-Id: I38dcbcf1a6c8efe540fcf5f29e782cb3826e583d
Fixes-Bug: #1214176
2013-09-20 04:05:51 +08:00
Fei Long Wang
897ae3d795 Enable query image by tag
This patch will enable Glance client to query images by user
defined tags.

Implement bp image-query-by-tag
Implement bp glance-client-v2

Change-Id: I6f54630c5b7c9c567d85485ad4289284e5486814
2013-08-28 14:13:27 +08:00
mouad benchchaoui
1d7da740b2 Show a pretty progressbar when uploading and downloading an image.
Add a new module that contain generic wrapper for file and iterator, which
are used to wrap image to upload and the request body iterator in upload and
download cases repectively, to show and advance a pretty progress bar when this
laters are consumed, The progress bar is triggered by adding a --progress command
line argument to commands: image-create, image-download or image-update.

Change-Id: I2ba42fd0c58f4fa087adb568ec3f08246cae3759
bug fix: LP#1112309
blueprint: progressbar-when-uploading
2013-08-08 15:40:15 +02:00
Jenkins
eb6ed51647 Merge "Expose checksum index image property in client" 2013-07-17 19:00:48 +00:00
amalaba
09b29aac12 Expose checksum index image property in client
Implement checksum image index property in the python-glanceclient

Change-Id: If1426b7938457014ef27a86d3902d53854161627
Implements: blueprint index-using-checksum-image-property
2013-07-12 15:05:26 +05:30
Venkatesh Sampath
b9c1df8dfc Enable client V2 to update/delete tags for a given image.
Added the CLI option image-tag-update to associate a tag to an image via API V2.
Added the CLI option image-tag-delete to delete a tag associated with an image via API V2.

Related to bp glance-client-v2

Change-Id: I76060e1982223770a6c2c0bd9376d568af0df456
2013-07-02 21:32:49 +05:30
Dirk Mueller
62579fbb21 Start using Pyflakes and Hacking
Instead of globally ignoring pyflakes and
hacking warnings, only blacklist those that trigger
very frequently so far, in order to clean them
up in followup commits. Fix and start gating
on the rest already.

Change-Id: Ied7c7250061e3bf379e8286e8ce3b9e4af817faf
2013-06-22 16:00:26 +02:00
iccha-sethi
18795f590a Image Members for glance v2 api
Lists, creates, deletes, updates image members using glance
v2 api.

Related to bp glance-api-v2-image-members

Change-Id: Ic018a265a1676bb0a5638a55e70a527ce6b447fc
2013-05-09 10:54:12 +00:00
Brian Rosmaita
552a68d2bf Implements filters: visibility, owner, member_status.
Includes tests.

Related to bp glance-api-v2-image-members

Change-Id: Ic48f54639fec4dc9b48819a8ffb1f0097001894c
2013-03-08 14:01:34 +00:00
Brian Waldon
8ec7468134 Replace SchemaNotFound with HTTPNotFound
Fixes bug 1131682

Change-Id: I615acbef0411677cae5d30262702babd900c0c81
2013-02-22 10:21:00 -08:00
Anita Kuno
a6ef8ed7da Adds image-delete functionality.
Change-Id: Ic10433f6eb484a4760f3e61f040e903e86b95d91
2013-01-29 15:39:46 +00:00