From f1194d2dc1315fda371d5d27115aa8fd5de94ea4 Mon Sep 17 00:00:00 2001
From: Jacky Hu
Date: Wed, 16 May 2018 20:12:26 +0800
Subject: [PATCH] Allow members to be set as "backup"
This is a follow up of octavia-api changes made in:
I953abe71a0988da78efc6b3961f7518c81c2a06d
Depends-On: https://review.openstack.org/#/c/561386/
Change-Id: I5b627802cc7089abc2d9e98a690f4c911afe8b77
Story: 2001777
Task: 12485
---
octavia_dashboard/api/rest/lbaasv2.py | 2 ++
.../actions/edit-member/modal.controller.js | 2 ++
.../edit-member/modal.controller.spec.js | 2 ++
.../members/actions/edit-member/modal.html | 13 +++++++++++++
.../lbaasv2/members/details/detail.html | 4 ++++
.../project/lbaasv2/members/members.module.js | 8 ++++++++
.../workflow/members/members.controller.js | 1 +
.../lbaasv2/workflow/members/members.help.html | 7 +++++++
.../lbaasv2/workflow/members/members.html | 18 ++++++++++++++++--
.../project/lbaasv2/workflow/model.service.js | 4 +++-
.../add-member-backup-32e2ec2553c1ba24.yaml | 4 ++++
11 files changed, 62 insertions(+), 3 deletions(-)
create mode 100644 releasenotes/notes/add-member-backup-32e2ec2553c1ba24.yaml
diff --git a/octavia_dashboard/api/rest/lbaasv2.py b/octavia_dashboard/api/rest/lbaasv2.py
index 5ac9b970..a0b17f2d 100644
--- a/octavia_dashboard/api/rest/lbaasv2.py
+++ b/octavia_dashboard/api/rest/lbaasv2.py
@@ -307,6 +307,7 @@ def add_member(request, **kwargs):
monitor_address=monitor_address if monitor_address else None,
monitor_port=member.get('monitor_port'),
admin_state_up=member.get('admin_state_up'),
+ backup=member.get('backup', False),
name=member.get('name'),
)
@@ -1079,6 +1080,7 @@ class Member(generic.View):
monitor_address=monitor_address if monitor_address else None,
monitor_port=data.get('monitor_port'),
admin_state_up=data.get('admin_state_up'),
+ backup=data.get('backup', False),
name=data.get('name'),
)
return _get_sdk_object_dict(member)
diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.controller.js b/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.controller.js
index 3de43a2f..5f6f2b1c 100644
--- a/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.controller.js
+++ b/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.controller.js
@@ -64,6 +64,7 @@
ctrl.monitor_address = member.monitor_address;
ctrl.monitor_port = member.monitor_port;
ctrl.admin_state_up = member.admin_state_up;
+ ctrl.backup = member.backup;
ctrl.name = member.name;
ctrl.cancel = cancel;
ctrl.save = save;
@@ -81,6 +82,7 @@
monitor_address: ctrl.monitor_address,
monitor_port: ctrl.monitor_port,
admin_state_up: ctrl.admin_state_up,
+ backup: ctrl.backup,
name: ctrl.name
}).then(onSuccess, onFailure);
}
diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.controller.spec.js b/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.controller.spec.js
index 81bdd633..9ebeea0e 100644
--- a/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.controller.spec.js
+++ b/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.controller.spec.js
@@ -43,6 +43,7 @@
monitor_address: '1.1.1.1',
monitor_port: 80,
admin_state_up: true,
+ backup: false,
name: 'member name'
});
$provide.value('horizon.app.core.openstack-service-api.lbaasv2', {
@@ -86,6 +87,7 @@
monitor_address: '1.1.1.1',
monitor_port: 80,
admin_state_up: true,
+ backup: false,
name: 'member name'
});
expect($uibModalInstance.close).toHaveBeenCalled();
diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.html b/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.html
index f05337b0..76c39254 100644
--- a/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.html
+++ b/octavia_dashboard/static/dashboard/project/lbaasv2/members/actions/edit-member/modal.html
@@ -101,6 +101,19 @@
+
diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/members/details/detail.html b/octavia_dashboard/static/dashboard/project/lbaasv2/members/details/detail.html
index 2acda866..3309fc46 100644
--- a/octavia_dashboard/static/dashboard/project/lbaasv2/members/details/detail.html
+++ b/octavia_dashboard/static/dashboard/project/lbaasv2/members/details/detail.html
@@ -20,6 +20,10 @@
Port
{$ ::ctrl.member.protocol_port $}
+
+ Backup
+ {$ ctrl.member.backup | yesno $}
+
Operating Status
{$ ctrl.member.operating_status | decode:ctrl.operatingStatus $}
diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/members/members.module.js b/octavia_dashboard/static/dashboard/project/lbaasv2/members/members.module.js
index f16fc973..49037845 100644
--- a/octavia_dashboard/static/dashboard/project/lbaasv2/members/members.module.js
+++ b/octavia_dashboard/static/dashboard/project/lbaasv2/members/members.module.js
@@ -78,6 +78,10 @@
id: 'weight',
priority: 1
})
+ .append({
+ id: 'backup',
+ priority: 1
+ })
.append({
id: 'operating_status',
priority: 1
@@ -148,6 +152,10 @@
label: gettext('Admin State Up'),
filters: ['yesno']
},
+ backup: {
+ label: gettext('Backup'),
+ filters: ['yesno']
+ },
address: gettext('IP Address'),
protocol_port: gettext('Port'),
weight: gettext('Weight'),
diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.controller.js b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.controller.js
index 52f87d5e..fc8b0c5b 100644
--- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.controller.js
+++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.controller.js
@@ -119,6 +119,7 @@
monitor_address: null,
monitor_port: null,
admin_state_up: true,
+ backup: false,
name: null
});
}
diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.help.html b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.help.html
index 738ebebc..d5685b67 100644
--- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.help.html
+++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.help.html
@@ -48,3 +48,10 @@
Default is null which monitors the member protocol port.
+
+ Backup:
+
+ Is the member a backup? Backup members only receive traffic when all
+ non-backup members are down.
+
+
diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.html b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.html
index b4d1346b..36a26b83 100644
--- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.html
+++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/members/members.html
@@ -112,7 +112,7 @@
Can be toggled using the chevron button.
Ensure colspan is greater or equal to number of column-headers.
-->
-
+ |
+
+ - Backup
+ -
+
+
+
- Name
-
@@ -171,7 +185,7 @@
|
-
+
diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js
index 2901fc9b..0b9362c1 100644
--- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js
+++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js
@@ -601,7 +601,8 @@
weight: 1,
monitor_address: null,
monitor_port: null,
- admin_state_up: true
+ admin_state_up: true,
+ backup: false
});
}
});
@@ -801,6 +802,7 @@
monitor_address: member.monitor_address,
monitor_port: member.monitor_port,
admin_state_up: member.admin_state_up,
+ backup: member.backup,
name: member.name,
allocatedMember: true
});
diff --git a/releasenotes/notes/add-member-backup-32e2ec2553c1ba24.yaml b/releasenotes/notes/add-member-backup-32e2ec2553c1ba24.yaml
new file mode 100644
index 00000000..0fca1eb2
--- /dev/null
+++ b/releasenotes/notes/add-member-backup-32e2ec2553c1ba24.yaml
@@ -0,0 +1,4 @@
+---
+features:
+ - |
+ Adds the ability to set member as backup.
|