Add devstack-plugins in os-xenapi
When changed to use os-xenapi, we also need to change the way we install OpenStack by DevStack. This patch use the plugins mechanisem DevStack provided, we can install the extra/specific parts besides what DevStack already done. 1. Add devstack folder and scripts for devstack-plugin 2. Install Dom0 plugins 3. Add TODOs, we can configure XenServer+Neutron specific items in devstack-plugin in the future Change-Id: I6dc783eeb5c95e5fe81d907154aa2e880d6bac9e
This commit is contained in:
parent
1baf2e31e7
commit
53a513f34a
17
devstack/README.rst
Normal file
17
devstack/README.rst
Normal file
@ -0,0 +1,17 @@
|
||||
======================
|
||||
Enabling in Devstack
|
||||
======================
|
||||
|
||||
This plugin will help to install XenServer Dom0 specific scripts into
|
||||
XenServer Dom0 and make the proper configuration items for Neutron
|
||||
OpenvSwitch agent.
|
||||
|
||||
1. Download DevStack
|
||||
|
||||
2. Add this repo as an external repository::
|
||||
|
||||
local.conf
|
||||
[[local|localrc]]
|
||||
enable_plugin os-xenapi https://github.com/openstack/os-xenapi.git [GITREF]
|
||||
|
||||
3. run ``stack.sh``
|
11
devstack/dom0_functions
Normal file
11
devstack/dom0_functions
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
function dom0_plugin_location {
|
||||
for PLUGIN_DIR in "/etc/xapi.d/plugins/" "/usr/lib/xcp/plugins/" "/usr/lib/xapi/plugins" "/usr/lib64/xapi/plugins"; do
|
||||
if [ -d $PLUGIN_DIR ]; then
|
||||
echo $PLUGIN_DIR
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
85
devstack/plugin.sh
Executable file
85
devstack/plugin.sh
Executable file
@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2013 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
MODE=$1
|
||||
PHASE=$2
|
||||
|
||||
OS_XENAPI_DIR=$DEST/os-xenapi
|
||||
|
||||
function get_dom0_ssh {
|
||||
local dom0_ip
|
||||
dom0_ip=$(echo "$XENAPI_CONNECTION_URL" | cut -d "/" -f 3)
|
||||
|
||||
local ssh_dom0
|
||||
ssh_dom0="sudo -u $DOMZERO_USER ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$dom0_ip"
|
||||
echo $ssh_dom0
|
||||
return 0
|
||||
}
|
||||
|
||||
# Install Dom0 plugins
|
||||
function install_plugins {
|
||||
local ssh_dom0
|
||||
ssh_dom0=$(get_dom0_ssh)
|
||||
|
||||
local dom0_func
|
||||
dom0_func=`cat $OS_XENAPI_DIR/devstack/dom0_functions`
|
||||
local dom0_plugin_dir
|
||||
dom0_plugin_dir=`$ssh_dom0 "$dom0_func; set -eux; dom0_plugin_location"`
|
||||
|
||||
# Get the path that os-xenapi is installed or the path that nova source code resides
|
||||
# Note: This aims to be compatible whenever dom0 plugin is in os-xenapi repo or in nova repo
|
||||
local plugin_dir
|
||||
plugin_dir=$(sudo -H pip show os-xenapi |grep "Location:"|cut -d " " -f 2-)
|
||||
if [ -z "$plugin_dir" ]; then
|
||||
pip_install_gr xenapi
|
||||
plugin_dir=$DEST/nova
|
||||
tar -czf - -C $plugin_dir/plugins/xenserver/xenapi/etc/xapi.d/plugins/ ./ |
|
||||
$ssh_dom0 "tar -xzf - -C $dom0_plugin_dir && chmod a+x $dom0_plugin_dir/*"
|
||||
else
|
||||
tar -czf - -C $plugin_dir/os_xenapi/dom0/etc/xapi.d/plugins/ ./ |
|
||||
$ssh_dom0 "tar -xzf - -C $dom0_plugin_dir && chmod a+x $dom0_plugin_dir/*"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$MODE" == "stack" ]]; then
|
||||
case "$PHASE" in
|
||||
install)
|
||||
install_plugins
|
||||
;;
|
||||
post-config)
|
||||
# Called after the layer 1 and 2 services have been configured.
|
||||
# All configuration files for enabled services should exist at this point.
|
||||
# TODO(huanxie): when reverse q-agt/q-domua merged, q-domua is XS specific part
|
||||
# Configure XenServer neutron specific items for q-domua
|
||||
# ovs native mode
|
||||
# ovs VxLAN
|
||||
;;
|
||||
extra)
|
||||
;;
|
||||
test-config)
|
||||
# Called at the end of devstack used to configure tempest
|
||||
# or any other test environments
|
||||
# TODO(huanxie) Maybe we can set some conf here for CI?
|
||||
;;
|
||||
esac
|
||||
elif [[ "$MODE" == "clean" ]]; then
|
||||
# Called by clean.sh before other services are cleaned, but after unstack.sh has been called
|
||||
# TODO(huanxie)
|
||||
# Stop q-domua in the future?
|
||||
# clean the OVS bridge created in Dom0 and iptables rules?
|
||||
echo "mode is clean"
|
||||
fi
|
0
devstack/settings
Normal file
0
devstack/settings
Normal file
Loading…
x
Reference in New Issue
Block a user