Mark image form filter out the 'aki' and 'ari' format

AKI and ARI type can not launch instance.
Launch instance filter:
https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/images/utils.py#L78
Image table filter:
https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/images/images/tables.py#L30

So filter out the 'aki' and 'ari' image format for the mark image form.

Change-Id: Ib5f85d4e8bf2ef1a5e6f44802d93b8c096ee5241
Closes-bug: #1594112
This commit is contained in:
zhurong 2016-06-19 08:42:57 -04:00
parent d791127dbd
commit 8c0ce28c35

View File

@ -71,6 +71,10 @@ class MarkImageForm(horizon_forms.SelfHandlingForm):
LOG.error('Failed to request image list from Glance')
exceptions.handle(request, _('Unable to retrieve list of images'))
# filter out the image format aki and ari
images = filter(
lambda x: x.container_format not in ('aki', 'ari'), images)
self.fields['image'].choices = [(i.id, i.name) for i in images]
self.fields['existing_titles'].initial = \
[image.title for image in filter_murano_images(images)]