subuk / vmango

Your own personal IaaS cloud
https://vmango.org
MIT License
329 stars 55 forks source link

feature request: post-create-hook script #26

Closed captainwasabi closed 5 years ago

captainwasabi commented 5 years ago

I'd like to be able to write a script that would get called after the vm is created with the following parameters:

$1 name $2 volume pool $3 volume name

captainwasabi commented 5 years ago

Instead of $2 and $3, that I was suggesting so I could recreate the path to the root volume, the path was actually available directly. So...

$1 id (name) $2 root volume path

subuk commented 5 years ago

Hello! That may be interesting feature, but maybe your case already covered by libvirt hooks? https://libvirt.org/hooks.html

captainwasabi commented 5 years ago

Did not know about those, but it doesn't seem like that there is one that is called post create. Just on guest startup (prep, pre, and post). I only need it on creation but before startup.

Thanks

subuk commented 5 years ago

I will look how to add such hooks, I think it will be something like this in config:

subscribe "vm_created" {
    exec "/path/to/hook.sh $VMANGO_VM_NAME $VMANGO_VOLUME_PATH"
}
captainwasabi commented 5 years ago

cool. Thanks!

subuk commented 5 years ago

Hello, current master has this feature, see configuration example https://github.com/subuk/vmango/commit/b880e57cb311fdceccccc07d634f719f7950d4a4