Merge "Makes Launch Instance only show images that are "active" Fixes launchpad Bug #1040231"
This commit is contained in:
commit
be20419d77
@ -600,10 +600,12 @@ class InstanceTests(test.TestCase):
|
||||
api.nova.volume_snapshot_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.volumes.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True}) \
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id}) \
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id) \
|
||||
@ -668,10 +670,12 @@ class InstanceTests(test.TestCase):
|
||||
api.nova.security_group_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.security_groups.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True}) \
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id}) \
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id) \
|
||||
@ -735,10 +739,12 @@ class InstanceTests(test.TestCase):
|
||||
.AndReturn(self.flavors.list())
|
||||
api.nova.tenant_quota_usages(IsA(http.HttpRequest)).AndReturn({})
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True}) \
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id}) \
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id) \
|
||||
@ -791,10 +797,12 @@ class InstanceTests(test.TestCase):
|
||||
api.nova.volume_snapshot_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.volumes.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True}) \
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id}) \
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id) \
|
||||
@ -842,10 +850,12 @@ class InstanceTests(test.TestCase):
|
||||
api.nova.security_group_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.security_groups.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True}) \
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id}) \
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id) \
|
||||
@ -908,10 +918,12 @@ class InstanceTests(test.TestCase):
|
||||
api.nova.security_group_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.security_groups.list())
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True}) \
|
||||
filters={'is_public': True,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'property-owner_id': self.tenant.id}) \
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id) \
|
||||
|
@ -217,7 +217,8 @@ class SetInstanceDetailsAction(workflows.Action):
|
||||
def _get_available_images(self, request, context):
|
||||
project_id = context.get('project_id', None)
|
||||
if not hasattr(self, "_public_images"):
|
||||
public = {"is_public": True}
|
||||
public = {"is_public": True,
|
||||
"status": "active"}
|
||||
try:
|
||||
public_images, _more = api.glance.image_list_detailed(request,
|
||||
filters=public)
|
||||
@ -232,7 +233,8 @@ class SetInstanceDetailsAction(workflows.Action):
|
||||
setattr(self, "_images_for_%s" % project_id, [])
|
||||
|
||||
if not hasattr(self, "_images_for_%s" % project_id):
|
||||
owner = {"property-owner_id": project_id}
|
||||
owner = {"property-owner_id": project_id,
|
||||
"status": "active"}
|
||||
try:
|
||||
owned_images, _more = api.glance.image_list_detailed(request,
|
||||
filters=owner)
|
||||
@ -245,7 +247,7 @@ class SetInstanceDetailsAction(workflows.Action):
|
||||
owned_images = getattr(self, "_images_for_%s" % project_id)
|
||||
images = owned_images + self._public_images
|
||||
|
||||
# Remove duplicate images.
|
||||
# Remove duplicate images
|
||||
image_ids = []
|
||||
final_images = []
|
||||
for image in images:
|
||||
|
Loading…
Reference in New Issue
Block a user