Action Hooks

From SolusVM

Jump to: navigation, search

Slave Action Hooks

Xen Virtual Server Configuration File

This action hook will allow you to make custom changes to a xen virtual server configuration file. The action hook is run directly after SolusVM writes or rewrites the configuration file for a virtual server. The action hook must be placed in:

/home/xen/vm<ID>/hooks/hook_config.sh

Heres an example hook that removes the vif line from a configuration file and replaces it with a custom vif line:

#!/bin/sh
grep -Ev 'vif' /home/xen/vm101/vm101.cfg > /home/xen/vm101/vm101.cfg.tmp
mv /home/xen/vm101/vm101.cfg.tmp /home/xen/vm101/vm101.cfg
echo "vif = ['ip=123.123.123.123, vifname=vifvm101.0, mac=00:16:3e:95:a1:b3, rate=128KB/s']" >> /home/xen/vm101/vm101.cfg 

There are also plenty of other ways to manipulate the configuration files i.e sed and awk.

Personal tools
Installation/Upgrading
Customization