bmd-plugin-hookcmd
—
Spawns command when VM state is changed.
The bmd-plugin-hookcmd
spawns the specific
command when VM's status is changed.
This plugin expands VM configuration and add the following
parameters to specify which command is spawned/invoked.
hookcmd
=
command_path;
- File path to the spawn command. The user/group ID of spawned command is as
same as the owner/group of the VM.
prestart
=
command_path;
- File path to the prestart command. The prestart command is invoked before
starting the VM and delays starting it until the prestart command
terminates.
poststop
=
command_path;
- File path to the prestart command. The poststop command is invoked after
the VM stopped. Cleaning up the VM resources will delay until the poststop
command terminates.
The files of ‘prestart’ and ‘poststop’
must be owned by root. They are invoked as same uid/gid as the
bmd(8)
(root/wheel) and intended to setup OS specific envrionments such as routing,
firewall, etc.
The spawned command receives following arguments in following
order.
- VM_name
- The name of VM.
- VM_state
- The state of VM. One of these values.
LOAD
- The loader is invoked.
RUN
- VM start running.
TERMINATE
- VM is terminated.
PRESTART
- Before starting the VM.
POSTSTOP
- After stopping the VM.