Add support for scale several scaling group in one transaction.
Supported workflows
The plugin supports:
scaleuplist workflow
Create new instances with properties defined in scalable_entity_properties list.
Parameters:
scalable_entity_properties: List properties for nodes.
scale_compute: If a node name is passed as the scalable_entity_name
parameter and that node is contained (transitively) within a compute node
and this property is true, operate on the compute node instead of the
specified node. Default: false
ignore_failure: Ignore failure on install. Default: false
ignore_rollback_failure: Ignore failure on rollback. Default: true
scale_transaction_field: Place to save transaction id created in same
transaction. Default: _transaction_id
node_sequence: Optional, sequence of nodes for run for override
relationships.
scaledownlist workflow
Remove all instances from same transaction/property as node selected by
scale_node_name. If instances can’t be deleted in one transaction - as result
of workflow will be uninstalled instances with “uninitialized” status and runtime
properties cleaned up, you should ignore such instances in future uninstall actions.
Parameters:
scale_compute: If a node name is passed as the scale_node_name parameter
and that node is contained (transitively) within a compute node and this
property is true, operate on the compute node instead of the specified node.
Default: false
ignore_failure: Default: false
scale_transaction_field: Place to save transaction id created in same
transaction. Optional, can be skipped if we need to remove instance without
relation to initial transaction.
scale_node_name: A list of node ids. The operation will be executed only on
node instances which are instances of these nodes. An empty list means no
filtering will take place and all nodes are valid (Default: “”).
scale_node_field: Node runtime properties field name for search value,
supported search by ['a', 'b'] on {'a': {'b': 'c'}} return
* `scale_node_field_value`: Node runtime properties field value for search.
Can be provided as list of possible values.
* `force_db_cleanup`: Run DB cleanup directly if instances can't be deleted in
one transaction.
* `all_results`: Get all instances for filter. Required 4.4+ manager.
Default: `false`
* `node_sequence`: Optional, sequence of nodes for run for override
relationships.
### update_operation_filtered workflow
Execute action on selected nodes.
Parameters:
* `operation`: The name of the operation to execute.
(Default: cloudify.interfaces.lifecycle.update).
* `operation_kwargs`: A dictionary of keyword arguments that will be passed to
the operation invocation (Default: ```{}```).
* `allow_kwargs_override`: A boolean describing whether overriding operations
inputs defined in the blueprint by using inputs of the same name in the
operation_kwargs parameter is allowed or not (Default: ```null```, means that
the default behavior, as defined by the workflows infrastructure, will be
used).
* `run_by_dependency_order`: A boolean describing whether the operation should
execute on the relevant nodes according to the order of their relationships
dependencies or rather execute on all relevant nodes in parallel.
(Default: false).
* `type_names`: A list of type names. The operation will be executed only on
node instances which are of these types or of types which (recursively)
derive from them. An empty list means no filtering will take place and all
type names are valid (Default: ```[]```).
* `node_ids`: A list of node ids. The operation will be executed only on node
instances which are instances of these nodes. An empty list means no
filtering will take place and all nodes are valid (Default: ```[]```).
* `node_instance_ids`: A list of node instance ids. The operation will be
executed only on the node instances specified. An empty list means no
filtering will take place and all node instances are valid.
(Default: ```[]```).
* `node_field`: Node runtime properties field name for search value, supported
search by ```['a', 'b']``` on ```{'a': {'b': 'c'}}``` return ```c```.
* `node_field_value`: Node runtime properties field value for search. Can be
provided as list of possible values.
## Examples
[Example](https://github.com/cloudify-community/blueprint-examples/blob/master/utilities-examples/cloudify_scalelist/blueprint.yaml) for show scaling several scaling group
within one transaction.
## Install with one "two" node
We install blueprint with one ["two" nodes](./blueprint.yaml).
shell
$ cfy install cloudify-utilities-plugin/cloudify_scalelist/examples/blueprint.yaml -b examples
Uploading blueprint cloudify-utilities-plugin/cloudify_scalelist/examples/blueprint.yaml…
blueprint.yaml |######################################################| 100.0%
Blueprint uploaded. The blueprint’s id is examples
Creating new deployment from blueprint examples…
Deployment created. The deployment’s id is examples
Executing workflow install on deployment examples [timeout=900 seconds]
Deployment environment creation is pending…
2018-06-28 08:53:39.574 CFY Starting ‘create_deployment_environment’ workflow execution
….
2018-06-28 08:54:00.628 CFY [one_l1grdr] Starting node
2018-06-28 08:54:01.631 CFY [two_o9pie8] Creating node
2018-06-28 08:54:01.631 CFY [two_o9pie8.create] Sending task ‘script_runner.tasks.run’
2018-06-28 08:54:01.631 CFY [two_o9pie8.create] Task started ‘script_runner.tasks.run’
2018-06-28 08:54:02.102 LOG [two_o9pie8.create] INFO: Downloaded scripts/create.py to /tmp/6P025/tmp3Vdq18-create.py
2018-06-28 08:54:03.020 LOG [two_o9pie8.create] INFO: Resulted properties: {u’predefined’: u”, ‘ctx’: , u’script_path’: u’scripts/create.py’, u’resource_name’: u’two0’, u’defined_in_inputs’: u’one_l1grdr’}
2018-06-28 08:54:03.020 LOG [two_o9pie8.create] INFO: We will create: two_o9pie8
2018-06-28 08:54:02.634 CFY [two_o9pie8.create] Task succeeded ‘script_runner.tasks.run’
2018-06-28 08:54:03.637 CFY [two_o9pie8] Configuring node
2018-06-28 08:54:03.637 CFY [two_o9pie8] Starting node
2018-06-28 08:54:04.640 CFY [three_9qa5bk] Creating node
….
2018-06-28 08:54:14.666 CFY ‘install’ workflow execution succeeded
Finished executing workflow install on deployment examples
* Run ‘cfy events list -e e2a944f6-f9cd-47f9-bd5c-5b5abf659d28’ to retrieve the execution’s events/logs
Check properties:
shell
$ cfy node-instances get two_o9pie8
Retrieving node instance two_o9pie8
Node-instance:
+————+—————+———+———+———+————+—————-+————+
| id | deployment_id | host_id | node_id | state | visibility | tenant_name | created_by |
+————+—————+———+———+———+————+—————-+————+
| two_o9pie8 | examples | | two | started | tenant | default_tenant | admin |
+————+—————+———+———+———+————+—————-+————+
## Remove instances created with resource_name=two2
Run scale [list down](https://github.com/cloudify-community/blueprint-examples/blob/master/utilities-examples/cloudify_scalelist/scaledown_params.yaml)
shell
$ cfy uninstall examples
Executing workflow uninstall on deployment examples [timeout=900 seconds]
2018-06-28 09:04:03.146 CFY Starting ‘uninstall’ workflow execution
2018-06-28 09:04:04.414 CFY [six_lr0xnq] Stopping node
…
2018-06-28 09:04:16.482 CFY [one_l1grdr] Stopping node
2018-06-28 09:04:16.607 LOG [two_o9pie8.delete] INFO: We have some resource u’two_o9pie8’, so we can delete such
2018-06-28 09:04:16.607 LOG [two_czdur0.delete] INFO: Downloaded scripts/delete.py to /tmp/TKV05/tmpw8btoN-delete.py
2018-06-28 09:04:16.482 CFY [two_8b38ld.delete] Task succeeded ‘script_runner.tasks.run’
2018-06-28 09:04:16.482 CFY [two_o9pie8.delete] Task succeeded ‘script_runner.tasks.run’
2018-06-28 09:04:16.607 LOG [two_czdur0.delete] INFO: Resulted properties: {u’predefined’: u”, ‘ctx’: , u’script_path’: u’scripts/delete.py’, u’resource_name’: u’two0’, u’defined_in_inputs’: u’one_l1grdr’}
2018-06-28 09:04:16.607 LOG [two_czdur0.delete] INFO: Not fully created instances, skip it
2018-06-28 09:04:16.482 CFY [two_czdur0.delete] Task succeeded ‘script_runner.tasks.run’
2018-06-28 09:04:16.482 CFY [one_l1grdr] Stopping node
…
2018-06-28 09:04:18.611 LOG [one_l1grdr.delete] INFO: We have some resource u’one_l1grdr’, so we can delete such
2018-06-28 09:04:18.489 CFY [one_l1grdr.delete] Task succeeded ‘script_runner.tasks.run’
2018-06-28 09:04:19.491 CFY ‘uninstall’ workflow execution succeeded
Finished executing workflow uninstall on deployment examples
## Remove instances created by install workflow
State before [scale down](https://github.com/cloudify-community/blueprint-examples/blob/master/utilities-examples/cloudify_scalelist/scaledown_precreated.yaml):
shell
$ cfy node-instances get two_05vh0m
Retrieving node instance two_05vh0m
Node-instance:
+————+—————+———+———+———+————+—————-+————+
| id | deployment_id | host_id | node_id | state | visibility | tenant_name | created_by |
+————+—————+———+———+———+————+—————-+————+
| two_05vh0m | examples | | two | started | tenant | default_tenant | admin |
+————+—————+———+———+———+————+—————-+————+
## Remove instances created by install workflow without transaction id
Remove instances [without transaction id](https://github.com/cloudify-community/blueprint-examples/blob/master/utilities-examples/cloudify_scalelist/scaledown_without_transaction.yaml).
## Remove any instance by field value and ignore transaction
Remove instances [without transaction and field value](https://github.com/cloudify-community/blueprint-examples/blob/master/utilities-examples/cloudify_scalelist/scaledown_byvalue.yaml).
shell
$ cfy executions start scaledownlist -d examples -p cloudify-utilities-plugin/cloudify_scalelist/examples/scaledown_byvalue.yaml
Executing workflow scaledownlist on deployment examples [timeout=900 seconds]
2018-07-03 15:33:43.106 CFY Starting ‘scaledownlist’ workflow execution
2018-07-03 15:33:43.686 LOG INFO: Scale rules: {u’two_scale’: {‘count’: 1, ‘values’: [u’two_d8hmqx’]}}
2018-07-03 15:33:43.686 LOG INFO: Scale down u’two_scale’ by delta: 1
2018-07-03 15:33:43.686 LOG INFO: Scale settings: {u’two_scale’: {‘instances’: 2, ‘removed_ids_include_hint’: [u’two_d8hmqx’]}}
2018-07-03 15:33:43.686 LOG INFO: Deployment modification started. [modification_id=6f7020a1-7e6b-402f-912d-124dc7a4fcfd]
2018-07-03 15:33:43.686 LOG INFO: Removed: [u’two_ln2tgh’]
2018-07-03 15:33:43.686 LOG WARNING: Rolling back deployment modification. [modification_id=6f7020a1-7e6b-402f-912d-124dc7a4fcfd]: Exception(“Instance u’two_ln2tgh’ not in proposed list [u’two_d8hmqx’].“,)
2018-07-03 15:33:43.686 LOG INFO: Proposed: [u’two_d8hmqx’]
2018-07-03 15:33:44.696 LOG INFO: Scale down based on transaction failed: Exception(“Instance u’two_ln2tgh’ not in proposed list [u’two_d8hmqx’].“,)
2018-07-03 15:33:44.214 CFY [two_d8hmqx] Stopping node
2018-07-03 15:33:45.237 CFY [two_d8hmqx] Deleting node
2018-07-03 15:33:45.237 CFY [two_d8hmqx.delete] Sending task ‘script_runner.tasks.run’
2018-07-03 15:33:45.237 CFY [two_d8hmqx.delete] Task started ‘script_runner.tasks.run’
2018-07-03 15:33:46.032 LOG [two_d8hmqx.delete] INFO: Downloaded scripts/delete.py to /tmp/O5YRB/tmpI_9Fux-delete.py
2018-07-03 15:33:46.701 LOG [two_d8hmqx.delete] INFO: Resulted properties: {u’predefined’: u”, u’resource_name’: u’two1’, u’defined_in_inputs’: u’one_saqz5k’, u’resource_id’: u’two_d8hmqx’, ‘ctx’: , u’_transaction_id’: u’e919969a-af7a-494f-8b9b-f0712833c133’, u’script_path’: u’scripts/delete.py’}
2018-07-03 15:33:46.701 LOG [two_d8hmqx.delete] INFO: We have some resource u’two_d8hmqx’, so we can delete such
2018-07-03 15:33:46.255 CFY [two_d8hmqx.delete] Task succeeded ‘script_runner.tasks.run’
2018-07-03 15:33:46.701 LOG INFO: Cleanup node: two_d8hmqx
2018-07-03 15:33:46.689 CFY ‘scaledownlist’ workflow execution succeeded
Finished executing workflow scaledownlist on deployment examples
* Run ‘cfy events list -e 93c72e69-2ce7-411f-9121-9d0c2ba53852’ to retrieve the execution’s events/logs
## Run update on instances by field name, field value and node name.
Run [update action](https://github.com/cloudify-community/blueprint-examples/blob/master/utilities-examples/cloudify_scalelist/update_params.yaml) for specific by property value on node 'two'.