Add docker volume size option for cluster

Add docker volume size option as number into cluster workflow
for create.

Change-Id: I18528d87d5696795742973c90da85b74fbfc3894
Implements: blueprint add-docker-volume-size-option
This commit is contained in:
Shu Muto 2017-07-07 16:02:14 +09:00
parent 6db5050e34
commit 1b662de231
6 changed files with 35 additions and 19 deletions

View File

@ -17,30 +17,21 @@ from __future__ import absolute_import
import logging
from django.conf import settings
from magnumclient.v1 import client as magnum_client
from horizon import exceptions
from horizon.utils.memoized import memoized
from openstack_dashboard.api import base
from magnumclient.v1 import certificates
from magnumclient.v1 import client as magnum_client
from magnumclient.v1 import cluster_templates
from magnumclient.v1 import clusters
LOG = logging.getLogger(__name__)
CLUSTER_TEMPLATE_CREATE_ATTRS = ['name', 'image_id', 'flavor_id',
'master_flavor_id', 'keypair_id',
'external_network_id', 'fixed_network',
'dns_nameserver', 'docker_volume_size',
'labels', 'coe', 'http_proxy', 'https_proxy',
'no_proxy', 'network_driver', 'volume_driver',
'public', 'registry_enabled', 'tls_disabled',
'docker_storage_driver', 'fixed_subnet',
'floating_ip_enabled', 'master_lb_enabled',
'insecure_registry']
CLUSTER_CREATE_ATTRS = ['name', 'cluster_template_id', 'node_count',
'discovery_url', 'create_timeout',
'master_count', 'keypair']
CERTIFICATE_CREATE_ATTRS = ['cluster_uuid', 'csr']
CLUSTER_TEMPLATE_CREATE_ATTRS = cluster_templates.CREATION_ATTRIBUTES
CLUSTER_CREATE_ATTRS = clusters.CREATION_ATTRIBUTES
CERTIFICATE_CREATE_ATTRS = certificates.CREATION_ATTRIBUTES
def _cleanup_params(attrs, check, **params):

View File

@ -77,6 +77,8 @@
? response.data.create_timeout : null;
config.model.keypair = response.data.keypair
? response.data.keypair : "";
config.model.docker_volume_size = response.data.docker_volume_size
? response.data.docker_volume_size : "";
}
return modal.open(config).then(submit);

View File

@ -48,7 +48,8 @@
registry_enabled: "",
tls_disabled: "",
apiserver_port: "",
keypair_id: ""
keypair_id: "",
docker_volume_size: ""
};
}
@ -74,6 +75,13 @@
$scope.model.keypair = response.data.keypair_id;
}
}
if ($scope.model.docker_volume_size === "") {
if (response.data.docker_volume_size === null) {
$scope.model.docker_volume_size = "";
} else {
$scope.model.docker_volume_size = response.data.docker_volume_size;
}
}
}
function watchClusterTemplateId() {

View File

@ -14,6 +14,8 @@
<dd>{$ ctrl.clusterTemplate.image_id $}</dd>
<dt translate>Keypair</dt>
<dd>{$ ctrl.clusterTemplate.keypair_id|noValue $}</dd>
<dt translate>Docker Volume Size</dt>
<dd>{$ ctrl.clusterTemplate.docker_volume_size|gb|noValue $}</dd>
<dt translate>Public</dt>
<dd>{$ ctrl.clusterTemplate.public $}</dd>
<dt translate>Registry Enabled</dt>

View File

@ -1 +1 @@
<p translate>Specify the number of master nodes and cluster nodes for the cluster.</p>
<p translate>Specify the number of master nodes, cluster nodes and docker volume size for the cluster.</p>

View File

@ -40,6 +40,8 @@
var schema, form, model;
var clusterTemplates = [{value:"", name: gettext("Choose a Cluster Template")}];
var keypairs = [{value:"", name: gettext("Choose a Keypair")}];
var dockerVolumeSizeDescription = gettext(
"If not specified, the value specified in Clsuter Template will be used.");
// schema
schema = {
@ -75,6 +77,10 @@
'keypair': {
title: gettext('Keypair'),
type: 'string'
},
'docker_volume_size': {
title: gettext('Docker Volume Size (GB)'),
type: 'number'
}
}
};
@ -133,6 +139,12 @@
{
key: 'node_count',
placeholder: gettext('The cluster node count.')
},
{
key: 'docker_volume_size',
placeholder: gettext('Specify the size in GB for the docker volume'),
description: dockerVolumeSizeDescription,
readonly: action === 'update'
}
]
}
@ -196,6 +208,7 @@
cluster_template_id: "",
master_count: null,
node_count: null,
docker_volume_size: "",
discovery_url: "",
create_timeout: null,
keypair: ""