diff --git a/doc/source/topics/settings.rst b/doc/source/topics/settings.rst
index e598a3046..163696946 100644
--- a/doc/source/topics/settings.rst
+++ b/doc/source/topics/settings.rst
@@ -1196,7 +1196,6 @@ Default::
'enable_router': True,
'enable_distributed_router': False,
'enable_ha_router': False,
- 'enable_lb': True,
'enable_quotas': False,
'enable_firewall': True,
'enable_vpn': True,
@@ -1253,24 +1252,6 @@ Even when your Neutron plugin (like ML2 plugin) supports HA router mode,
the feature depends on l3-agent configuration, so deployers should set this
option appropriately depending on your deployment.
-``enable_lb``
-~~~~~~~~~~~~~
-
-.. versionadded:: 2013.1(Grizzly)
-
-(Deprecated)
-
-Default: ``True``
-
-Enables the load balancer panel. The load balancer panel will be enabled when
-this option is True and your Neutron deployment supports LBaaS. If you want
-to disable load balancer panel even when your Neutron supports LBaaS, set it to False.
-
-This option is now marked as "deprecated" and will be removed in Kilo or later release.
-The load balancer panel is now enabled only when LBaaS feature is available in Neutron
-and this option is no longer needed. We suggest not to use this option to disable the
-load balancer panel from now on.
-
``enable_quotas``
~~~~~~~~~~~~~~~~~
diff --git a/openstack_dashboard/api/__init__.py b/openstack_dashboard/api/__init__.py
index 0f9df35ff..4f510ff68 100644
--- a/openstack_dashboard/api/__init__.py
+++ b/openstack_dashboard/api/__init__.py
@@ -38,7 +38,6 @@ from openstack_dashboard.api import fwaas
from openstack_dashboard.api import glance
from openstack_dashboard.api import heat
from openstack_dashboard.api import keystone
-from openstack_dashboard.api import lbaas
from openstack_dashboard.api import network
from openstack_dashboard.api import neutron
from openstack_dashboard.api import nova
@@ -53,7 +52,6 @@ __all__ = [
"glance",
"heat",
"keystone",
- "lbaas",
"network",
"neutron",
"nova",
diff --git a/openstack_dashboard/api/lbaas.py b/openstack_dashboard/api/lbaas.py
deleted file mode 100644
index 5817e3d9e..000000000
--- a/openstack_dashboard/api/lbaas.py
+++ /dev/null
@@ -1,394 +0,0 @@
-# Copyright 2013, Big Switch Networks, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from __future__ import absolute_import
-
-from collections import OrderedDict
-from django.utils.translation import ugettext_lazy as _
-
-from horizon import messages
-
-from openstack_dashboard.api import neutron
-
-neutronclient = neutron.neutronclient
-
-
-class Vip(neutron.NeutronAPIDictWrapper):
- """Wrapper for neutron load balancer vip."""
-
- def __init__(self, apiresource):
- super(Vip, self).__init__(apiresource)
-
-
-class Pool(neutron.NeutronAPIDictWrapper):
- """Wrapper for neutron load balancer pool."""
-
- def __init__(self, apiresource):
- if 'provider' not in apiresource:
- apiresource['provider'] = None
- apiresource['admin_state'] = \
- 'UP' if apiresource['admin_state_up'] else 'DOWN'
- super(Pool, self).__init__(apiresource)
-
-
-class Member(neutron.NeutronAPIDictWrapper):
- """Wrapper for neutron load balancer member."""
-
- def __init__(self, apiresource):
- apiresource['admin_state'] = \
- 'UP' if apiresource['admin_state_up'] else 'DOWN'
- super(Member, self).__init__(apiresource)
-
-
-class PoolStats(neutron.NeutronAPIDictWrapper):
- """Wrapper for neutron load balancer pool stats."""
-
- def __init__(self, apiresource):
- super(PoolStats, self).__init__(apiresource)
-
-
-class PoolMonitor(neutron.NeutronAPIDictWrapper):
- """Wrapper for neutron load balancer pool health monitor."""
-
- def __init__(self, apiresource):
- apiresource['admin_state'] = \
- 'UP' if apiresource['admin_state_up'] else 'DOWN'
- super(PoolMonitor, self).__init__(apiresource)
-
-
-def vip_create(request, **kwargs):
- """Create a vip for a specified pool.
-
- :param request: request context
- :param address: virtual IP address
- :param name: name for vip
- :param description: description for vip
- :param subnet_id: subnet_id for subnet of vip
- :param protocol_port: transport layer port number for vip
- :returns: Vip object
- """
- body = {'vip': {'name': kwargs['name'],
- 'description': kwargs['description'],
- 'subnet_id': kwargs['subnet_id'],
- 'protocol_port': kwargs['protocol_port'],
- 'protocol': kwargs['protocol'],
- 'pool_id': kwargs['pool_id'],
- 'session_persistence': kwargs['session_persistence'],
- 'admin_state_up': kwargs['admin_state_up']
- }}
- if kwargs.get('connection_limit'):
- body['vip']['connection_limit'] = kwargs['connection_limit']
-
- if kwargs.get('address'):
- body['vip']['address'] = kwargs['address']
-
- vip = neutronclient(request).create_vip(body).get('vip')
- return Vip(vip)
-
-
-def vip_list(request, **kwargs):
- vips = neutronclient(request).list_vips(**kwargs).get('vips')
- return [Vip(v) for v in vips]
-
-
-def vip_get(request, vip_id):
- return _vip_get(request, vip_id, expand_resource=True)
-
-
-def _vip_get(request, vip_id, expand_resource=False):
- vip = neutronclient(request).show_vip(vip_id).get('vip')
- if expand_resource:
- vip['subnet'] = neutron.subnet_get(request, vip['subnet_id'])
- vip['port'] = neutron.port_get(request, vip['port_id'])
- vip['pool'] = _pool_get(request, vip['pool_id'])
- return Vip(vip)
-
-
-def vip_update(request, vip_id, **kwargs):
- vip = neutronclient(request).update_vip(vip_id, kwargs).get('vip')
- return Vip(vip)
-
-
-def vip_delete(request, vip_id):
- neutronclient(request).delete_vip(vip_id)
-
-
-def pool_create(request, **kwargs):
- """Create a pool for specified protocol
-
- :param request: request context
- :param name: name for pool
- :param description: description for pool
- :param subnet_id: subnet_id for subnet of pool
- :param protocol: load balanced protocol
- :param lb_method: load balancer method
- :param admin_state_up: admin state (default on)
- """
- body = {'pool': {'name': kwargs['name'],
- 'description': kwargs['description'],
- 'subnet_id': kwargs['subnet_id'],
- 'protocol': kwargs['protocol'],
- 'lb_method': kwargs['lb_method'],
- 'admin_state_up': kwargs['admin_state_up'],
- 'provider': kwargs['provider'],
- }}
- pool = neutronclient(request).create_pool(body).get('pool')
- return Pool(pool)
-
-
-def _get_vip(request, pool, vip_dict):
- if pool['vip_id'] is not None:
- try:
- if vip_dict:
- vip = vip_dict.get(pool['vip_id'])
- else:
- vip = _vip_get(request, pool['vip_id'])
- except Exception:
- messages.warning(request, _("Unable to get VIP for pool "
- "%(pool)s.") % {"pool": pool["id"]})
- vip = Vip({'id': pool['vip_id'], 'name': ''})
- return vip
- else:
- return None
-
-
-def pool_list(request, **kwargs):
- return _pool_list(request, expand_subnet=True, expand_vip=True, **kwargs)
-
-
-def _pool_list(request, expand_subnet=False, expand_vip=False, **kwargs):
- pools = neutronclient(request).list_pools(**kwargs).get('pools')
- if expand_subnet:
- subnets = neutron.subnet_list(request)
- subnet_dict = OrderedDict((s.id, s) for s in subnets)
- for p in pools:
- p['subnet'] = subnet_dict.get(p['subnet_id'])
- if expand_vip:
- vips = vip_list(request)
- vip_dict = OrderedDict((v.id, v) for v in vips)
- for p in pools:
- p['vip'] = _get_vip(request, p, vip_dict)
- return [Pool(p) for p in pools]
-
-
-def pool_get(request, pool_id):
- return _pool_get(request, pool_id, expand_resource=True)
-
-
-def _pool_get(request, pool_id, expand_resource=False):
- try:
- pool = neutronclient(request).show_pool(pool_id).get('pool')
- except Exception:
- messages.warning(request, _("Unable to get pool detail."))
- return None
- if expand_resource:
- # TODO(lyj): The expand resource(subnet, member etc.) attached
- # to a pool could be deleted without cleanup pool related database,
- # this will cause exceptions if we trying to get the deleted resources.
- # so we need to handle the situation by showing a warning message here.
- # we can safely remove the try/except once the neutron bug is fixed
- # https://bugs.launchpad.net/neutron/+bug/1406854
- try:
- pool['subnet'] = neutron.subnet_get(request, pool['subnet_id'])
- except Exception:
- messages.warning(request, _("Unable to get subnet for pool "
- "%(pool)s.") % {"pool": pool_id})
- pool['vip'] = _get_vip(request, pool, vip_dict=None)
- # Check here to reduce the additional request if pool['members'] is
- # empty
- if pool['members']:
- try:
- pool['members'] = _member_list(request, expand_pool=False,
- pool_id=pool_id)
- except Exception:
- messages.warning(request, _("Unable to get members for pool "
- "%(pool)s.") % {"pool": pool_id})
- # If the filter to get health monitors list is empty, all health
- # monitors will be returned in the tenant.
- if pool['health_monitors']:
- monitors = []
- for monitor_id in pool['health_monitors']:
- try:
- monitors.append(_pool_health_monitor_get(request,
- monitor_id,
- False))
- except Exception:
- messages.warning(request,
- _("Unable to get health monitor "
- "%(monitor_id)s for pool %(pool)s.")
- % {"pool": pool_id,
- "monitor_id": monitor_id})
- pool['health_monitors'] = monitors
- return Pool(pool)
-
-
-def pool_update(request, pool_id, **kwargs):
- pool = neutronclient(request).update_pool(pool_id, kwargs).get('pool')
- return Pool(pool)
-
-
-def pool_delete(request, pool):
- neutronclient(request).delete_pool(pool)
-
-
-# not linked to UI yet
-def pool_stats(request, pool_id, **kwargs):
- stats = neutronclient(request).retrieve_pool_stats(pool_id, **kwargs)
- return PoolStats(stats)
-
-
-def pool_health_monitor_create(request, **kwargs):
- """Create a health monitor
-
- :param request: request context
- :param type: type of monitor
- :param delay: delay of monitor
- :param timeout: timeout of monitor
- :param max_retries: max retries [1..10]
- :param http_method: http method
- :param url_path: url path
- :param expected_codes: http return code
- :param admin_state_up: admin state
- """
- monitor_type = kwargs['type'].upper()
- body = {'health_monitor': {'type': monitor_type,
- 'delay': kwargs['delay'],
- 'timeout': kwargs['timeout'],
- 'max_retries': kwargs['max_retries'],
- 'admin_state_up': kwargs['admin_state_up']
- }}
- if monitor_type in ['HTTP', 'HTTPS']:
- body['health_monitor']['http_method'] = kwargs['http_method']
- body['health_monitor']['url_path'] = kwargs['url_path']
- body['health_monitor']['expected_codes'] = kwargs['expected_codes']
- mon = neutronclient(request).create_health_monitor(body).get(
- 'health_monitor')
-
- return PoolMonitor(mon)
-
-
-def pool_health_monitor_list(request, **kwargs):
- monitors = neutronclient(request).list_health_monitors(
- **kwargs).get('health_monitors')
- return [PoolMonitor(m) for m in monitors]
-
-
-def pool_health_monitor_get(request, monitor_id):
- return _pool_health_monitor_get(request, monitor_id, expand_resource=True)
-
-
-def _pool_health_monitor_get(request, monitor_id, expand_resource=False):
- monitor = neutronclient(request
- ).show_health_monitor(monitor_id
- ).get('health_monitor')
- if expand_resource:
- pool_ids = [p['pool_id'] for p in monitor['pools']]
- # If the filter to get pools list is empty, all pools will be
- # returned in the tenant.
- if pool_ids:
- monitor['pools'] = _pool_list(request, id=pool_ids)
- return PoolMonitor(monitor)
-
-
-def pool_health_monitor_update(request, monitor_id, **kwargs):
- monitor = neutronclient(request
- ).update_health_monitor(monitor_id, kwargs
- ).get('health_monitor')
- return PoolMonitor(monitor)
-
-
-def pool_health_monitor_delete(request, mon_id):
- neutronclient(request).delete_health_monitor(mon_id)
-
-
-def member_create(request, **kwargs):
- """Create a load balance member
-
- :param request: request context
- :param pool_id: pool_id of pool for member
- :param address: IP address
- :param protocol_port: transport layer port number
- :param weight: weight for member
- :param admin_state_up: admin_state
- """
- body = {'member': {'pool_id': kwargs['pool_id'],
- 'address': kwargs['address'],
- 'protocol_port': kwargs['protocol_port'],
- 'admin_state_up': kwargs['admin_state_up']
- }}
- if kwargs.get('weight'):
- body['member']['weight'] = kwargs['weight']
- member = neutronclient(request).create_member(body).get('member')
- return Member(member)
-
-
-def member_list(request, **kwargs):
- return _member_list(request, expand_pool=True, **kwargs)
-
-
-def _member_list(request, expand_pool, **kwargs):
- members = neutronclient(request).list_members(**kwargs).get('members')
- if expand_pool:
- pools = _pool_list(request)
- pool_dict = OrderedDict((p.id, p) for p in pools)
- for m in members:
- m['pool_name'] = pool_dict.get(m['pool_id']).name_or_id
- return [Member(m) for m in members]
-
-
-def member_get(request, member_id):
- return _member_get(request, member_id, expand_pool=True)
-
-
-def _member_get(request, member_id, expand_pool):
- member = neutronclient(request).show_member(member_id).get('member')
- if expand_pool:
- member['pool'] = _pool_get(request, member['pool_id'])
- return Member(member)
-
-
-def member_update(request, member_id, **kwargs):
- member = neutronclient(request).update_member(member_id, kwargs
- ).get('member')
- return Member(member)
-
-
-def member_delete(request, mem_id):
- neutronclient(request).delete_member(mem_id)
-
-
-def pool_monitor_association_create(request, **kwargs):
- """Associate a health monitor with pool
-
- :param request: request context
- :param monitor_id: id of monitor
- :param pool_id: id of pool
- """
-
- body = {'health_monitor': {'id': kwargs['monitor_id'], }}
-
- neutronclient(request).associate_health_monitor(
- kwargs['pool_id'], body)
-
-
-def pool_monitor_association_delete(request, **kwargs):
- """Disassociate a health monitor from pool
-
- :param request: request context
- :param monitor_id: id of monitor
- :param pool_id: id of pool
- """
-
- neutronclient(request).disassociate_health_monitor(
- kwargs['pool_id'], kwargs['monitor_id'])
diff --git a/openstack_dashboard/api/neutron.py b/openstack_dashboard/api/neutron.py
index ac1f56f3d..f74df6806 100644
--- a/openstack_dashboard/api/neutron.py
+++ b/openstack_dashboard/api/neutron.py
@@ -476,14 +476,6 @@ class FloatingIpManager(network_base.FloatingIpManager):
server_dict = collections.OrderedDict(
[(s.id, s.name) for s in servers])
reachable_subnets = self._get_reachable_subnets(ports)
- if is_service_enabled(self.request,
- config_name='enable_lb',
- ext_name='lbaas'):
- # Also get the loadbalancer VIPs
- vip_dict = {v['port_id']: v['name']
- for v in self.client.list_vips().get('vips', [])}
- else:
- vip_dict = {}
targets = []
for p in ports:
@@ -491,7 +483,7 @@ class FloatingIpManager(network_base.FloatingIpManager):
if p.device_owner.startswith('network:'):
continue
port_id = p.id
- server_name = server_dict.get(p.device_id) or vip_dict.get(port_id)
+ server_name = server_dict.get(p.device_id)
for ip in p.fixed_ips:
if ip['subnet_id'] not in reachable_subnets:
diff --git a/openstack_dashboard/dashboards/project/loadbalancers/__init__.py b/openstack_dashboard/dashboards/project/loadbalancers/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/openstack_dashboard/dashboards/project/loadbalancers/forms.py b/openstack_dashboard/dashboards/project/loadbalancers/forms.py
deleted file mode 100644
index a9d8fb432..000000000
--- a/openstack_dashboard/dashboards/project/loadbalancers/forms.py
+++ /dev/null
@@ -1,281 +0,0 @@
-# Copyright 2013, Mirantis Inc
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import logging
-
-from django.core.urlresolvers import reverse
-from django.utils.translation import ugettext_lazy as _
-
-from horizon import exceptions
-from horizon import forms
-from horizon import messages
-
-from openstack_dashboard import api
-
-
-LOG = logging.getLogger(__name__)
-
-
-class UpdatePool(forms.SelfHandlingForm):
- name = forms.CharField(max_length=80, label=_("Name"))
- pool_id = forms.CharField(label=_("ID"),
- widget=forms.TextInput(
- attrs={'readonly': 'readonly'}))
- description = forms.CharField(required=False,
- max_length=80, label=_("Description"))
- lb_method = forms.ThemableChoiceField(label=_("Load Balancing Method"))
- admin_state_up = forms.ThemableChoiceField(
- choices=[(True, _('UP')),
- (False, _('DOWN'))],
- label=_("Admin State"))
-
- failure_url = 'horizon:project:loadbalancers:index'
-
- def __init__(self, request, *args, **kwargs):
- super(UpdatePool, self).__init__(request, *args, **kwargs)
-
- lb_method_choices = [('ROUND_ROBIN', 'ROUND_ROBIN'),
- ('LEAST_CONNECTIONS', 'LEAST_CONNECTIONS'),
- ('SOURCE_IP', 'SOURCE_IP')]
- self.fields['lb_method'].choices = lb_method_choices
-
- def handle(self, request, context):
- context['admin_state_up'] = (context['admin_state_up'] == 'True')
- try:
- data = {'pool': {'name': context['name'],
- 'description': context['description'],
- 'lb_method': context['lb_method'],
- 'admin_state_up': context['admin_state_up'],
- }}
- pool = api.lbaas.pool_update(request, context['pool_id'], **data)
- msg = _('Pool %s was successfully updated.') % context['name']
- LOG.debug(msg)
- messages.success(request, msg)
- return pool
- except Exception:
- msg = _('Failed to update pool %s') % context['name']
- LOG.info(msg)
- redirect = reverse(self.failure_url)
- exceptions.handle(request, msg, redirect=redirect)
-
-
-class UpdateVip(forms.SelfHandlingForm):
- name = forms.CharField(max_length=80, label=_("Name"))
- vip_id = forms.CharField(label=_("ID"),
- widget=forms.TextInput(
- attrs={'readonly': 'readonly'}))
- description = forms.CharField(required=False,
- max_length=80, label=_("Description"))
- pool_id = forms.ThemableChoiceField(label=_("Pool"))
- session_persistence = forms.ThemableChoiceField(
- required=False, initial={}, label=_("Session Persistence"))
-
- cookie_name = forms.CharField(
- initial="", required=False,
- max_length=80, label=_("Cookie Name"),
- help_text=_("Required for APP_COOKIE persistence;"
- " Ignored otherwise."))
-
- connection_limit = forms.IntegerField(
- min_value=-1, label=_("Connection Limit"),
- help_text=_("Maximum number of connections allowed "
- "for the VIP or '-1' if the limit is not set"))
- admin_state_up = forms.ThemableChoiceField(
- choices=[(True, _('UP')),
- (False, _('DOWN'))],
- label=_("Admin State"))
-
- failure_url = 'horizon:project:loadbalancers:index'
-
- def __init__(self, request, *args, **kwargs):
- super(UpdateVip, self).__init__(request, *args, **kwargs)
-
- pool_id_choices = []
- try:
- tenant_id = request.user.tenant_id
- pools = api.lbaas.pool_list(request, tenant_id=tenant_id)
- except Exception:
- pools = []
- exceptions.handle(request,
- _('Unable to retrieve pools list.'))
- pools = sorted(pools,
- key=lambda pool: pool.name)
- for p in pools:
- if (p.vip_id is None) or (p.id == kwargs['initial']['pool_id']):
- pool_id_choices.append((p.id, p.name))
- self.fields['pool_id'].choices = pool_id_choices
-
- session_persistence_choices = []
- for mode in ('SOURCE_IP', 'HTTP_COOKIE', 'APP_COOKIE'):
- session_persistence_choices.append((mode, mode))
- session_persistence_choices.append(('', _('No session persistence')))
- self.fields[
- 'session_persistence'].choices = session_persistence_choices
-
- def clean(self):
- cleaned_data = super(UpdateVip, self).clean()
-
- persistence = cleaned_data.get('session_persistence')
- if (persistence == 'APP_COOKIE' and
- not cleaned_data.get('cookie_name')):
- msg = _('Cookie name is required for APP_COOKIE persistence.')
- self._errors['cookie_name'] = self.error_class([msg])
- return cleaned_data
-
- def handle(self, request, context):
- context['admin_state_up'] = (context['admin_state_up'] == 'True')
- if context['session_persistence']:
- stype = context['session_persistence']
- if stype == 'APP_COOKIE':
- cookie = context['cookie_name']
- context['session_persistence'] = {'type': stype,
- 'cookie_name': cookie}
- else:
- context['session_persistence'] = {'type': stype}
- else:
- context['session_persistence'] = {}
-
- try:
- data = {'vip': {'name': context['name'],
- 'description': context['description'],
- 'pool_id': context['pool_id'],
- 'session_persistence':
- context['session_persistence'],
- 'connection_limit': context['connection_limit'],
- 'admin_state_up': context['admin_state_up'],
- }}
- vip = api.lbaas.vip_update(request, context['vip_id'], **data)
- msg = _('VIP %s was successfully updated.') % context['name']
- LOG.debug(msg)
- messages.success(request, msg)
- return vip
- except Exception:
- msg = _('Failed to update VIP %s') % context['name']
- LOG.info(msg)
- redirect = reverse(self.failure_url)
- exceptions.handle(request, msg, redirect=redirect)
-
-
-class UpdateMember(forms.SelfHandlingForm):
- member_id = forms.CharField(label=_("ID"),
- widget=forms.TextInput(
- attrs={'readonly': 'readonly'}))
- pool_id = forms.ThemableChoiceField(label=_("Pool"))
- weight = forms.IntegerField(max_value=256, min_value=0, label=_("Weight"),
- help_text=_("Relative part of requests this "
- "pool member serves compared to others"))
- admin_state_up = forms.ThemableChoiceField(
- choices=[(True, _('UP')),
- (False, _('DOWN'))],
- label=_("Admin State"))
-
- failure_url = 'horizon:project:loadbalancers:index'
-
- def __init__(self, request, *args, **kwargs):
- super(UpdateMember, self).__init__(request, *args, **kwargs)
-
- pool_id_choices = []
- try:
- tenant_id = request.user.tenant_id
- pools = api.lbaas.pool_list(request, tenant_id=tenant_id)
- except Exception:
- pools = []
- exceptions.handle(request,
- _('Unable to retrieve pools list.'))
- pools = sorted(pools,
- key=lambda pool: pool.name)
- for p in pools:
- pool_id_choices.append((p.id, p.name))
- self.fields['pool_id'].choices = pool_id_choices
-
- def handle(self, request, context):
- context['admin_state_up'] = (context['admin_state_up'] == 'True')
- try:
- data = {'member': {'pool_id': context['pool_id'],
- 'weight': context['weight'],
- 'admin_state_up': context['admin_state_up']}}
- member = api.lbaas.member_update(request,
- context['member_id'], **data)
- msg = _('Member %s was successfully updated.')\
- % context['member_id']
- LOG.debug(msg)
- messages.success(request, msg)
- return member
- except Exception:
- msg = _('Failed to update member %s') % context['member_id']
- LOG.info(msg)
- redirect = reverse(self.failure_url)
- exceptions.handle(request, msg, redirect=redirect)
-
-
-class UpdateMonitor(forms.SelfHandlingForm):
- monitor_id = forms.CharField(label=_("ID"),
- widget=forms.TextInput(
- attrs={'readonly': 'readonly'}))
- delay = forms.IntegerField(
- min_value=1,
- label=_("Delay"),
- help_text=_("The minimum time in seconds between regular checks "
- "of a member. It must be greater than or equal to "
- "timeout"))
- timeout = forms.IntegerField(
- min_value=1,
- label=_("Timeout"),
- help_text=_("The maximum time in seconds for a monitor to wait "
- "for a reply. It must be less than or equal to delay"))
- max_retries = forms.IntegerField(
- max_value=10, min_value=1,
- label=_("Max Retries (1~10)"),
- help_text=_("Number of permissible failures before changing "
- "the status of member to inactive"))
- admin_state_up = forms.ThemableChoiceField(
- choices=[(True, _('UP')),
- (False, _('DOWN'))],
- label=_("Admin State"))
-
- failure_url = 'horizon:project:loadbalancers:index'
-
- def __init__(self, request, *args, **kwargs):
- super(UpdateMonitor, self).__init__(request, *args, **kwargs)
-
- def clean(self):
- cleaned_data = super(UpdateMonitor, self).clean()
- delay = cleaned_data.get('delay')
- timeout = cleaned_data.get('timeout')
- if not delay >= timeout:
- msg = _('Delay must be greater than or equal to timeout')
- self._errors['delay'] = self.error_class([msg])
- return cleaned_data
-
- def handle(self, request, context):
- context['admin_state_up'] = (context['admin_state_up'] == 'True')
- try:
- data = {'health_monitor': {
- 'delay': context['delay'],
- 'timeout': context['timeout'],
- 'max_retries': context['max_retries'],
- 'admin_state_up': context['admin_state_up']}}
- monitor = api.lbaas.pool_health_monitor_update(
- request, context['monitor_id'], **data)
- msg = _('Health monitor %s was successfully updated.')\
- % context['monitor_id']
- LOG.debug(msg)
- messages.success(request, msg)
- return monitor
- except Exception:
- msg = _('Failed to update health monitor %s')\
- % context['monitor_id']
- LOG.info(msg)
- redirect = reverse(self.failure_url)
- exceptions.handle(request, msg, redirect=redirect)
diff --git a/openstack_dashboard/dashboards/project/loadbalancers/panel.py b/openstack_dashboard/dashboards/project/loadbalancers/panel.py
deleted file mode 100644
index 9e500bec2..000000000
--- a/openstack_dashboard/dashboards/project/loadbalancers/panel.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import logging
-
-from django.utils.translation import ugettext_lazy as _
-
-import horizon
-
-from openstack_dashboard.api import neutron
-
-LOG = logging.getLogger(__name__)
-
-
-class LoadBalancer(horizon.Panel):
- name = _("Load Balancers")
- slug = "loadbalancers"
- permissions = ('openstack.services.network',)
-
- def allowed(self, context):
- request = context['request']
- if not request.user.has_perms(self.permissions):
- return False
- try:
- if not neutron.is_service_enabled(request,
- config_name='enable_lb',
- ext_name='lbaas'):
- return False
- except Exception:
- LOG.error("Call to list enabled services failed. This is likely "
- "due to a problem communicating with the Neutron "
- "endpoint. Load Balancers panel will not be displayed.")
- return False
- if not super(LoadBalancer, self).allowed(context):
- return False
-
- LOG.warning(
- "DEPRECATION: LBaaS v1 dashboard in Horizon is deprecated "
- "in 'Newton' release and will be removed in 'Ocata' release. "
- "For more detail, check Horizon Newton release notes.")
- return True
diff --git a/openstack_dashboard/dashboards/project/loadbalancers/tables.py b/openstack_dashboard/dashboards/project/loadbalancers/tables.py
deleted file mode 100644
index 544d738ab..000000000
--- a/openstack_dashboard/dashboards/project/loadbalancers/tables.py
+++ /dev/null
@@ -1,566 +0,0 @@
-# Copyright 2013, Big Switch Networks, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-from django.core.urlresolvers import reverse
-from django import shortcuts
-from django import template
-from django.template import defaultfilters as filters
-from django.utils import http
-from django.utils.http import urlencode
-from django.utils.translation import pgettext_lazy
-from django.utils.translation import ugettext_lazy as _
-from django.utils.translation import ungettext_lazy
-
-from horizon import conf
-from horizon import exceptions
-from horizon import messages
-from horizon import tables
-
-from openstack_dashboard import api
-from openstack_dashboard.dashboards.project.access_and_security.floating_ips \
- import workflows
-from openstack_dashboard import policy
-
-
-class AddPoolLink(tables.LinkAction):
- name = "addpool"
- verbose_name = _("Add Pool")
- url = "horizon:project:loadbalancers:addpool"
- classes = ("ajax-modal",)
- icon = "plus"
- policy_rules = (("network", "create_pool"),)
-
-
-class AddVipLink(tables.LinkAction):
- name = "addvip"
- verbose_name = _("Add VIP")
- classes = ("ajax-modal",)
- icon = "plus"
- policy_rules = (("network", "create_vip"),)
-
- def get_link_url(self, pool):
- base_url = reverse("horizon:project:loadbalancers:addvip",
- kwargs={'pool_id': pool.id})
- return base_url
-
- def allowed(self, request, datum=None):
- if datum and datum.vip_id:
- return False
- return True
-
-
-class AddMemberLink(tables.LinkAction):
- name = "addmember"
- verbose_name = _("Add Member")
- url = "horizon:project:loadbalancers:addmember"
- classes = ("ajax-modal",)
- icon = "plus"
- policy_rules = (("network", "create_member"),)
-
-
-class AddMonitorLink(tables.LinkAction):
- name = "addmonitor"
- verbose_name = _("Add Monitor")
- url = "horizon:project:loadbalancers:addmonitor"
- classes = ("ajax-modal",)
- icon = "plus"
- policy_rules = (("network", "create_health_monitor"),)
-
-
-class DeleteVipLink(policy.PolicyTargetMixin, tables.Action):
- name = "deletevip"
- preempt = True
- verbose_name = _("Delete VIP")
- policy_rules = (("network", "delete_vip"),)
- action_type = "danger"
-
- def allowed(self, request, datum=None):
- if datum and datum.vip_id:
- self.help_text = _("Deleting VIP %s from this pool "
- "cannot be undone.") % datum.vip_id
- return True
- return False
-
- def single(self, table, request, obj_id):
- try:
- vip_id = api.lbaas.pool_get(request, obj_id).vip_id
- except Exception as e:
- exceptions.handle(request,
- _('Unable to locate VIP to delete. %s')
- % e)
- if vip_id is not None:
- try:
- api.lbaas.vip_delete(request, vip_id)
- messages.success(request, _('Deleted VIP %s') % vip_id)
- except Exception as e:
- exceptions.handle(request,
- _('Unable to delete VIP. %s') % e)
-
-
-class DeletePoolLink(policy.PolicyTargetMixin, tables.DeleteAction):
- name = "deletepool"
- policy_rules = (("network", "delete_pool"),)
-
- @staticmethod
- def action_present(count):
- return ungettext_lazy(
- u"Delete Pool",
- u"Delete Pools",
- count
- )
-
- @staticmethod
- def action_past(count):
- return ungettext_lazy(
- u"Scheduled deletion of Pool",
- u"Scheduled deletion of Pools",
- count
- )
-
- def allowed(self, request, datum=None):
- if datum and datum.vip_id:
- return False
- return True
-
- def delete(self, request, obj_id):
- try:
- api.lbaas.pool_delete(request, obj_id)
- except Exception as e:
- exceptions.handle(request,
- _('Unable to delete pool. %s') % e)
-
-
-class DeleteMonitorLink(policy.PolicyTargetMixin,
- tables.DeleteAction):
- name = "deletemonitor"
- policy_rules = (("network", "delete_health_monitor"),)
-
- @staticmethod
- def action_present(count):
- return ungettext_lazy(
- u"Delete Monitor",
- u"Delete Monitors",
- count
- )
-
- @staticmethod
- def action_past(count):
- return ungettext_lazy(
- u"Scheduled deletion of Monitor",
- u"Scheduled deletion of Monitors",
- count
- )
-
- def delete(self, request, obj_id):
- try:
- api.lbaas.pool_health_monitor_delete(request, obj_id)
- except Exception as e:
- exceptions.handle(request,
- _('Unable to delete monitor. %s') % e)
-
-
-class DeleteMemberLink(policy.PolicyTargetMixin, tables.DeleteAction):
- name = "deletemember"
- policy_rules = (("network", "delete_member"),)
-
- @staticmethod
- def action_present(count):
- return ungettext_lazy(
- u"Delete Member",
- u"Delete Members",
- count
- )
-
- @staticmethod
- def action_past(count):
- return ungettext_lazy(
- u"Scheduled deletion of Member",
- u"Scheduled deletion of Members",
- count
- )
-
- def delete(self, request, obj_id):
- try:
- api.lbaas.member_delete(request, obj_id)
- except Exception as e:
- exceptions.handle(request,
- _('Unable to delete member. %s') % e)
-
-
-class UpdatePoolLink(policy.PolicyTargetMixin, tables.LinkAction):
- name = "updatepool"
- verbose_name = _("Edit Pool")
- classes = ("ajax-modal", "btn-update",)
- policy_rules = (("network", "update_pool"),)
-
- def get_link_url(self, pool):
- base_url = reverse("horizon:project:loadbalancers:updatepool",
- kwargs={'pool_id': pool.id})
- return base_url
-
-
-class UpdateVipLink(policy.PolicyTargetMixin, tables.LinkAction):
- name = "updatevip"
- verbose_name = _("Edit VIP")
- classes = ("ajax-modal", "btn-update",)
- policy_rules = (("network", "update_vip"),)
-
- def get_link_url(self, pool):
- base_url = reverse("horizon:project:loadbalancers:updatevip",
- kwargs={'vip_id': pool.vip_id})
- return base_url
-
- def allowed(self, request, datum=None):
- if datum and not datum.vip_id:
- return False
- return True
-
-
-class UpdateMemberLink(policy.PolicyTargetMixin, tables.LinkAction):
- name = "updatemember"
- verbose_name = _("Edit Member")
- classes = ("ajax-modal", "btn-update",)
- policy_rules = (("network", "update_member"),)
-
- def get_link_url(self, member):
- base_url = reverse("horizon:project:loadbalancers:updatemember",
- kwargs={'member_id': member.id})
- return base_url
-
-
-class UpdateMonitorLink(policy.PolicyTargetMixin, tables.LinkAction):
- name = "updatemonitor"
- verbose_name = _("Edit Monitor")
- classes = ("ajax-modal", "btn-update",)
- policy_rules = (("network", "update_health_monitor"),)
-
- def get_link_url(self, monitor):
- base_url = reverse("horizon:project:loadbalancers:updatemonitor",
- kwargs={'monitor_id': monitor.id})
- return base_url
-
-
-class AddPMAssociationLink(policy.PolicyTargetMixin,
- tables.LinkAction):
- name = "addassociation"
- verbose_name = _("Associate Monitor")
- url = "horizon:project:loadbalancers:addassociation"
- classes = ("ajax-modal",)
- icon = "plus"
- policy_rules = (("network", "create_pool_health_monitor"),)
-
- def allowed(self, request, datum=None):
- try:
- tenant_id = request.user.tenant_id
- monitors = api.lbaas.pool_health_monitor_list(request,
- tenant_id=tenant_id)
- for m in monitors:
- if m.id not in datum['health_monitors']:
- return True
- except Exception:
- exceptions.handle(request,
- _('Failed to retrieve health monitors.'))
- return False
-
-
-class DeletePMAssociationLink(policy.PolicyTargetMixin,
- tables.LinkAction):
- name = "deleteassociation"
- verbose_name = _("Disassociate Monitor")
- url = "horizon:project:loadbalancers:deleteassociation"
- classes = ("ajax-modal",)
- icon = "trash"
- policy_rules = (("network", "delete_pool_health_monitor"),)
- action_type = "danger"
-
- def allowed(self, request, datum=None):
- if datum and not datum['health_monitors']:
- return False
- return True
-
-
-class AddVIPFloatingIP(policy.PolicyTargetMixin, tables.LinkAction):
- """Add floating ip to VIP
-
- This class is extremely similar to AssociateIP from
- the instances page
- """
- name = "associate"
- verbose_name = _("Associate Floating IP")
- url = "horizon:project:access_and_security:floating_ips:associate"
- classes = ("ajax-modal",)
- icon = "link"
- policy_rules = (("compute", "network:associate_floating_ip"),)
-
- def allowed(self, request, pool):
- if not api.network.floating_ip_supported(request):
- return False
- if api.network.floating_ip_simple_associate_supported(request):
- return False
- if hasattr(pool, "vip") and pool.vip:
- vip = pool.vip
- return not (hasattr(vip, "fip") and vip.fip)
- return False
-
- def get_link_url(self, datum):
- base_url = reverse(self.url)
- next_url = self.table.get_full_url()
- params = {
- workflows.IPAssociationWorkflow.redirect_param_name: next_url}
- if hasattr(datum, "vip") and datum.vip:
- vip = datum.vip
- params['port_id'] = vip.port_id
- params = urlencode(params)
- return "?".join([base_url, params])
-
-
-class RemoveVIPFloatingIP(policy.PolicyTargetMixin, tables.Action):
- """Remove floating IP from VIP
-
- This class is extremely similar to the project instance table
- SimpleDisassociateIP feature, but just different enough to not
- be able to share much code
- """
- name = "disassociate"
- preempt = True
- icon = "unlink"
- verbose_name = _("Disassociate Floating IP")
- classes = ("btn-disassociate",)
- policy_rules = (("compute", "network:disassociate_floating_ip"),)
- action_type = "danger"
-
- def allowed(self, request, pool):
- if not api.network.floating_ip_supported(request):
- return False
- if not conf.HORIZON_CONFIG["simple_ip_management"]:
- return False
- if hasattr(pool, "vip") and pool.vip:
- vip = pool.vip
- self.help_text = _('Floating IP will be removed '
- 'from VIP "%s".') % vip.name
- return hasattr(vip, "fip") and vip.fip
- return False
-
- def single(self, table, request, pool_id):
- try:
- pool = api.lbaas.pool_get(request, pool_id)
- fips = api.network.tenant_floating_ip_list(request)
- vip_fips = [fip for fip in fips
- if fip.port_id == pool.vip.port_id]
- if not vip_fips:
- messages.info(request, _("No floating IPs to disassociate."))
- else:
- api.network.floating_ip_disassociate(request,
- vip_fips[0].id)
- messages.success(request,
- _("Successfully disassociated "
- "floating IP: %s") % vip_fips[0].ip)
- except Exception:
- exceptions.handle(request,
- _("Unable to disassociate floating IP."))
- return shortcuts.redirect(request.get_full_path())
-
-
-class UpdatePoolsRow(tables.Row):
- ajax = True
-
- def get_data(self, request, pool_id):
- pool = api.lbaas.pool_get(request, pool_id)
- try:
- vip = api.lbaas.vip_get(request, pool.vip_id)
- pool.vip = vip
- except Exception:
- pass
- try:
- subnet = api.neutron.subnet_get(request, pool.subnet_id)
- pool.subnet_name = subnet.cidr
- except Exception:
- pool.subnet_name = pool.subnet_id
- return pool
-
-
-STATUS_CHOICES = (
- ("Active", True),
- ("Down", True),
- ("Error", False),
-)
-
-
-STATUS_DISPLAY_CHOICES = (
- ("Active", pgettext_lazy("Current status of a Pool",
- u"Active")),
- ("Down", pgettext_lazy("Current status of a Pool",
- u"Down")),
- ("Error", pgettext_lazy("Current status of a Pool",
- u"Error")),
- ("Created", pgettext_lazy("Current status of a Pool",
- u"Created")),
- ("Pending_Create", pgettext_lazy("Current status of a Pool",
- u"Pending Create")),
- ("Pending_Update", pgettext_lazy("Current status of a Pool",
- u"Pending Update")),
- ("Pending_Delete", pgettext_lazy("Current status of a Pool",
- u"Pending Delete")),
- ("Inactive", pgettext_lazy("Current status of a Pool",
- u"Inactive")),
-)
-
-
-ADMIN_STATE_DISPLAY_CHOICES = (
- ("UP", pgettext_lazy("Admin state of a Load balancer", u"UP")),
- ("DOWN", pgettext_lazy("Admin state of a Load balancer", u"DOWN")),
-)
-
-
-def get_vip_name(pool):
- if hasattr(pool, "vip") and pool.vip:
- template_name = 'project/loadbalancers/_pool_table_vip_cell.html'
- context = {"vip": pool.vip, }
- return template.loader.render_to_string(template_name, context)
- else:
- return None
-
-
-def get_subnet(pool):
- if hasattr(pool, "subnet") and pool.subnet:
- template_name = 'project/loadbalancers/_pool_table_subnet_cell.html'
- context = {"subnet": pool.subnet}
- return template.loader.render_to_string(template_name, context)
- else:
- return None
-
-
-class PoolsTable(tables.DataTable):
- METHOD_DISPLAY_CHOICES = (
- ("round_robin", pgettext_lazy("load balancing method",
- u"Round Robin")),
- ("least_connections", pgettext_lazy("load balancing method",
- u"Least Connections")),
- ("source_ip", pgettext_lazy("load balancing method",
- u"Source IP")),
- )
-
- name = tables.Column("name_or_id",
- verbose_name=_("Name"),
- link="horizon:project:loadbalancers:pooldetails")
- description = tables.Column('description', verbose_name=_("Description"))
- provider = tables.Column('provider', verbose_name=_("Provider"),
- filters=(lambda v: filters.default(v, _('N/A')),))
- subnet_name = tables.Column(get_subnet, verbose_name=_("Subnet"))
- protocol = tables.Column('protocol', verbose_name=_("Protocol"))
- method = tables.Column('lb_method',
- verbose_name=_("LB Method"),
- display_choices=METHOD_DISPLAY_CHOICES)
- status = tables.Column('status',
- verbose_name=_("Status"),
- status=True,
- status_choices=STATUS_CHOICES,
- display_choices=STATUS_DISPLAY_CHOICES)
- vip_name = tables.Column(get_vip_name, verbose_name=_("VIP"))
- admin_state = tables.Column("admin_state",
- verbose_name=_("Admin State"),
- display_choices=ADMIN_STATE_DISPLAY_CHOICES)
-
- class Meta(object):
- name = "poolstable"
- verbose_name = _("Pools")
- status_columns = ["status"]
- row_class = UpdatePoolsRow
- table_actions = (AddPoolLink, DeletePoolLink)
- row_actions = (UpdatePoolLink, AddVipLink, UpdateVipLink,
- DeleteVipLink, AddPMAssociationLink,
- DeletePMAssociationLink, DeletePoolLink,
- AddVIPFloatingIP, RemoveVIPFloatingIP)
-
-
-def get_pool_link(member):
- return reverse("horizon:project:loadbalancers:pooldetails",
- args=(http.urlquote(member.pool_id),))
-
-
-def get_member_link(member):
- return reverse("horizon:project:loadbalancers:memberdetails",
- args=(http.urlquote(member.id),))
-
-
-class UpdateMemberRow(tables.Row):
- ajax = True
-
- def get_data(self, request, member_id):
- member = api.lbaas.member_get(request, member_id)
- try:
- pool = api.lbaas.pool_get(request, member.pool_id)
- member.pool_name = pool.name
- except Exception:
- member.pool_name = member.pool_id
- return member
-
-
-class MembersTable(tables.DataTable):
- address = tables.Column('address',
- verbose_name=_("IP Address"),
- link=get_member_link,
- attrs={'data-type': "ip"})
- protocol_port = tables.Column('protocol_port',
- verbose_name=_("Protocol Port"))
- weight = tables.Column('weight',
- verbose_name=_("Weight"))
- pool_name = tables.Column('pool_name',
- verbose_name=_("Pool"), link=get_pool_link)
- status = tables.Column('status',
- verbose_name=_("Status"),
- status=True,
- status_choices=STATUS_CHOICES,
- display_choices=STATUS_DISPLAY_CHOICES)
- admin_state = tables.Column("admin_state",
- verbose_name=_("Admin State"),
- display_choices=ADMIN_STATE_DISPLAY_CHOICES)
-
- class Meta(object):
- name = "memberstable"
- verbose_name = _("Members")
- status_columns = ["status"]
- row_class = UpdateMemberRow
- table_actions = (AddMemberLink, DeleteMemberLink)
- row_actions = (UpdateMemberLink, DeleteMemberLink)
-
-
-def get_monitor_details(monitor):
- if monitor.type in ('HTTP', 'HTTPS'):
- return ("%(http_method)s %(url_path)s => %(codes)s" %
- {'http_method': monitor.http_method,
- 'url_path': monitor.url_path,
- 'codes': monitor.expected_codes})
- else:
- return _("-")
-
-
-class MonitorsTable(tables.DataTable):
- monitor_type = tables.Column(
- "type", verbose_name=_("Monitor Type"),
- link="horizon:project:loadbalancers:monitordetails")
- delay = tables.Column("delay", verbose_name=_("Delay"))
- timeout = tables.Column("timeout", verbose_name=_("Timeout"))
- max_retries = tables.Column("max_retries", verbose_name=_("Max Retries"))
- details = tables.Column(get_monitor_details, verbose_name=_("Details"))
- admin_state = tables.Column("admin_state",
- verbose_name=_("Admin State"),
- display_choices=ADMIN_STATE_DISPLAY_CHOICES)
-
- class Meta(object):
- name = "monitorstable"
- verbose_name = _("Monitors")
- table_actions = (AddMonitorLink, DeleteMonitorLink)
- row_actions = (UpdateMonitorLink, DeleteMonitorLink)
diff --git a/openstack_dashboard/dashboards/project/loadbalancers/tabs.py b/openstack_dashboard/dashboards/project/loadbalancers/tabs.py
deleted file mode 100644
index 82ed81111..000000000
--- a/openstack_dashboard/dashboards/project/loadbalancers/tabs.py
+++ /dev/null
@@ -1,151 +0,0 @@
-# Copyright 2013, Big Switch Networks, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from django.utils.translation import ugettext_lazy as _
-
-from horizon import exceptions
-from horizon import tabs
-
-from openstack_dashboard import api
-from openstack_dashboard.dashboards.project.loadbalancers import tables
-
-
-class PoolsTab(tabs.TableTab):
- table_classes = (tables.PoolsTable,)
- name = _("Pools")
- slug = "pools"
- template_name = "horizon/common/_detail_table.html"
-
- def get_poolstable_data(self):
- pools = []
- try:
- request = self.tab_group.request
- tenant_id = self.request.user.tenant_id
- pools = api.lbaas.pool_list(request,
- tenant_id=tenant_id)
- fips = None
- for pool in pools:
- if hasattr(pool, "vip") and pool.vip:
- if not fips:
- fips = api.network.tenant_floating_ip_list(request)
- vip_fip = [fip for fip in fips
- if fip.port_id == pool.vip.port_id]
- if vip_fip:
- pool.vip.fip = vip_fip[0]
- except Exception:
- exceptions.handle(self.tab_group.request,
- _('Unable to retrieve pools list.'))
- return pools
-
-
-class MembersTab(tabs.TableTab):
- table_classes = (tables.MembersTable,)
- name = _("Members")
- slug = "members"
- template_name = "horizon/common/_detail_table.html"
-
- def get_memberstable_data(self):
- try:
- tenant_id = self.request.user.tenant_id
- members = api.lbaas.member_list(self.tab_group.request,
- tenant_id=tenant_id)
- except Exception:
- members = []
- exceptions.handle(self.tab_group.request,
- _('Unable to retrieve member list.'))
- return members
-
-
-class MonitorsTab(tabs.TableTab):
- table_classes = (tables.MonitorsTable,)
- name = _("Monitors")
- slug = "monitors"
- template_name = "horizon/common/_detail_table.html"
-
- def get_monitorstable_data(self):
- try:
- tenant_id = self.request.user.tenant_id
- monitors = api.lbaas.pool_health_monitor_list(
- self.tab_group.request, tenant_id=tenant_id)
- except Exception:
- monitors = []
- exceptions.handle(self.tab_group.request,
- _('Unable to retrieve monitor list.'))
- return monitors
-
-
-class LoadBalancerTabs(tabs.TabGroup):
- slug = "lbtabs"
- tabs = (PoolsTab, MembersTab, MonitorsTab)
- sticky = True
-
-
-class PoolDetailsTab(tabs.Tab):
- name = _("Pool Details")
- slug = "pooldetails"
- template_name = "project/loadbalancers/_pool_details.html"
-
- def get_context_data(self, request):
- pool = self.tab_group.kwargs['pool']
- return {'pool': pool}
-
-
-class VipDetailsTab(tabs.Tab):
- name = _("VIP Details")
- slug = "vipdetails"
- template_name = "project/loadbalancers/_vip_details.html"
-
- def get_context_data(self, request):
- vip = self.tab_group.kwargs['vip']
- return {'vip': vip}
-
-
-class MemberDetailsTab(tabs.Tab):
- name = _("Member Details")
- slug = "memberdetails"
- template_name = "project/loadbalancers/_member_details.html"
-
- def get_context_data(self, request):
- member = self.tab_group.kwargs['member']
- return {'member': member}
-
-
-class MonitorDetailsTab(tabs.Tab):
- name = _("Monitor Details")
- slug = "monitordetails"
- template_name = "project/loadbalancers/_monitor_details.html"
-
- def get_context_data(self, request):
- monitor = self.tab_group.kwargs['monitor']
- return {'monitor': monitor}
-
-
-class PoolDetailsTabs(tabs.TabGroup):
- slug = "pooltabs"
- tabs = (PoolDetailsTab,)
-
-
-class VipDetailsTabs(tabs.TabGroup):
- slug = "viptabs"
- tabs = (VipDetailsTab,)
-
-
-class MemberDetailsTabs(tabs.TabGroup):
- slug = "membertabs"
- tabs = (MemberDetailsTab,)
-
-
-class MonitorDetailsTabs(tabs.TabGroup):
- slug = "monitortabs"
- tabs = (MonitorDetailsTab,)
diff --git a/openstack_dashboard/dashboards/project/loadbalancers/templates/loadbalancers/_create_pool_help.html b/openstack_dashboard/dashboards/project/loadbalancers/templates/loadbalancers/_create_pool_help.html
deleted file mode 100644
index f56d3919c..000000000
--- a/openstack_dashboard/dashboards/project/loadbalancers/templates/loadbalancers/_create_pool_help.html
+++ /dev/null
@@ -1,27 +0,0 @@
-{% load i18n %}
-
- {% blocktrans trimmed %}
- Assign a name and description for the pool. Choose one subnet where all
- members of this pool must be on. Select the protocol and load balancing
- method for this pool. Admin State is UP (checked) by default.
- {% endblocktrans %}
-
-
-
- {% blocktrans trimmed %}
- Use one of these load balancing methods to distribute incoming requests:
- {% endblocktrans %}
-
- {% blocktrans trimmed %}
- Create a VIP for this pool. Assign a name, description, IP address, port,
- and maximum connections allowed for the VIP. Choose the protocol and session persistence
- method for the VIP. Admin State is UP (checked) by default.
- {% endblocktrans %}
-
-
-
- {% blocktrans trimmed %}
- When no IP address is provided, the VIP will obtain an address from
- the selected subnet. If a specific IP address is desired, it may be provided and
- must also be an address within the selected subnet.
- {% endblocktrans %}
-