Able to manipulate retries down of health monitor

Change-Id: Ia123e9d7e511720ba970ee9d29c9d685dfe3f7ff
Story: 1713870
Task: 5451
This commit is contained in:
Jacky Hu 2017-11-08 08:28:14 +08:00
parent f781c98a77
commit d57615e8f9
8 changed files with 76 additions and 1 deletions

View File

@ -216,6 +216,7 @@ def create_health_monitor(request, **kwargs):
delay=data['monitor']['interval'],
timeout=data['monitor']['timeout'],
max_retries=data['monitor']['retry'],
max_retries_down=data['monitor']['retry_down'],
pool_id=kwargs['pool_id'],
http_method=data['monitor'].get('method'),
url_path=data['monitor'].get('path'),
@ -399,6 +400,7 @@ def update_monitor(request, **kwargs):
delay=data['monitor'].get('interval'),
timeout=data['monitor'].get('timeout'),
max_retries=data['monitor'].get('retry'),
max_retries_down=data['monitor'].get('retry_down'),
http_method=data['monitor'].get('method'),
url_path=data['monitor'].get('path'),
expected_codes=data['monitor'].get('status'))

View File

@ -152,6 +152,17 @@ msgstr ""
"tidak aktif. Harus\n"
"   nomor dari 1 sampai 10."
msgid ""
"<strong>Retries down:</strong>\n"
" The number of allowed connection failures before marking the member as "
"error. Must be a\n"
" number from 1 to 10. The default is 3."
msgstr ""
"<strong>Retries down:</strong>\n"
" The number of allowed connection failures before marking the member as "
"error. Must be a\n"
" number from 1 to 10. The default is 3."
msgid ""
"<strong>Subnet:</strong>\n"
" The network on which to allocate the load balancer's IP address."
@ -521,6 +532,9 @@ msgstr "Loading (pemuatan)"
msgid "Max Retries"
msgstr "Max Retries (pengulangan terbanyak)"
msgid "Max Retries Down"
msgstr "Max Retries Down"
msgid "Member ID"
msgstr "Member ID (ID anggota)"
@ -667,6 +681,13 @@ msgstr ""
"Retries\n"
" <span class=\"hz-icon-required fa fa-asterisk\"></span>"
msgid ""
"Retries down\n"
" <span class=\"hz-icon-required fa fa-asterisk\"></span>"
msgstr ""
"Retries down\n"
" <span class=\"hz-icon-required fa fa-asterisk\"></span>"
msgid "Round Robin"
msgstr "Round Robin"

View File

@ -21,6 +21,8 @@
<dd>{$ ::ctrl.healthmonitor.delay $}</dd>
<dt translate>Max Retries</dt>
<dd>{$ ::ctrl.healthmonitor.max_retries $}</dd>
<dt translate>Max Retries Down</dt>
<dd>{$ ::ctrl.healthmonitor.max_retries_down $}</dd>
<dt translate>Timeout</dt>
<dd>{$ ::ctrl.healthmonitor.timeout $}</dd>
<dt translate ng-if="::ctrl.healthmonitor.http_method">HTTP Method</dt>

View File

@ -162,6 +162,7 @@
type: null,
interval: 5,
retry: 3,
retry_down: 3,
timeout: 5,
method: 'GET',
status: '200',
@ -673,6 +674,7 @@
spec.interval = monitor.delay;
spec.timeout = monitor.timeout;
spec.retry = monitor.max_retries;
spec.retry_down = monitor.max_retries_down;
spec.method = monitor.http_method;
spec.status = monitor.expected_codes;
spec.path = monitor.url_path;

View File

