Floating IP: Expose description field in form and tables
The networking API supports setting a description on floating IP addresses. This patch adds a form input field to the allocation form, and a column to the table that displays floating IP list. Closes-Bug: #1738625 Change-Id: I3cec286d01f319402dd652f2f0fe7a59e7d1cfbb
This commit is contained in:
parent
f929d39ab4
commit
d1225c606e
@ -591,6 +591,8 @@ class FloatingIpManager(object):
|
||||
create_dict['subnet_id'] = params['subnet_id']
|
||||
if 'floating_ip_address' in params:
|
||||
create_dict['floating_ip_address'] = params['floating_ip_address']
|
||||
if 'description' in params:
|
||||
create_dict['description'] = params['description']
|
||||
fip = self.client.create_floatingip(
|
||||
{'floatingip': create_dict}).get('floatingip')
|
||||
self._set_instance_info(fip)
|
||||
|
@ -34,6 +34,9 @@ class AdminFloatingIpAllocate(forms.SelfHandlingForm):
|
||||
"You need to specify an explicit address which is under "
|
||||
"the public network CIDR (e.g. 202.2.3.0/24)."),
|
||||
mask=False)
|
||||
description = forms.CharField(max_length=255,
|
||||
label=_("Description"),
|
||||
required=False)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(AdminFloatingIpAllocate, self).__init__(*args, **kwargs)
|
||||
@ -48,6 +51,8 @@ class AdminFloatingIpAllocate(forms.SelfHandlingForm):
|
||||
param = {}
|
||||
if data['floating_ip_address']:
|
||||
param['floating_ip_address'] = data['floating_ip_address']
|
||||
if data['description']:
|
||||
param['description'] = data['description']
|
||||
subnet = api.neutron.subnet_get(request, data['pool'])
|
||||
param['subnet_id'] = subnet.id
|
||||
fip = api.neutron.tenant_floating_ip_allocate(
|
||||
|
@ -86,4 +86,4 @@ class FloatingIPsTable(project_tables.FloatingIPsTable):
|
||||
AdminFloatingIPsFilterAction)
|
||||
row_actions = (AdminSimpleDisassociateIP,
|
||||
AdminReleaseFloatingIP)
|
||||
columns = ('tenant', 'ip', 'fixed_ip', 'pool', 'status')
|
||||
columns = ('tenant', 'ip', 'description', 'fixed_ip', 'pool', 'status')
|
||||
|
@ -29,6 +29,9 @@ from openstack_dashboard.usage import quotas
|
||||
|
||||
class FloatingIpAllocate(forms.SelfHandlingForm):
|
||||
pool = forms.ThemableChoiceField(label=_("Pool"))
|
||||
description = forms.CharField(max_length=255,
|
||||
label=_("Description"),
|
||||
required=False)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(FloatingIpAllocate, self).__init__(*args, **kwargs)
|
||||
@ -46,8 +49,13 @@ class FloatingIpAllocate(forms.SelfHandlingForm):
|
||||
self.api_error(error_message)
|
||||
return False
|
||||
|
||||
fip = api.neutron.tenant_floating_ip_allocate(request,
|
||||
pool=data['pool'])
|
||||
param = {}
|
||||
if data['description']:
|
||||
param['description'] = data['description']
|
||||
fip = api.neutron.tenant_floating_ip_allocate(
|
||||
request,
|
||||
pool=data['pool'],
|
||||
**param)
|
||||
messages.success(request,
|
||||
_('Allocated Floating IP %(ip)s.')
|
||||
% {"ip": fip.ip})
|
||||
|
@ -187,6 +187,8 @@ class FloatingIPsTable(tables.DataTable):
|
||||
ip = tables.Column("ip",
|
||||
verbose_name=_("IP Address"),
|
||||
attrs={'data-type': "ip"})
|
||||
description = tables.Column("description",
|
||||
verbose_name=_("Description"))
|
||||
fixed_ip = tables.Column(get_instance_info,
|
||||
link=get_instance_link,
|
||||
verbose_name=_("Mapped Fixed IP Address"))
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Floating IP addresses have a description field that is now exposed in the
|
||||
dashboard. It is also possible to set the description when allocating a
|
||||
floating IP.
|
Loading…
Reference in New Issue
Block a user