summaryrefslogtreecommitdiff
path: root/openstackclient/image
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2020-06-23 15:45:47 -0500
committerMonty Taylor <mordred@inaugust.com>2020-06-30 07:02:23 -0500
commitc04ec16cf7ad2dbe7bf8edf5f6e7840c54b0efa3 (patch)
treef0b23d1f69d71653e27cd871c66adcb216455d03 /openstackclient/image
parent8b7a2c8d5931f15b69d1ef6baad994f4b9904579 (diff)
downloadpython-openstackclient-c04ec16cf7ad2dbe7bf8edf5f6e7840c54b0efa3.tar.gz
Expose flag for forcing use of import for images
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
Diffstat (limited to 'openstackclient/image')
-rw-r--r--openstackclient/image/v2/image.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index 53ce560d..b068ddaf 100644
--- a/openstackclient/image/v2/image.py
+++ b/openstackclient/image/v2/image.py
@@ -324,6 +324,14 @@ class CreateImage(command.ShowOne):
metavar="<project>",
help=_("Set an alternate project on this image (name or ID)"),
)
+ parser.add_argument(
+ "--import",
+ dest="use_import",
+ action="store_true",
+ help=_(
+ "Force the use of glance image import instead of"
+ " direct upload")
+ )
common.add_project_domain_option_to_parser(parser)
for deadopt in self.deadopts:
parser.add_argument(
@@ -388,6 +396,9 @@ class CreateImage(command.ShowOne):
parsed_args.project_domain,
).id
+ if parsed_args.use_import:
+ kwargs['use_import'] = True
+
# open the file first to ensure any failures are handled before the
# image is created. Get the file name (if it is file, and not stdin)
# for easier further handling.