Fix listing images in Glance V2
The owner argument was not transmitted to glanceclient. Closes-bug: #1708484 Change-Id: If682e33bb20c110d83173a41352e841d39e6cc64
This commit is contained in:
parent
781bfcf056
commit
a565773e88
@ -442,13 +442,13 @@
|
|||||||
concurrency: 5
|
concurrency: 5
|
||||||
context:
|
context:
|
||||||
users:
|
users:
|
||||||
tenants: 1
|
tenants: 2
|
||||||
users_per_tenant: 2
|
users_per_tenant: 1
|
||||||
images:
|
images:
|
||||||
image_url: "~/.rally/extra/fake-image.img"
|
image_url: "~/.rally/extra/fake-image.img"
|
||||||
disk_format: "qcow2"
|
disk_format: "qcow2"
|
||||||
container_format: "bare"
|
container_format: "bare"
|
||||||
images_per_tenant: 1
|
images_per_tenant: 2
|
||||||
sla:
|
sla:
|
||||||
failure_rate:
|
failure_rate:
|
||||||
max: 100
|
max: 100
|
||||||
|
@ -193,6 +193,13 @@ class ImageGenerator(context.Context):
|
|||||||
@logging.log_task_wrapper(LOG.info, _("Exit context: `Images`"))
|
@logging.log_task_wrapper(LOG.info, _("Exit context: `Images`"))
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
if self.context.get("admin", {}):
|
if self.context.get("admin", {}):
|
||||||
|
# NOTE(andreykurilin): Glance does not require the admin for
|
||||||
|
# listing tenant images, but the admin is required for
|
||||||
|
# discovering Cinder volumes which might be created for the
|
||||||
|
# purpose of caching. Removing such volumes are optional step,
|
||||||
|
# since Cinder should have own mechanism like garbage collector,
|
||||||
|
# but if we can, let's remove everything and make the cloud as
|
||||||
|
# close as possible to the original state.
|
||||||
admin = self.context["admin"]
|
admin = self.context["admin"]
|
||||||
admin_required = None
|
admin_required = None
|
||||||
else:
|
else:
|
||||||
|
@ -216,7 +216,8 @@ class UnifiedGlanceV2Service(glance_common.UnifiedGlanceMixin, image.Image):
|
|||||||
"""
|
"""
|
||||||
self._check_v2_visibility(visibility)
|
self._check_v2_visibility(visibility)
|
||||||
|
|
||||||
images = self._impl.list_images(status=status, visibility=visibility)
|
images = self._impl.list_images(
|
||||||
|
status=status, visibility=visibility, owner=owner)
|
||||||
return [self._unify_image(i) for i in images]
|
return [self._unify_image(i) for i in images]
|
||||||
|
|
||||||
def set_visibility(self, image_id, visibility="shared"):
|
def set_visibility(self, image_id, visibility="shared"):
|
||||||
|
@ -199,10 +199,13 @@ class UnifiedGlanceV2ServiceTestCase(test.TestCase):
|
|||||||
|
|
||||||
status = "active"
|
status = "active"
|
||||||
self.assertEqual([mock_image__unify_image.return_value],
|
self.assertEqual([mock_image__unify_image.return_value],
|
||||||
self.service.list_images())
|
self.service.list_images(owner="foo",
|
||||||
|
visibility="shared"))
|
||||||
self.service._impl.list_images.assert_called_once_with(
|
self.service._impl.list_images.assert_called_once_with(
|
||||||
status=status,
|
status=status,
|
||||||
visibility=None)
|
visibility="shared",
|
||||||
|
owner="foo"
|
||||||
|
)
|
||||||
|
|
||||||
def test_set_visibility(self):
|
def test_set_visibility(self):
|
||||||
image_id = "image_id"
|
image_id = "image_id"
|
||||||
|
Loading…
Reference in New Issue
Block a user