OpenNebula / one

The open source Cloud & Edge Computing Platform bringing real freedom to your Enterprise Cloud 🚀
http://opennebula.io
Apache License 2.0
1.26k stars 484 forks source link

Include support to use "epilog" and "prolog" scripts within VMM scripts #972

Open OpenNebulaProject opened 7 years ago

OpenNebulaProject commented 7 years ago

Author Name: Alvaro Simon (Alvaro Simon) Original Redmine Issue: 4136, https://dev.opennebula.org/issues/4136 Original Date: 2015-11-05


This is a request to include epilog and prolog scripts support to by executed by VMM scripts inside the hypervisors. A good example was included by Atodorov Storpool in this thread:

https://forum.opennebula.org/t/question-about-vmm-actions-and-libvirt-options/1433/5

Including epilog and prolog scripts defined by the user we will able to activate some administrative actions as oneadmin user during VMM executions for different VM states (copy,migrate, mv) like:

Cheers Alvaro

OpenNebulaProject commented 7 years ago

Original Redmine Comment Author Name: Anton Todorov (Anton Todorov) Original Date: 2015-11-05T19:49:35Z


IMO not only VMM but almost (if not) all scripts should have such feature.

or all to have only one generic loader

#!/bin/bash

[ -d "${0}.d" ] && for hook in "${0}.d"/* ; do source "$hook"; done

and all code to be placed in the .../script.d/50-upstream_code.

Even more it would be useful to split the code by stages/function... I don’t know how to name it properly/, so we could "insert" logic in the middle/or key places/ of the script.

For example this is what I am patching to add our datastore monitoring: https://github.com/OpenNebula/addon-storpool/blob/master/patches/im/4.14/00-monitor_ds.patch

and in the inserted file, if the requested Datastore is on storpool storage I am composing response and iterating the loop in the parent im/monitor_ds.sh: https://github.com/OpenNebula/addon-storpool/blob/master/datastore/storpool/monitor_ds.sh#L65

Cheers, Anton