FreeBSD Manual Pages
BMD-PLUGIN-HOOKCMD(8) System Manager's Manual BMD-PLUGIN-HOOKCMD(8) NAME bmd-plugin-hookcmd -- Spawns command when VM state is changed. DESCRIPTION The bmd-plugin-hookcmd spawns the specific command when VM's status is changed. Configuration 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 in- voked 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 in- voked 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. Command Argument 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. ENVIRONMENT VARIABLES The VM configurations are exported to the following environment vari- ables. VM_NAME Virtual machine name. VM_ID Unique number for each individual VMs that starts from 0. Same as $ID in the predefined configuration variable. VM_OWNER Uid number of the owner. VM_GROUP Gid number of the group. `-1' if it is not set. VM_NCPU Number of CPUs. VM_NCPU_PINS Number of cpu_pin definitions. VM_CPU_PIN${n} vcpu:hostcpu. Where ${n} starts from 1 to VM_NCPU_PINS. VM_MEMORY Size of memory which is specified in memory value. VM_WIRED_MEMORY `true' or `false'. VM_UTCTIME `true' or `false'. VM_REBOOT_ON_CHANGE `true' or `false'. VM_SINGLE_USER `true' or `false'. VM_INSTALL `true' or `false'. VM_COMPORT Assigned com port device name. VM_DEBUG_PORT Debug port number. VM_BOOT Boot type. VM_BOOT_DELAY Delay time in seconds. VM_LOADER_TIMEOUT Loader timeout in seconds. VM_STOP_TIMEOUT VM stop timeout in seconds. VM_LOADER Type of loader. VM_BHYVELOAD_LOADER Path to the OS loader. VM_NBHYVELOAD_ENVS Number of `bhyveload_env' s. VM_BHYVELOAD_ENV${n} Bhyveload environment variable. Where ${n} starts from 1 to VM_NBHYVELOAD_ENVS. VM_NBHYVE_ENVS Number of `bhyve_env' s. VM_BHYVE_ENV${n} Bhyve environment variable. Where ${n} starts from 1 to VM_NBHYVE_ENVS. VM_LOADCMD Loadcmd value which is specified in the configuration file. This is not the value `bmdctl inspect` creates. VM_INSTALLCMD Installcmd value which is specified in the configuration file. This is not the value `bmdctl inspect` creates. VM_ERR_LOGFILE Err_logfile name. VM_HOST_BRIDGE `none' or `intel' or `amd'. VM_NPASSTHRUES Number of `passthru' s. VM_PASSTHRU${n} Passthru device. Where ${n} starts from 1 to VM_NPASSTHRUES. VM_TPM_DEV Tpm device name. This is set if specified. VM_TPM_VERSION Tpm device version. This is set if specified. VM_NDISKS Number of `disk' s. VM_DISK${n}_TYPE Disk device type. Where ${n} starts from 1 to VM_NDISKS. VM_DISK${n}_PATH Disk device path. Where ${n} starts from 1 to VM_NDISKS. VM_NDISOES Number of `iso' s. VM_ISO${n}_TYPE Iso device type. Where ${n} starts from 1 to VM_NISOES. VM_ISO${n}_PATH Iso device path. Where ${n} starts from 1 to VM_NISOES. VM_NNETWORKS Number of `network' s. VM_NETWORK${n}_TYPE Network device type. Where ${n} starts from 1 to VM_NNET- WORKS. VM_NETWORK${n}_TAP Assigned tap interface name or vale(4) port name. Where ${n} starts from 1 to VM_NNETWORKS. VM_NETWORK${n}_BRIDGE Bridge interface name or vale(4) swtich name. Where ${n} starts from 1 to VM_NNETWORKS. VM_GRAPHICS `true' or `false'. VM_GRAPHICS_LISTEN Vnc listen address. This is set if VM_GRAPHICS is `true'. VM_GRAPHICS_PORT Vnc port number. This is set if VM_GRAPHICS is `true'. VM_GRAPHICS_PASSWORD Vnc password. This is set if VM_GRAPHICS is `true'. VM_GRAPHICS_RES <width> x <height>. This is set if VM_GRAPHICS is `true'. VM_GRAPHICS_WAIT `true' or `false.' This is set if VM_GRAPHICS is `true'. VM_XHCI_MOUSE `true' or `false.' This is set if VM_GRAPHICS is `true'. SEE ALSO bmd(8), bmd.conf(5) FreeBSD Ports 14.quarterly Aug 15, 2023 BMD-PLUGIN-HOOKCMD(8)
NAME | DESCRIPTION | ENVIRONMENT VARIABLES | SEE ALSO
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=bmd-plugin-hookcmd&sektion=8&manpath=FreeBSD+Ports+14.3.quarterly>
