diff --git a/magnum_ui/api/magnum.py b/magnum_ui/api/magnum.py index 466669a6..15553d5e 100644 --- a/magnum_ui/api/magnum.py +++ b/magnum_ui/api/magnum.py @@ -140,16 +140,18 @@ def cluster_template_show(request, id): def cluster_create(request, **kwargs): + kwargs.pop("rollback") args = _cleanup_params(CLUSTER_CREATE_ATTRS, True, **kwargs) return magnumclient(request).clusters.create(**args) def cluster_update(request, id, **kwargs): + rollback = kwargs.pop("rollback") new = _cleanup_params(CLUSTER_CREATE_ATTRS, True, **kwargs) old = magnumclient(request).clusters.get(id).to_dict() old = _cleanup_params(CLUSTER_CREATE_ATTRS, False, **old) patch = _create_patches(old, new) - return magnumclient(request).clusters.update(id, patch) + return magnumclient(request).clusters.update(id, patch, rollback=rollback) def cluster_delete(request, id): 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 f892f89c..2c4ca72b 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 @@ -81,6 +81,10 @@ 'docker_volume_size': { title: gettext('Docker Volume Size (GB)'), type: 'number' + }, + 'rollback': { + title: gettext('Rollback cluster on update failure'), + type: 'boolean' } } }; @@ -145,6 +149,10 @@ placeholder: gettext('Specify the size in GB for the docker volume'), description: dockerVolumeSizeDescription, readonly: action === 'update' + }, + { + key: 'rollback', + condition: action === 'create' } ] } @@ -209,6 +217,7 @@ master_count: null, node_count: null, docker_volume_size: "", + rollback: false, discovery_url: "", create_timeout: null, keypair: ""