Remove unnecessary properties from image-meta

This patch removes unnecessary properties such as 'is_public',
'container_format' and 'status' from image-meta in the
image_tranfer.upload_image API. Removing these properties
does not affect backward compatibility.

Change-Id: I9f379f6ada91141da79fd75fbc4a1550a8a06db6
Partial-bug: #1596939
This commit is contained in:
Vipin Balachandran 2016-06-28 18:42:44 +05:30
parent b10c7575a6
commit c202eff4e1
2 changed files with 9 additions and 6 deletions

View File

@ -581,15 +581,17 @@ def upload_image(context, timeout_secs, image_service, image_id, owner_id,
kwargs.get('vmdk_file_path'),
file_size)
# TODO(vbala) Remove this after we delete the keyword argument 'is_public'
# from all client code.
if 'is_public' in kwargs:
LOG.debug("Ignoring keyword argument 'is_public'.")
# Set the image properties. It is important to set the 'size' to 0.
# Otherwise, the image service client will use the VM's disk capacity
# which will not be the image size after upload, since it is converted
# to a stream-optimized sparse disk.
image_metadata = {'disk_format': 'vmdk',
'is_public': kwargs.get('is_public'),
'name': kwargs.get('image_name'),
'status': 'active',
'container_format': 'bare',
'size': 0,
'properties': {'vmware_image_version':
kwargs.get('image_version'),

View File

@ -504,7 +504,11 @@ class ImageTransferUtilityTest(base.TestCase):
host = '127.0.0.1'
port = 443
file_path = '/fake_path'
# TODO(vbala) Remove this after we delete the keyword argument
# 'is_public' from all client code.
is_public = False
image_name = 'fake_image'
image_version = 1
@ -534,10 +538,7 @@ class ImageTransferUtilityTest(base.TestCase):
image_size)
image_metadata = {'disk_format': 'vmdk',
'is_public': is_public,
'name': image_name,
'status': 'active',
'container_format': 'bare',
'size': 0,
'properties': {'vmware_image_version': image_version,
'vmware_disktype': 'streamOptimized',