diff options
| author | M V P Nitesh <m.nitesh@nectechnologies.in> | 2017-06-30 14:13:02 +0530 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2017-06-30 20:35:01 +0000 |
| commit | 3468ea1ca429e8b6403ae5f989cfed521d8f5690 (patch) | |
| tree | dbc043fdece6993bca5bd4c5d8e38508bc49fbd5 | |
| parent | 22bed5d1f0594ed297a03a845e08216ff975165d (diff) | |
| download | python-openstackclient-3468ea1ca429e8b6403ae5f989cfed521d8f5690.tar.gz | |
Added 'openstack image set --visibility'
This feature will allow image owners to share images across multiple
tenants/projects without explicitly creating members individually
through the glance API V2. “Community images” will not appear iu
user's default image listings
Change-Id: Ic02bf44cca5d6d793d68a8737d3cfe3f44407d88
Closes-Bug: #1626837
| -rw-r--r-- | doc/source/cli/command-objects/image.rst | 20 | ||||
| -rw-r--r-- | openstackclient/image/v2/image.py | 34 | ||||
| -rw-r--r-- | releasenotes/notes/image_set_visibility-babf4ff2f687d465.yaml | 7 |
3 files changed, 55 insertions, 6 deletions
diff --git a/doc/source/cli/command-objects/image.rst b/doc/source/cli/command-objects/image.rst index ec51fa93..2918452b 100644 --- a/doc/source/cli/command-objects/image.rst +++ b/doc/source/cli/command-objects/image.rst @@ -57,7 +57,7 @@ Create/upload an image [--force] [--checksum <checksum>] [--protected | --unprotected] - [--public | --private] + [--public | --private | --community | --shared] [--property <key=value> [...] ] [--tag <tag> [...] ] [--project <project> [--project-domain <project-domain>]] @@ -143,6 +143,14 @@ Create/upload an image Image is inaccessible to the public (default) +.. option:: --community + + Image is accessible to the community + +.. option:: --shared + + Image can be shared + .. option:: --property <key=value> Set a property on this image (repeat for multiple values) @@ -310,7 +318,7 @@ Set image properties [--disk-format <disk-format>] [--size <size>] [--protected | --unprotected] - [--public | --private] + [--public | --private | --community | --shared] [--store <store>] [--location <image-url>] [--copy-from <image-url>] @@ -376,6 +384,14 @@ Set image properties Image is inaccessible to the public (default) +.. option:: --community + + Image is accessible to the community + +.. option:: --shared + + Image can be shared + .. option:: --store <store> Upload image to this store diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py index ad21cbd7..2b171410 100644 --- a/openstackclient/image/v2/image.py +++ b/openstackclient/image/v2/image.py @@ -205,6 +205,16 @@ class CreateImage(command.ShowOne): action="store_true", help=_("Image is inaccessible to the public (default)"), ) + public_group.add_argument( + "--community", + action="store_true", + help=_("Image is accessible to the community"), + ) + public_group.add_argument( + "--shared", + action="store_true", + help=_("Image can be shared"), + ) parser.add_argument( "--property", dest="properties", @@ -260,7 +270,7 @@ class CreateImage(command.ShowOne): kwargs = {} copy_attrs = ('name', 'id', 'container_format', 'disk_format', - 'min_disk', 'min_ram', 'tags') + 'min_disk', 'min_ram', 'tags', 'visibility') for attr in copy_attrs: if attr in parsed_args: val = getattr(parsed_args, attr, None) @@ -288,7 +298,10 @@ class CreateImage(command.ShowOne): kwargs['visibility'] = 'public' if parsed_args.private: kwargs['visibility'] = 'private' - + if parsed_args.community: + kwargs['visibility'] = 'community' + if parsed_args.shared: + kwargs['visibility'] = 'shared' # Handle deprecated --owner option project_arg = parsed_args.project if parsed_args.owner: @@ -698,6 +711,16 @@ class SetImage(command.Command): action="store_true", help=_("Image is inaccessible to the public (default)"), ) + public_group.add_argument( + "--community", + action="store_true", + help=_("Image is accessible to the community"), + ) + public_group.add_argument( + "--shared", + action="store_true", + help=_("Image can be shared"), + ) parser.add_argument( "--property", dest="properties", @@ -817,7 +840,7 @@ class SetImage(command.Command): copy_attrs = ('architecture', 'container_format', 'disk_format', 'file', 'instance_id', 'kernel_id', 'locations', 'min_disk', 'min_ram', 'name', 'os_distro', 'os_version', - 'prefix', 'progress', 'ramdisk_id', 'tags') + 'prefix', 'progress', 'ramdisk_id', 'tags', 'visibility') for attr in copy_attrs: if attr in parsed_args: val = getattr(parsed_args, attr, None) @@ -845,7 +868,10 @@ class SetImage(command.Command): kwargs['visibility'] = 'public' if parsed_args.private: kwargs['visibility'] = 'private' - + if parsed_args.community: + kwargs['visibility'] = 'community' + if parsed_args.shared: + kwargs['visibility'] = 'shared' # Handle deprecated --owner option project_arg = parsed_args.project if parsed_args.owner: diff --git a/releasenotes/notes/image_set_visibility-babf4ff2f687d465.yaml b/releasenotes/notes/image_set_visibility-babf4ff2f687d465.yaml new file mode 100644 index 00000000..c521ac18 --- /dev/null +++ b/releasenotes/notes/image_set_visibility-babf4ff2f687d465.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - Add ``--community`` and ``--shared`` options to the ``image create`` and + ``image set`` commands to allow image owners to share images across + multiple projects without explicitly creating image members. + “Community images” will not appear in user’s default + image listings. |