@ -67,6 +67,7 @@
delay: 1,
timeout: 1,
max_retries: 1,
max_retries_down: 1,
http_method: 'POST',
expected_codes: '200',
url_path: '/test'
@ -161,6 +162,7 @@
delay: 1,
timeout: 1,
max_retries: 1,
max_retries_down: 1,
http_method: 'POST',
expected_codes: '200',
url_path: '/test'
@ -564,6 +566,7 @@
expect(model.spec.monitor.type).toBeNull();
expect(model.spec.monitor.interval).toBe(5);
expect(model.spec.monitor.retry).toBe(3);
expect(model.spec.monitor.retry_down).toBe(3);
expect(model.spec.monitor.timeout).toBe(5);
expect(model.spec.monitor.method).toBe('GET');
expect(model.spec.monitor.status).toBe('200');
@ -610,6 +613,7 @@
expect(model.spec.monitor.interval).toBe(1);
expect(model.spec.monitor.timeout).toBe(1);
expect(model.spec.monitor.retry).toBe(1);
expect(model.spec.monitor.retry_down).toBe(1);
expect(model.spec.monitor.method).toBe('POST');
expect(model.spec.monitor.status).toBe('200');
expect(model.spec.monitor.path).toBe('/test');
@ -706,6 +710,7 @@
expect(model.spec.monitor.type).toBe('HTTP');
expect(model.spec.monitor.interval).toBe(1);
expect(model.spec.monitor.retry).toBe(1);
expect(model.spec.monitor.retry_down).toBe(1);
expect(model.spec.monitor.timeout).toBe(1);
expect(model.spec.monitor.method).toBe('POST');
expect(model.spec.monitor.status).toBe('200');
@ -788,6 +793,7 @@
expect(model.spec.monitor.type).toBe('HTTP');
expect(model.spec.monitor.interval).toBe(1);
expect(model.spec.monitor.retry).toBe(1);
expect(model.spec.monitor.retry_down).toBe(1);
expect(model.spec.monitor.timeout).toBe(1);
expect(model.spec.monitor.method).toBe('POST');
expect(model.spec.monitor.status).toBe('200');
@ -870,6 +876,7 @@
expect(model.spec.monitor.type).toBeNull();
expect(model.spec.monitor.interval).toBe(5);
expect(model.spec.monitor.retry).toBe(3);
expect(model.spec.monitor.retry_down).toBe(3);
expect(model.spec.monitor.timeout).toBe(5);
expect(model.spec.monitor.method).toBe('GET');
expect(model.spec.monitor.status).toBe('200');
@ -943,7 +950,7 @@
expect(Object.keys(model.spec.loadbalancer).length).toBe(4);
expect(Object.keys(model.spec.listener).length).toBe(5);
expect(Object.keys(model.spec.pool).length).toBe(7);
expect(Object.keys(model.spec.monitor).length).toBe(8);
expect(Object.keys(model.spec.monitor).length).toBe(9);
expect(model.spec.members).toEqual([]);
});
@ -1027,6 +1034,10 @@
expect(model.spec.monitor.retry).toBe(3);
});
it('sets monitor retry down count to 3', function() {
expect(model.spec.monitor.retry_down).toBe(3);
});
it('sets monitor timeout to 5', function() {
expect(model.spec.monitor.timeout).toBe(5);
});
@ -1214,6 +1225,7 @@
model.spec.monitor.type = 'PING';
model.spec.monitor.interval = 1;
model.spec.monitor.retry = 1;
model.spec.monitor.retry_down = 1;
model.spec.monitor.timeout = 1;
model.spec.certificates = [{
id: 'container1',
@ -1264,6 +1276,7 @@
expect(finalSpec.monitor.type).toBe('PING');
expect(finalSpec.monitor.interval).toBe(1);
expect(finalSpec.monitor.retry).toBe(1);
expect(finalSpec.monitor.retry_down).toBe(1);
expect(finalSpec.monitor.timeout).toBe(1);
expect(finalSpec.certificates).toBeUndefined();
});
@ -1385,6 +1398,7 @@
model.spec.monitor.type = 'PING';
model.spec.monitor.interval = 1;
model.spec.monitor.retry = 1;
model.spec.monitor.retry_down = 1;
model.spec.monitor.timeout = null;
var finalSpec = model.submit();
@ -1459,6 +1473,7 @@
model.spec.monitor.type = 'PING';
model.spec.monitor.interval = 1;
model.spec.monitor.retry = 1;
model.spec.monitor.retry_down = 1;
model.spec.monitor.timeout = 1;
model.spec.certificates = [{
id: 'container1',
@ -1503,6 +1518,7 @@
expect(finalSpec.monitor.type).toBe('PING');
expect(finalSpec.monitor.interval).toBe(1);
expect(finalSpec.monitor.retry).toBe(1);
expect(finalSpec.monitor.retry_down).toBe(1);
expect(finalSpec.monitor.timeout).toBe(1);
expect(finalSpec.certificates).toBeUndefined();
});
@ -1612,6 +1628,7 @@
model.spec.monitor.type = 'PING';
model.spec.monitor.interval = 1;
model.spec.monitor.retry = 1;
model.spec.monitor.retry_down = 1;
model.spec.monitor.timeout = null;
var finalSpec = model.submit();
@ -1667,6 +1684,7 @@
model.spec.monitor.type = 'PING';
model.spec.monitor.interval = 1;
model.spec.monitor.retry = 1;
model.spec.monitor.retry_down = 1;
model.spec.monitor.timeout = 1;
model.spec.certificates = [{
id: 'container1',
@ -1706,6 +1724,7 @@
expect(finalSpec.monitor.type).toBe('PING');
expect(finalSpec.monitor.interval).toBe(1);
expect(finalSpec.monitor.retry).toBe(1);
expect(finalSpec.monitor.retry_down).toBe(1);
expect(finalSpec.monitor.timeout).toBe(1);
expect(finalSpec.certificates).toBeUndefined();
});
@ -1794,6 +1813,7 @@
model.spec.monitor.type = 'PING';
model.spec.monitor.interval = 1;
model.spec.monitor.retry = 1;
model.spec.monitor.retry_down = 1;
model.spec.monitor.timeout = null;
var finalSpec = model.submit();
@ -1829,6 +1849,7 @@
expect(finalSpec.monitor.type).toBe('HTTP');
expect(finalSpec.monitor.interval).toBe(5);
expect(finalSpec.monitor.retry).toBe(3);
expect(finalSpec.monitor.retry_down).toBe(3);
expect(finalSpec.monitor.timeout).toBe(5);
expect(finalSpec.monitor.method).toBe('GET');
expect(finalSpec.monitor.status).toBe('200');
@ -1876,6 +1897,7 @@
expect(finalSpec.monitor.type).toBe('HTTP');
expect(finalSpec.monitor.interval).toBe(1);
expect(finalSpec.monitor.retry).toBe(1);
expect(finalSpec.monitor.retry_down).toBe(1);
expect(finalSpec.monitor.timeout).toBe(1);
});
});
@ -1917,6 +1939,7 @@
expect(finalSpec.monitor.type).toBe('HTTP');
expect(finalSpec.monitor.interval).toBe(1);
expect(finalSpec.monitor.retry).toBe(1);
expect(finalSpec.monitor.retry_down).toBe(1);
expect(finalSpec.monitor.timeout).toBe(1);
});
});
@ -1959,6 +1982,7 @@
expect(finalSpec.monitor.interval).toBe(5);
expect(finalSpec.monitor.retry).toBe(3);
expect(finalSpec.monitor.retry_down).toBe(3);
expect(finalSpec.monitor.timeout).toBe(5);
});
});
@ -2049,6 +2073,7 @@
it('should set final spec properties', function() {
model.spec.monitor.interval = 10;
model.spec.monitor.retry = 6;
model.spec.monitor.retry_down = 6;
model.spec.monitor.timeout = 8;
model.spec.monitor.method = 'GET';
model.spec.monitor.status = '200-204';
@ -2067,6 +2092,7 @@
expect(finalSpec.monitor.type).toBe('HTTP');
expect(finalSpec.monitor.interval).toBe(10);
expect(finalSpec.monitor.retry).toBe(6);
expect(finalSpec.monitor.retry_down).toBe(6);
expect(finalSpec.monitor.timeout).toBe(8);
expect(finalSpec.monitor.method).toBe('GET');
expect(finalSpec.monitor.status).toBe('200-204');

View File

@ -45,6 +45,7 @@
ctrl.intervalError = gettext('The health check interval must be greater than or equal to the timeout.');
/* eslint-enable max-len */
ctrl.retryError = gettext('The max retry count must be a number between 1 and 10.');
ctrl.retryDownError = gettext('The max retry down count must be a number between 1 and 10.');
ctrl.timeoutError = gettext('The timeout must be a number greater than or equal to 0.');
ctrl.statusError = gettext('The expected status code is not valid.');
ctrl.pathError = gettext('The URL path is not valid.');

View File

@ -13,6 +13,11 @@
The number of allowed connection failures before marking the member as inactive. Must be a
number from 1 to 10.
</p>
<p translate>
<strong>Retries down:</strong>
The number of allowed connection failures before marking the member as error. Must be a
number from 1 to 10. The default is 3.
</p>
<p translate>
<strong>Timeout:</strong>
The time after which a health check times out. Must be a number greater than or equal to 0

View File

@ -17,6 +17,22 @@
</div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-4">
<div class="form-group required"
ng-class="{ 'has-error': monitorDetailsForm.retry_down.$invalid && monitorDetailsForm.retry_down.$dirty }">
<label translate class="control-label" for="retry_down">
Retries down
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input name="retry_down" id="retry_down" type="number" class="form-control"
ng-model="model.spec.monitor.retry_down" ng-pattern="/^\d+$/" min="1" max="10"
ng-required="true">
<span class="help-block" ng-show="monitorDetailsForm.retry_down.$invalid && monitorDetailsForm.retry_down.$dirty">
{$ ::ctrl.retryDownError $}
</span>
</div>
</div>
</div>
<div class="row">