From c60818421152e5711fc93cab79122379c4e243aa Mon Sep 17 00:00:00 2001 From: Huan Xie Date: Wed, 16 Nov 2016 00:40:32 -0800 Subject: [PATCH] XenAPI: Use XenServer DevStack plugins Hypervisor XenServer will change to use os-xenapi in the future, this will need DevStack changes, this patch is to remove install Dom0 plugins part to our own DevStack plugins. Change-Id: Ic327135b893a77672fd42af919f47f181e932773 --- lib/nova_plugins/hypervisor-xenserver | 27 ++++++++++++++++++--------- tools/xen/xenrc | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/nova_plugins/hypervisor-xenserver b/lib/nova_plugins/hypervisor-xenserver index b053856348..0046a366c9 100644 --- a/lib/nova_plugins/hypervisor-xenserver +++ b/lib/nova_plugins/hypervisor-xenserver @@ -48,6 +48,21 @@ function configure_nova_hypervisor { if [ -z "$XENAPI_CONNECTION_URL" ]; then die $LINENO "XENAPI_CONNECTION_URL is not specified" fi + + # Check os-xenapi plugin is enabled + local plugins="${DEVSTACK_PLUGINS}" + local plugin + local found=0 + for plugin in ${plugins//,/ }; do + if [[ "$plugin" = "os-xenapi" ]]; then + found=1 + break + fi + done + if [[ $found -ne 1 ]]; then + die $LINENO "os-xenapi plugin is not specified. Please enable this plugin in local.conf" + fi + read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN." iniset $NOVA_CONF DEFAULT compute_driver "xenapi.XenAPIDriver" iniset $NOVA_CONF xenserver connection_url "$XENAPI_CONNECTION_URL" @@ -64,14 +79,6 @@ function configure_nova_hypervisor { local ssh_dom0 ssh_dom0="sudo -u $DOMZERO_USER ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$dom0_ip" - # Find where the plugins should go in dom0 - xen_functions=`cat $TOP_DIR/tools/xen/functions` - PLUGIN_DIR=`$ssh_dom0 "$xen_functions; set -eux; xapi_plugin_location"` - - # install nova plugins to dom0 - tar -czf - -C $NOVA_DIR/plugins/xenserver/xenapi/etc/xapi.d/plugins/ ./ | - $ssh_dom0 "tar -xzf - -C $PLUGIN_DIR && chmod a+x $PLUGIN_DIR/*" - # install console logrotate script tar -czf - -C $NOVA_DIR/tools/xenserver/ rotate_xen_guest_logs.sh | $ssh_dom0 'tar -xzf - -C /root/ && chmod +x /root/rotate_xen_guest_logs.sh && mkdir -p /var/log/xen/guest' @@ -107,7 +114,9 @@ CRONTAB # install_nova_hypervisor() - Install external components function install_nova_hypervisor { - pip_install_gr xenapi + # xenapi functionality is now included in os-xenapi library which houses the plugin + # so this function intentionally left blank + : } # start_nova_hypervisor - Start any required external services diff --git a/tools/xen/xenrc b/tools/xen/xenrc index bb27454e30..2161247b76 100644 --- a/tools/xen/xenrc +++ b/tools/xen/xenrc @@ -101,6 +101,7 @@ set +u ## Note that the lines below are coming from stackrc to support ## new-style config files +source $RC_DIR/functions-common # allow local overrides of env variables, including repo config if [[ -f $RC_DIR/localrc ]]; then