Copy volume to image by non-admin user fails with ImageNotAuthorized.
This is because we are setting image's is_public meta-data to True
while calling image update (for writing to image). This patch fixes
this by setting is_public using the image-meta passed in by Cinder.
This bug was introduced by commit
960cbb21e359a3526e9ff9bf4ca78db1eca3a743.
Note: The oslo.vmware API which we use for upload requires is_public
meta-data which may not be needed at all for writing to image.
Till we update oslo.vmware API, we have to pass a value for is_public.
Change-Id: Ib7778b6c7a3e8dd501216173a26d7ba246aa85e4
Closes-Bug: #
1437319
image_meta['disk_format'] = 'vmdk'
image_meta['id'] = image_id
image_meta['name'] = image_id
+ image_meta['is_public'] = True
image_service = FakeObject()
vol_name = 'volume-123456789'
project_id = 'project-owner-id-123'
vmdk_size=volume['size'] * units.Gi,
image_name=image_meta['name'],
image_version=1,
- is_public=True)
+ is_public=image_meta['is_public'])
LOG.info(_LI("Done copying volume %(vol)s to a new image %(img)s"),
{'vol': volume['name'], 'img': image_meta['name']})