xenapi: Setup and Rotate text console logs

This patch installs the cronjob that rotates/sets up the text console
logs of the guests.

Related to blueprint xenapi-server-log

Change-Id: Ie4c778b54f69519fbb80aa0d9822383f55a1e2f9
This commit is contained in:
Mate Lakat 2013-07-24 11:06:27 +01:00
parent c373cf8b89
commit abe56ee90f
2 changed files with 18 additions and 5 deletions

View File

@ -53,18 +53,18 @@ function find_xapi_plugins_dir {
find $1 -path '*/xapi.d/plugins' -type d -print
}
function install_xapi_plugins_from_zipball {
function install_xapi_plugins_from {
local XAPI_PLUGIN_DIR
local EXTRACTED_FILES
local EXTRACTED_PLUGINS_DIR
EXTRACTED_FILES="$1"
XAPI_PLUGIN_DIR=$(xapi_plugin_location)
EXTRACTED_FILES=$(extract_remote_zipball $1)
EXTRACTED_PLUGINS_DIR=$(find_xapi_plugins_dir $EXTRACTED_FILES)
cp -pr $EXTRACTED_PLUGINS_DIR/* $XAPI_PLUGIN_DIR
rm -rf $EXTRACTED_FILES
chmod a+x ${XAPI_PLUGIN_DIR}*
}

View File

@ -63,12 +63,25 @@ fi
## Nova plugins
NOVA_ZIPBALL_URL=${NOVA_ZIPBALL_URL:-$(zip_snapshot_location $NOVA_REPO $NOVA_BRANCH)}
install_xapi_plugins_from_zipball $NOVA_ZIPBALL_URL
EXTRACTED_NOVA=$(extract_remote_zipball "$NOVA_ZIPBALL_URL")
install_xapi_plugins_from "$EXTRACTED_NOVA"
LOGROT_SCRIPT=$(find "$EXTRACTED_NOVA" -name "rotate_xen_guest_logs.sh" -print)
if [ -n "$LOGROT_SCRIPT" ]; then
mkdir -p "/var/log/xen/guest"
cp "$LOGROT_SCRIPT" /root/consolelogrotate
chmod +x /root/consolelogrotate
echo "* * * * * /root/consolelogrotate" | crontab
fi
rm -rf "$EXTRACTED_NOVA"
## Install the netwrap xapi plugin to support agent control of dom0 networking
if [[ "$ENABLED_SERVICES" =~ "q-agt" && "$Q_PLUGIN" = "openvswitch" ]]; then
NEUTRON_ZIPBALL_URL=${NEUTRON_ZIPBALL_URL:-$(zip_snapshot_location $NEUTRON_REPO $NEUTRON_BRANCH)}
install_xapi_plugins_from_zipball $NEUTRON_ZIPBALL_URL
EXTRACTED_NEUTRON=$(extract_remote_zipball "$NEUTRON_ZIPBALL_URL")
install_xapi_plugins_from "$EXTRACTED_NEUTRON"
rm -rf "$EXTRACTED_NEUTRON"
fi
create_directory_for_kernels