Introduction
This page was started to encapsulate the results of reverse-engineering the as-installed /etc/xen/scripts/* scripts
Calling the scripts
Normally the scripts are called by xl (and thence libxenlight?) because the are named in /etc/xen/<DomU name>.cfg.
Developing the scripts
In case of syntax errors, the error messages do not appear when running xl -vvv create <dom-name>.cfg so it may be necessary to run the scripts at a command prompt, in which case some run time values must be given ...
Runtime values
The script's arguments and environment can be found by inserting this code at the beginning of a script:
log_fn=/tmp/${0##*/}.$$
exec >>$log_fn 2>&1
i=0
for arg in "$@"
do
echo "Arg $((i++)): '$arg'"
done
echo "env output: $(env)"
unset i arg
In case you want to trace a script, the usual technique of adding +x to the shebang line was found not to work on Debian 7 wheezy. Adding set +x after the code above puts trace into the log file.
Functions
Name | Functionality | Defined in |
_setup_bridge_port | xen-network-common.sh | |
_xenstore_write | xenstore-write "$@" | xen-hotplug-common.sh |
add_to_bridge | If /sys/class/net/$bridge/brif/$dev does not exist, runbrctl addif $bridge $dev | xen-network-common.sh |
canonicalise_mode | block-common.sh | |
create_bridge | xen-network-common.sh | |
device_major_minor | block-common.sh | |
do_or_die | Run args as command. If it returns non-0 rc, call fatal | xen-hotplug-common.sh |
do_without_error | Run args as command, discarding stderr. If it returns non-0 rc, log and continue. | xen-hotplug-common.sh |
dom0_ip | Print the IP address of the interface in dom0 through which we are routing. This is the IP address on the interface specified as "netdev" as a parameter to these scripts, or eth0 by default. | vif-common.sh |
ebusy | block-common.sh | |
evalVariables | If any args contain a character from ">=1", eval it | xen-script-common.sh |
fatal | Log error and exit | xen-hotplug-common.sh |
findCommand | If any args do not contain "=" set command to it and return | xen-script-common.sh |
find_dhcpd_arg_file | xen-network-common.sh | |
find_dhcpd_conf_file | xen-network-common.sh | |
find_dhcpd_init_file | xen-network-common.sh | |
first_file | xen-network-common.sh | |
frob_iptable | vif-common.sh | |
handle_iptable | If iptables working, run frob_iptable function with various args | vif-common.sh |
ifdown | Only defined if there is no ifup (sic) command, when it is a dummy and always returns non-zero | xen-network-common.sh |
ifup | Only defined if there is no ifup command, when it is a dummy and always returns non-zero | xen-network-common.sh |
ip_of | Print the IP address currently in use at the given interface | vif-common.sh |
preiftransfer | Dummy; always returns 0 | xen-network-common.sh |
same_vm | block-common.sh | |
setup_physical_bridge_port | _setup_bridge_port $1 0 | xen-network-common.sh |
setup_virtual_bridge_port | _setup_bridge_port $1 1 | xen-network-common.sh |
sigerr | ERR trap handler. Calls fatal | xen-hotplug-common.sh |
success | Tell DevController that backend is "connected" | xen-hotplug-common.sh |
vtpm_add_and_activate | vtpm-common.sh | |
vtpm_create | vtpm-common.sh | |
vtpm_create_instance | vtpm-common.sh | |
vtpm_delete | vtpm-common.sh | |
vtpm_delete_instance | vtpm-common.sh | |
vtpm_domid_from_name | vtpm-common.sh | |
vtpm_get_create_reason | vtpm-common.sh | |
vtpm_isLocalAddress | vtpm-common.sh | |
vtpm_migrate | vtpm-common.sh | |
vtpm_migrate_local | vtpm-common.sh | |
vtpm_migrate_recover | vtpm-common.sh | |
vtpm_migration_step | vtpm-common.sh | |
vtpm_recover | vtpm-common.sh | |
vtpm_remove_instance | vtpm-common.sh | |
vtpm_resume | vtpm-common.sh | |
vtpm_setup | vtpm-common.sh | |
vtpm_start | vtpm-common.sh | |
vtpm_suspend | vtpm-common.sh | |
vtpm_uuid_by_domid | vtpm-common.sh | |
vtpm_uuid_from_vmname | vtpm-common.sh | |
vtpmdb_add_instance | vtpm-common.sh | |
vtpmdb_find_instance | vtpm-common.sh | |
vtpmdb_get_free_instancenum | vtpm-common.sh | |
vtpmdb_is_free_instancenum | vtpm-common.sh | |
vtpmdb_remove_entry | vtpm-common.sh | |
vtpmdb_validate_entry | vtpm-common.sh | |
write_dev | block-common.sh | |
xenstore_read | xenstore-read "$@" | xen-hotplug-common.sh |
xenstore_read_default | xenstore-read "$1" || echo "$2" | xen-hotplug-common.sh |
xenstore_write | _xenstore_write "$@" || fatal | xen-hotplug-common.sh |