Merge "Adding more configuration parameters"
This commit is contained in:
commit
33ff16ec0e
@ -27,8 +27,18 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
VIRT_TYPE_CHOICES = [
|
||||
('kvm', _("Virtualized (kvm)")),
|
||||
('qemu', _("Baremetal (qemu)")),
|
||||
('kvm', _("Baremetal (kvm)")),
|
||||
('qemu', _("Virtualized (qemu)")),
|
||||
]
|
||||
|
||||
NEUTRON_PUBLIC_INTERFACE_CHOICES = [
|
||||
('em2', _("Baremetal (em2)")),
|
||||
('eth0', _("Virtualized (eth0)")),
|
||||
]
|
||||
|
||||
CINDER_ISCSI_HELPER_CHOICES = [
|
||||
('tgtadm', _('tgtadm')),
|
||||
('lioadm', _('lioadm')),
|
||||
]
|
||||
|
||||
|
||||
@ -37,11 +47,33 @@ class EditServiceConfig(horizon.forms.SelfHandlingForm):
|
||||
label=_("Deployment Type"),
|
||||
choices=VIRT_TYPE_CHOICES,
|
||||
required=True,
|
||||
)
|
||||
help_text=_('If you are testing OpenStack in a virtual machine, '
|
||||
'you must configure Compute to use qemu without KVM '
|
||||
'and hardware virtualization.'))
|
||||
neutron_public_interface = django.forms.ChoiceField(
|
||||
label=_("Deployment Type"),
|
||||
choices=NEUTRON_PUBLIC_INTERFACE_CHOICES,
|
||||
required=True,
|
||||
help_text=_('What interface to bridge onto br-ex for network nodes. '
|
||||
'If you are testing OpenStack in a virtual machine'
|
||||
'you must configure interface to eth0.'))
|
||||
snmp_password = django.forms.CharField(
|
||||
label=_("SNMP Password"),
|
||||
required=False,
|
||||
required=True,
|
||||
help_text=_('The user password for SNMPd with readonly '
|
||||
'rights running on all Overcloud nodes'),
|
||||
widget=django.forms.PasswordInput(render_value=True))
|
||||
cloud_name = django.forms.CharField(
|
||||
label=_("Cloud name"),
|
||||
required=True,
|
||||
initial="overcloud",
|
||||
help_text=_('The DNS name of this cloud. '
|
||||
'E.g. ci-overcloud.tripleo.org'))
|
||||
cinder_iscsi_helper = django.forms.ChoiceField(
|
||||
label=_("Cinder ISCSI helper"),
|
||||
choices=CINDER_ISCSI_HELPER_CHOICES,
|
||||
required=True,
|
||||
help_text=_('The iSCSI helper to use with cinder.'))
|
||||
|
||||
@staticmethod
|
||||
def _load_snmp_parameters(plan, data):
|
||||
@ -57,9 +89,27 @@ class EditServiceConfig(horizon.forms.SelfHandlingForm):
|
||||
def handle(self, request, data):
|
||||
plan = api.tuskar.Plan.get_the_plan(self.request)
|
||||
compute_prefix = plan.get_role_by_name('compute').parameter_prefix
|
||||
controller_prefix = plan.get_role_by_name(
|
||||
'controller').parameter_prefix
|
||||
cinder_prefix = plan.get_role_by_name(
|
||||
'cinder-storage').parameter_prefix
|
||||
|
||||
virt_type = data.get('virt_type')
|
||||
neutron_public_interface = data.get('neutron_public_interface')
|
||||
cloud_name = data.get('cloud_name')
|
||||
cinder_iscsi_helper = data.get('cinder_iscsi_helper')
|
||||
|
||||
parameters = {
|
||||
compute_prefix + 'NovaComputeLibvirtType': virt_type,
|
||||
controller_prefix + 'CinderISCSIHelper': cinder_iscsi_helper,
|
||||
cinder_prefix + 'CinderISCSIHelper': cinder_iscsi_helper,
|
||||
controller_prefix + 'CloudName': cloud_name,
|
||||
controller_prefix + 'NeutronPublicInterface':
|
||||
neutron_public_interface,
|
||||
compute_prefix + 'NeutronPublicInterface':
|
||||
neutron_public_interface,
|
||||
cinder_prefix + 'NeutronPublicInterface':
|
||||
neutron_public_interface,
|
||||
}
|
||||
parameters.update(self._load_snmp_parameters(plan, data))
|
||||
|
||||
|
@ -72,6 +72,9 @@ class ParametersTest(test.BaseAdminViewTests):
|
||||
data = {
|
||||
'virt_type': 'qemu',
|
||||
'snmp_password': 'password',
|
||||
'cinder_iscsi_helper': 'lioadm',
|
||||
'cloud_name': 'cloud_name',
|
||||
'neutron_public_interface': 'eth0'
|
||||
}
|
||||
with contextlib.nested(
|
||||
patch('tuskar_ui.api.tuskar.Plan.get_the_plan',
|
||||
@ -86,8 +89,11 @@ class ParametersTest(test.BaseAdminViewTests):
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
plan_patch.assert_called_once_with(ANY, plan.uuid, {
|
||||
'Controller-1::CloudName': u'cloud_name',
|
||||
'Controller-1::SnmpdReadonlyUserPassword': u'password',
|
||||
'Controller-1::NeutronPublicInterface': u'eth0',
|
||||
'Controller-1::CinderISCSIHelper': u'lioadm',
|
||||
'Controller-1::NovaComputeLibvirtType': u'qemu',
|
||||
'Compute-1::SnmpdReadonlyUserPassword': u'password',
|
||||
'Block Storage-1::SnmpdReadonlyUserPassword': u'password',
|
||||
'Object Storage-1::SnmpdReadonlyUserPassword': u'password',
|
||||
'Controller-1::SnmpdReadonlyUserPassword': u'password'})
|
||||
'Object Storage-1::SnmpdReadonlyUserPassword': u'password'})
|
||||
|
@ -29,15 +29,26 @@ class ServiceConfigView(horizon.forms.ModalFormView):
|
||||
def get_initial(self):
|
||||
plan = api.tuskar.Plan.get_the_plan(self.request)
|
||||
compute_prefix = plan.get_role_by_name('compute').parameter_prefix
|
||||
controller_prefix = plan.get_role_by_name(
|
||||
'controller').parameter_prefix
|
||||
|
||||
virt_type = plan.parameter_value(
|
||||
compute_prefix + 'NovaComputeLibvirtType')
|
||||
# TODO(tzumainn): what if compute and control values are different...
|
||||
snmp_password = plan.parameter_value(
|
||||
compute_prefix + 'SnmpdReadonlyUserPassword')
|
||||
controller_prefix + 'SnmpdReadonlyUserPassword')
|
||||
cinder_iscsi_helper = plan.parameter_value(
|
||||
controller_prefix + 'CinderISCSIHelper')
|
||||
cloud_name = plan.parameter_value(
|
||||
controller_prefix + 'CloudName')
|
||||
neutron_public_interface = plan.parameter_value(
|
||||
controller_prefix + 'NeutronPublicInterface')
|
||||
|
||||
return {'virt_type': virt_type,
|
||||
'snmp_password': snmp_password}
|
||||
return {
|
||||
'virt_type': virt_type,
|
||||
'snmp_password': snmp_password,
|
||||
'cinder_iscsi_helper': cinder_iscsi_helper,
|
||||
'cloud_name': cloud_name,
|
||||
'neutron_public_interface': neutron_public_interface}
|
||||
|
||||
|
||||
class IndexView(horizon_tabs.TabbedTableView):
|
||||
|
Loading…
x
Reference in New Issue
Block a user