Add rollback option for cluster

Add rollback option as checkbox into cluster workflow for update.

Change-Id: Ic3979fccd2bed5b44a338780213dffb2235b9ef5
Implements: blueprint add-rollback-option
This commit is contained in:
Shu Muto 2017-07-07 16:42:28 +09:00
parent 1b662de231
commit de517b1168
2 changed files with 12 additions and 1 deletions

View File

@ -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):

View File

@ -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: ""