From 1b662de23145577dc48cb51396ef080e2d5b2c0a Mon Sep 17 00:00:00 2001 From: Shu Muto Date: Fri, 7 Jul 2017 16:02:14 +0900 Subject: [PATCH] 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 --- magnum_ui/api/magnum.py | 25 ++++++------------- .../clusters/update/update.service.js | 2 ++ .../workflow/cluster-template.controller.js | 10 +++++++- .../clusters/workflow/cluster-template.html | 2 ++ .../clusters/workflow/size.help.html | 2 +- .../clusters/workflow/workflow.service.js | 13 ++++++++++ 6 files changed, 35 insertions(+), 19 deletions(-) diff --git a/magnum_ui/api/magnum.py b/magnum_ui/api/magnum.py index 5ee4bd3b..466669a6 100644 --- a/magnum_ui/api/magnum.py +++ b/magnum_ui/api/magnum.py @@ -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): diff --git a/magnum_ui/static/dashboard/container-infra/clusters/update/update.service.js b/magnum_ui/static/dashboard/container-infra/clusters/update/update.service.js index 2bb59c3d..d211acb2 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/update/update.service.js +++ b/magnum_ui/static/dashboard/container-infra/clusters/update/update.service.js @@ -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); diff --git a/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.controller.js b/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.controller.js index e17b9da2..aba86aba 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.controller.js +++ b/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.controller.js @@ -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() { diff --git a/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.html b/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.html index 8d6f545a..962c33b2 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.html +++ b/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.html @@ -14,6 +14,8 @@
{$ ctrl.clusterTemplate.image_id $}
Keypair
{$ ctrl.clusterTemplate.keypair_id|noValue $}
+
Docker Volume Size
+
{$ ctrl.clusterTemplate.docker_volume_size|gb|noValue $}
Public
{$ ctrl.clusterTemplate.public $}
Registry Enabled
diff --git a/magnum_ui/static/dashboard/container-infra/clusters/workflow/size.help.html b/magnum_ui/static/dashboard/container-infra/clusters/workflow/size.help.html index 469dd23e..cd4c6fe8 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/workflow/size.help.html +++ b/magnum_ui/static/dashboard/container-infra/clusters/workflow/size.help.html @@ -1 +1 @@ -

Specify the number of master nodes and cluster nodes for the cluster.

+

Specify the number of master nodes, cluster nodes and docker volume size for the cluster.

diff --git a/magnum_ui/static/dashboard/container-infra/clusters/workflow/workflow.service.js b/magnum_ui/static/dashboard/container-infra/clusters/workflow/workflow.service.js index 389d6837..f892f89c 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/workflow/workflow.service.js +++ b/magnum_ui/static/dashboard/container-infra/clusters/workflow/workflow.service.js @@ -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: ""