Make Image Service image formats configurable
Allow configuration of the available image formats for image creation (corresponds to a feature added Glance). Incidentally fixes a test issue where the domain_get call wasn't being properly stubbed out. Fixes bug 1216157 Change-Id: Ifc72915d34767ce83f9d85b92ddeae0c2c00b8c6
This commit is contained in:
parent
57a8af95af
commit
47757ada08
@ -189,7 +189,8 @@ class CreateProjectWorkflowTests(test.BaseAdminViewTests):
|
|||||||
@test.create_stubs({api.keystone: ('get_default_role',
|
@test.create_stubs({api.keystone: ('get_default_role',
|
||||||
'user_list',
|
'user_list',
|
||||||
'group_list',
|
'group_list',
|
||||||
'role_list'),
|
'role_list',
|
||||||
|
'domain_get'),
|
||||||
api.neutron: ('is_extension_supported',
|
api.neutron: ('is_extension_supported',
|
||||||
'tenant_quota_get'),
|
'tenant_quota_get'),
|
||||||
quotas: ('get_default_quota_data',)})
|
quotas: ('get_default_quota_data',)})
|
||||||
@ -237,7 +238,8 @@ class CreateProjectWorkflowTests(test.BaseAdminViewTests):
|
|||||||
'tenant_create',
|
'tenant_create',
|
||||||
'user_list',
|
'user_list',
|
||||||
'group_list',
|
'group_list',
|
||||||
'role_list'),
|
'role_list',
|
||||||
|
'domain_get'),
|
||||||
quotas: ('get_default_quota_data',),
|
quotas: ('get_default_quota_data',),
|
||||||
api.cinder: ('tenant_quota_update',),
|
api.cinder: ('tenant_quota_update',),
|
||||||
api.nova: ('tenant_quota_update',)})
|
api.nova: ('tenant_quota_update',)})
|
||||||
|
@ -36,6 +36,10 @@ from horizon import messages
|
|||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
|
|
||||||
|
|
||||||
|
IMAGE_BACKEND_SETTINGS = getattr(settings, 'OPENSTACK_IMAGE_BACKEND', {})
|
||||||
|
IMAGE_FORMAT_CHOICES = IMAGE_BACKEND_SETTINGS.get('image_formats', [])
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -71,24 +75,7 @@ class CreateImageForm(forms.SelfHandlingForm):
|
|||||||
required=False)
|
required=False)
|
||||||
disk_format = forms.ChoiceField(label=_('Format'),
|
disk_format = forms.ChoiceField(label=_('Format'),
|
||||||
required=True,
|
required=True,
|
||||||
choices=[('', ''),
|
choices=[],
|
||||||
('aki',
|
|
||||||
_('AKI - Amazon Kernel '
|
|
||||||
'Image')),
|
|
||||||
('ami',
|
|
||||||
_('AMI - Amazon Machine '
|
|
||||||
'Image')),
|
|
||||||
('ari',
|
|
||||||
_('ARI - Amazon Ramdisk '
|
|
||||||
'Image')),
|
|
||||||
('iso',
|
|
||||||
_('ISO - Optical Disk Image')),
|
|
||||||
('qcow2',
|
|
||||||
_('QCOW2 - QEMU Emulator')),
|
|
||||||
('raw', 'Raw'),
|
|
||||||
('vdi', 'VDI'),
|
|
||||||
('vhd', 'VHD'),
|
|
||||||
('vmdk', 'VMDK')],
|
|
||||||
widget=forms.Select(attrs={'class':
|
widget=forms.Select(attrs={'class':
|
||||||
'switchable'}))
|
'switchable'}))
|
||||||
minimum_disk = forms.IntegerField(label=_("Minimum Disk (GB)"),
|
minimum_disk = forms.IntegerField(label=_("Minimum Disk (GB)"),
|
||||||
@ -112,6 +99,7 @@ class CreateImageForm(forms.SelfHandlingForm):
|
|||||||
super(CreateImageForm, self).__init__(*args, **kwargs)
|
super(CreateImageForm, self).__init__(*args, **kwargs)
|
||||||
if not settings.HORIZON_IMAGES_ALLOW_UPLOAD:
|
if not settings.HORIZON_IMAGES_ALLOW_UPLOAD:
|
||||||
self.fields['image_file'].widget = HiddenInput()
|
self.fields['image_file'].widget = HiddenInput()
|
||||||
|
self.fields['disk_format'].choices = IMAGE_FORMAT_CHOICES
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
data = super(CreateImageForm, self).clean()
|
data = super(CreateImageForm, self).clean()
|
||||||
|
@ -159,6 +159,24 @@ OPENSTACK_NEUTRON_NETWORK = {
|
|||||||
'enable_security_group': True,
|
'enable_security_group': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The OPENSTACK_IMAGE_BACKEND settings can be used to customize features
|
||||||
|
# in the OpenStack Dashboard related to the Image service, such as the list
|
||||||
|
# of supported image formats.
|
||||||
|
OPENSTACK_IMAGE_BACKEND = {
|
||||||
|
'image_formats': [
|
||||||
|
('', ''),
|
||||||
|
('aki', _('AKI - Amazon Kernel Image')),
|
||||||
|
('ami', _('AMI - Amazon Machine Image')),
|
||||||
|
('ari', _('ARI - Amazon Ramdisk Image')),
|
||||||
|
('iso', _('ISO - Optical Disk Image')),
|
||||||
|
('qcow2', _('QCOW2 - QEMU Emulator')),
|
||||||
|
('raw', _('Raw')),
|
||||||
|
('vdi', _('VDI')),
|
||||||
|
('vhd', _('VHD')),
|
||||||
|
('vmdk', _('VMDK'))
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
# OPENSTACK_ENDPOINT_TYPE specifies the endpoint type to use for the endpoints
|
# OPENSTACK_ENDPOINT_TYPE specifies the endpoint type to use for the endpoints
|
||||||
# in the Keystone service catalog. Use this setting when Horizon is running
|
# in the Keystone service catalog. Use this setting when Horizon is running
|
||||||
# external to the OpenStack environment. The default is 'publicURL'.
|
# external to the OpenStack environment. The default is 'publicURL'.
|
||||||
|
@ -91,6 +91,21 @@ OPENSTACK_HYPERVISOR_FEATURES = {
|
|||||||
'can_set_mount_point': True,
|
'can_set_mount_point': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OPENSTACK_IMAGE_BACKEND = {
|
||||||
|
'image_formats': [
|
||||||
|
('', ''),
|
||||||
|
('aki', _('AKI - Amazon Kernel Image')),
|
||||||
|
('ami', _('AMI - Amazon Machine Image')),
|
||||||
|
('ari', _('ARI - Amazon Ramdisk Image')),
|
||||||
|
('iso', _('ISO - Optical Disk Image')),
|
||||||
|
('qcow2', _('QCOW2 - QEMU Emulator')),
|
||||||
|
('raw', _('Raw')),
|
||||||
|
('vdi', _('VDI')),
|
||||||
|
('vhd', _('VHD')),
|
||||||
|
('vmdk', _('VMDK'))
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
LOGGING['loggers']['openstack_dashboard'] = {
|
LOGGING['loggers']['openstack_dashboard'] = {
|
||||||
'handlers': ['test'],
|
'handlers': ['test'],
|
||||||
'propagate': False,
|
'propagate': False,
|
||||||
|
@ -6,7 +6,7 @@ set -o errexit
|
|||||||
# Increment me any time the environment should be rebuilt.
|
# Increment me any time the environment should be rebuilt.
|
||||||
# This includes dependncy changes, directory renames, etc.
|
# This includes dependncy changes, directory renames, etc.
|
||||||
# Simple integer secuence: 1, 2, 3...
|
# Simple integer secuence: 1, 2, 3...
|
||||||
environment_version=39
|
environment_version=40
|
||||||
#--------------------------------------------------------#
|
#--------------------------------------------------------#
|
||||||
|
|
||||||
function usage {
|
function usage {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user