Use "cluster" and "cluster_template" of magnumclient
This patch changes "bay" and "baymodel" of magnumclient to "cluster" and "cluster_template", as last change for renaming bay to cluster. Change-Id: I77b6dc02738a1c455274bdb34bddcc91e21a30cb Implements: blueprint rename-bay-to-cluster
This commit is contained in:
parent
04d0257d71
commit
21afc6c0d5
@ -36,8 +36,8 @@ CLUSTER_TEMPLATE_CREATE_ATTRS = ['name', 'image_id', 'flavor_id',
|
|||||||
'floating_ip_enabled', 'master_lb_enabled',
|
'floating_ip_enabled', 'master_lb_enabled',
|
||||||
'insecure_registry']
|
'insecure_registry']
|
||||||
|
|
||||||
CLUSTER_CREATE_ATTRS = ['name', 'baymodel_id', 'node_count',
|
CLUSTER_CREATE_ATTRS = ['name', 'cluster_template_id', 'node_count',
|
||||||
'discovery_url', 'cluster_create_timeout',
|
'discovery_url', 'create_timeout',
|
||||||
'master_count']
|
'master_count']
|
||||||
|
|
||||||
CERTIFICATE_CREATE_ATTRS = ['cluster_uuid', 'csr']
|
CERTIFICATE_CREATE_ATTRS = ['cluster_uuid', 'csr']
|
||||||
@ -83,21 +83,21 @@ def cluster_template_create(request, **kwargs):
|
|||||||
kv = v.split("=", 1)
|
kv = v.split("=", 1)
|
||||||
labels[kv[0]] = kv[1]
|
labels[kv[0]] = kv[1]
|
||||||
args["labels"] = labels
|
args["labels"] = labels
|
||||||
return magnumclient(request).baymodels.create(**args)
|
return magnumclient(request).cluster_templates.create(**args)
|
||||||
|
|
||||||
|
|
||||||
def cluster_template_delete(request, id):
|
def cluster_template_delete(request, id):
|
||||||
return magnumclient(request).baymodels.delete(id)
|
return magnumclient(request).cluster_templates.delete(id)
|
||||||
|
|
||||||
|
|
||||||
def cluster_template_list(request, limit=None, marker=None, sort_key=None,
|
def cluster_template_list(request, limit=None, marker=None, sort_key=None,
|
||||||
sort_dir=None, detail=True):
|
sort_dir=None, detail=True):
|
||||||
return magnumclient(request).baymodels.list(limit, marker, sort_key,
|
return magnumclient(request).cluster_templates.list(
|
||||||
sort_dir, detail)
|
limit, marker, sort_key, sort_dir, detail)
|
||||||
|
|
||||||
|
|
||||||
def cluster_template_show(request, id):
|
def cluster_template_show(request, id):
|
||||||
return magnumclient(request).baymodels.get(id)
|
return magnumclient(request).cluster_templates.get(id)
|
||||||
|
|
||||||
|
|
||||||
def cluster_create(request, **kwargs):
|
def cluster_create(request, **kwargs):
|
||||||
@ -108,25 +108,25 @@ def cluster_create(request, **kwargs):
|
|||||||
else:
|
else:
|
||||||
raise exceptions.BadRequest(
|
raise exceptions.BadRequest(
|
||||||
"Key must be in %s" % ",".join(CLUSTER_CREATE_ATTRS))
|
"Key must be in %s" % ",".join(CLUSTER_CREATE_ATTRS))
|
||||||
return magnumclient(request).bays.create(**args)
|
return magnumclient(request).clusters.create(**args)
|
||||||
|
|
||||||
|
|
||||||
def cluster_update(request, id, patch):
|
def cluster_update(request, id, patch):
|
||||||
return magnumclient(request).bays.update(id, patch)
|
return magnumclient(request).clusters.update(id, patch)
|
||||||
|
|
||||||
|
|
||||||
def cluster_delete(request, id):
|
def cluster_delete(request, id):
|
||||||
return magnumclient(request).bays.delete(id)
|
return magnumclient(request).clusters.delete(id)
|
||||||
|
|
||||||
|
|
||||||
def cluster_list(request, limit=None, marker=None, sort_key=None,
|
def cluster_list(request, limit=None, marker=None, sort_key=None,
|
||||||
sort_dir=None, detail=True):
|
sort_dir=None, detail=True):
|
||||||
return magnumclient(request).bays.list(limit, marker, sort_key,
|
return magnumclient(request).clusters.list(limit, marker, sort_key,
|
||||||
sort_dir, detail)
|
sort_dir, detail)
|
||||||
|
|
||||||
|
|
||||||
def cluster_show(request, id):
|
def cluster_show(request, id):
|
||||||
return magnumclient(request).bays.get(id)
|
return magnumclient(request).clusters.get(id)
|
||||||
|
|
||||||
|
|
||||||
def certificate_create(request, **kwargs):
|
def certificate_create(request, **kwargs):
|
||||||
|
@ -37,11 +37,11 @@
|
|||||||
function initNewClusterSpec() {
|
function initNewClusterSpec() {
|
||||||
model.newClusterSpec = {
|
model.newClusterSpec = {
|
||||||
name: null,
|
name: null,
|
||||||
baymodel_id: null,
|
cluster_template_id: null,
|
||||||
master_count: null,
|
master_count: null,
|
||||||
node_count: null,
|
node_count: null,
|
||||||
discover_url: null,
|
discover_url: null,
|
||||||
bay_create_timeout: null
|
create_timeout: null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
function createClusterInfoController($q, $scope, basePath, magnum) {
|
function createClusterInfoController($q, $scope, basePath, magnum) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
ctrl.cluster_templates = [{id:"", name: gettext("Choose a Cluster Template")}];
|
ctrl.cluster_templates = [{id:"", name: gettext("Choose a Cluster Template")}];
|
||||||
$scope.model.newClusterSpec.baymodel_id = "";
|
$scope.model.newClusterSpec.cluster_template_id = "";
|
||||||
$scope.cluster_template_detail = {
|
$scope.cluster_template_detail = {
|
||||||
name: "",
|
name: "",
|
||||||
id: "",
|
id: "",
|
||||||
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
$scope.changeClusterTemplate = function(){
|
$scope.changeClusterTemplate = function(){
|
||||||
angular.forEach(ctrl.cluster_templates, function(model, idx){
|
angular.forEach(ctrl.cluster_templates, function(model, idx){
|
||||||
if($scope.model.newClusterSpec.baymodel_id === model.id){
|
if($scope.model.newClusterSpec.cluster_template_id === model.id){
|
||||||
$scope.cluster_template_detail.name = model.name;
|
$scope.cluster_template_detail.name = model.name;
|
||||||
$scope.cluster_template_detail.id = model.id;
|
$scope.cluster_template_detail.id = model.id;
|
||||||
$scope.cluster_template_detail.coe = model.coe;
|
$scope.cluster_template_detail.coe = model.coe;
|
||||||
@ -75,7 +75,7 @@
|
|||||||
function onGetClusterTemplates(response) {
|
function onGetClusterTemplates(response) {
|
||||||
Array.prototype.push.apply(ctrl.cluster_templates, response.items);
|
Array.prototype.push.apply(ctrl.cluster_templates, response.items);
|
||||||
if($scope.selected instanceof Object){
|
if($scope.selected instanceof Object){
|
||||||
$scope.model.newClusterSpec.baymodel_id = $scope.selected.id;
|
$scope.model.newClusterSpec.cluster_template_id = $scope.selected.id;
|
||||||
$scope.changeClusterTemplate();
|
$scope.changeClusterTemplate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
</label>
|
</label>
|
||||||
<select class="form-control" name="cluster-model" id="cluster-model"
|
<select class="form-control" name="cluster-model" id="cluster-model"
|
||||||
ng-model="model.newClusterSpec.baymodel_id"
|
ng-model="model.newClusterSpec.cluster_template_id"
|
||||||
ng-required="true"
|
ng-required="true"
|
||||||
ng-options="cluster_template.id as cluster_template.name|noName for cluster_template in ctrl.cluster_templates"
|
ng-options="cluster_template.id as cluster_template.name|noName for cluster_template in ctrl.cluster_templates"
|
||||||
ng-change="changeClusterTemplate()">
|
ng-change="changeClusterTemplate()">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="detail" ng-show="model.newClusterSpec.baymodel_id">
|
<div class="detail" ng-show="model.newClusterSpec.cluster_template_id">
|
||||||
<span translate class="h4">Cluster Template Detail</span>
|
<span translate class="h4">Cluster Template Detail</span>
|
||||||
<dl class="dl-horizontal">
|
<dl class="dl-horizontal">
|
||||||
<dt translate>Name</dt>
|
<dt translate>Name</dt>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label" for="cluster-timeout" translate>Timeout</label>
|
<label class="control-label" for="cluster-timeout" translate>Timeout</label>
|
||||||
<input name="cluster-timeout" type="number" min="0" class="form-control"
|
<input name="cluster-timeout" type="number" min="0" class="form-control"
|
||||||
ng-model="model.newClusterSpec.bay_create_timeout" id="cluster-timeout"
|
ng-model="model.newClusterSpec.create_timeout" id="cluster-timeout"
|
||||||
placeholder="{$ 'The timeout for cluster creation in minutes. Set to 0 for no timeout. The default is no timeout.'|translate $}">
|
placeholder="{$ 'The timeout for cluster creation in minutes. Set to 0 for no timeout. The default is no timeout.'|translate $}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<dl class="col-md-5">
|
<dl class="col-md-5">
|
||||||
<dt translate>Cluster Template</dt>
|
<dt translate>Cluster Template</dt>
|
||||||
<dd><a ng-href="project/ngdetails/OS::Magnum::ClusterTemplate/{$ item.baymodel_id $}">{$ item.baymodel_id $}</a></dd>
|
<dd><a ng-href="project/ngdetails/OS::Magnum::ClusterTemplate/{$ item.cluster_template_id $}">{$ item.cluster_template_id $}</a></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="col-md-3">
|
<dl class="col-md-3">
|
||||||
<dt translate>Node Addresses</dt>
|
<dt translate>Node Addresses</dt>
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
function onGetCluster(cluster) {
|
function onGetCluster(cluster) {
|
||||||
ctrl.cluster = cluster.data;
|
ctrl.cluster = cluster.data;
|
||||||
magnum.getClusterTemplate(ctrl.cluster.baymodel_id).success(onGetClusterTemplate);
|
magnum.getClusterTemplate(ctrl.cluster.cluster_template_id).success(onGetClusterTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onGetClusterTemplate(cluster_template) {
|
function onGetClusterTemplate(cluster_template) {
|
||||||
|
@ -48,12 +48,12 @@
|
|||||||
<dd>{$ ctrl.cluster.discovery_url $}</dd>
|
<dd>{$ ctrl.cluster.discovery_url $}</dd>
|
||||||
<dt translate>Cluster Create Timeout</dt>
|
<dt translate>Cluster Create Timeout</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<div ng-switch on="ctrl.cluster.bay_create_timeout === 0 || ctrl.cluster.bay_create_timeout === null">
|
<div ng-switch on="ctrl.cluster.create_timeout === 0 || ctrl.cluster.create_timeout === null">
|
||||||
<div ng-switch-when="true" translate>Infinite</div>
|
<div ng-switch-when="true" translate>Infinite</div>
|
||||||
<div ng-switch-default translate
|
<div ng-switch-default translate
|
||||||
translate-n="ctrl.cluster.bay_create_timeout"
|
translate-n="ctrl.cluster.create_timeout"
|
||||||
translate-plural="{$ ctrl.cluster.bay_create_timeout $} minutes">
|
translate-plural="{$ ctrl.cluster.create_timeout $} minutes">
|
||||||
{$ ctrl.cluster.bay_create_timeout $} minute
|
{$ ctrl.cluster.create_timeout $} minute
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
|
@ -58,13 +58,14 @@ class MagnumRestTestCase(test.TestCase):
|
|||||||
def test_cluster_template_delete(self, client):
|
def test_cluster_template_delete(self, client):
|
||||||
test_cluster_template = TEST.cluster_templates.first()
|
test_cluster_template = TEST.cluster_templates.first()
|
||||||
request = self.mock_rest_request(
|
request = self.mock_rest_request(
|
||||||
body='{"baymodel_id":' + str(test_cluster_template['uuid']) + '}')
|
body='{"cluster_template_id":'
|
||||||
|
+ str(test_cluster_template['uuid']) + '}')
|
||||||
response = magnum.ClusterTemplates().delete(request)
|
response = magnum.ClusterTemplates().delete(request)
|
||||||
|
|
||||||
self.assertStatusCode(response, 204)
|
self.assertStatusCode(response, 204)
|
||||||
client.cluster_template_delete.assert_called_once_with(
|
client.cluster_template_delete.assert_called_once_with(
|
||||||
request,
|
request,
|
||||||
u'baymodel_id')
|
u'cluster_template_id')
|
||||||
|
|
||||||
# Clusters
|
# Clusters
|
||||||
@mock.patch.object(magnum, 'magnum')
|
@mock.patch.object(magnum, 'magnum')
|
||||||
@ -97,13 +98,13 @@ class MagnumRestTestCase(test.TestCase):
|
|||||||
def test_cluster_delete(self, client):
|
def test_cluster_delete(self, client):
|
||||||
test_cluster = TEST.clusters.first()
|
test_cluster = TEST.clusters.first()
|
||||||
request = self.mock_rest_request(
|
request = self.mock_rest_request(
|
||||||
body='{"bay_id":' + str(test_cluster['uuid']) + '}')
|
body='{"cluster_id":' + str(test_cluster['uuid']) + '}')
|
||||||
response = magnum.Clusters().delete(request)
|
response = magnum.Clusters().delete(request)
|
||||||
|
|
||||||
self.assertStatusCode(response, 204)
|
self.assertStatusCode(response, 204)
|
||||||
client.cluster_delete.assert_called_once_with(
|
client.cluster_delete.assert_called_once_with(
|
||||||
request,
|
request,
|
||||||
u'bay_id')
|
u'cluster_id')
|
||||||
|
|
||||||
# Certificates
|
# Certificates
|
||||||
@mock.patch.object(magnum, 'magnum')
|
@mock.patch.object(magnum, 'magnum')
|
||||||
|
@ -51,11 +51,11 @@ def data(TEST):
|
|||||||
# Clusters
|
# Clusters
|
||||||
cluster_dict_1 = {"uuid": 1,
|
cluster_dict_1 = {"uuid": 1,
|
||||||
"name": "peopleknowme",
|
"name": "peopleknowme",
|
||||||
"baymodel": cluster_template_dict_1["uuid"],
|
"cluster_template_id": cluster_template_dict_1["uuid"],
|
||||||
"node-count": "",
|
"node_count": "",
|
||||||
"master-count": "",
|
"master_count": "",
|
||||||
"discovery-url": "",
|
"discovery_url": "",
|
||||||
"timeout": 0}
|
"create_timeout": 0}
|
||||||
|
|
||||||
TEST.clusters.add(cluster_dict_1)
|
TEST.clusters.add(cluster_dict_1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user