This is a PoC for providing automatic evacuation for VMs in OpenStack cloud using Mistral. It uses flavor extra specs and VM metadata to tell if given instance should be evacuated. Extra spec is 'evacuation:evacuate' and VM metadata is 'evacuate'. If one of them is set to True, instance will be evacuated.
Copy
filter_vm_action.pyandevacuate_vm_action.pyto the place reachable by python interpreter - seePYTHONPATHorsys.pathfor reference.Append lines
[entry_points] mistral.actions = … custom.filter_vm = filter_vm_action:FilterVmAction custom.evacuate = evacuate_vm_action:EvacuateVmAction
to
setup.cfgfile under Mistral repositoryRun db-sync tool via either
$ tools/sync_db.sh --config-file <path-to-config>
or
$ mistral-db-manage --config-file <path-to-config> populate
Register Mistral workflow:
$ mistral workflow-create host-evacuate.yaml
Create JSON file with content similar to:
{ "search_opts": { "host": "compute-hostanme" }, "on_shared_storage": false }Trigger the action via:
$ mistral execution-create host-evacuate input.json
where
input.jsonis a file created in previous step.