Adding devstack plugin for freezer gate job

Currently the plugin is moslty a copy of the
freeer-api plugin. At first instance we can enable
the gate and have the job executign without error,
after this we can commit new changes to execute
freezer specific tests. Anyway the freezer-api plugin
is most likley needed to execute the freezer-agent and
freezer-scheduler tests

Implements bp: freezer-dsvm
Depends-on: I837e3fe973d72c792cb34711cef9f6507a004d49

Change-Id: Iee995d5b32c17c4dbee5f5736b26bf3b9aa8ca14
This commit is contained in:
Fausto Marzi 2016-01-18 09:23:19 +00:00
parent 8f4b53da68
commit 2ee22e041d
7 changed files with 265 additions and 0 deletions

22
devstack/README.rst Normal file
View File

@ -0,0 +1,22 @@
This directory contains the Freezer DevStack plugin.
To configure the Freezer scheduler and agent with DevStack, you will need to
enable this plugin by adding one line to the [[local|localrc]]
section of your local.conf file.
To enable the plugin, add a line of the form::
enable_plugin freezer <GITURL> [GITREF]
where::
<GITURL> is the URL of a freezer repository
[GITREF] is an optional git ref (branch/ref/tag). The default is master.
For example::
enable_plugin freezer https://git.openstack.org/openstack/freezer.git master
For more information, see:
http://docs.openstack.org/developer/devstack/plugins.html

21
devstack/gate_hook.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# (c) Copyright 2014,2015 Hewlett-Packard Development Company, L.P.
#
# 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.
set -ex
# Install freezer devstack integration
export DEVSTACK_LOCAL_CONFIG="enable_plugin freezer https://git.openstack.org/openstack/freezer"
$BASE/new/devstack-gate/devstack-vm-gate.sh

102
devstack/lib/freezer Normal file
View File

@ -0,0 +1,102 @@
#!/usr/bin/env bash
# (c) Copyright 2014,2015 Hewlett-Packard Development Company, L.P.
#
# 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.
# Install and start Freezer service
# add the following to localrc:
# enable_service freezer
#
# Dependencies:
# - functions
# - OS_AUTH_URL for auth in api
# - DEST set to the destination directory
# - SERVICE_PASSWORD, SERVICE_TENANT_NAME for auth in api
# - STACK_USER service user
# functions called by the plugin.sh script
# source plugin.sh <mode> [phase]
# ---------
# - <stack>
# - <stack> [pre-install]
# - <stack> [install]
# - install_freezer
# - <stack> [extra]
# - init_freezer_scheduler
# - start_freezer_scheduler
# - <unstack>
# - stop_freezer_scheduler
# - <clean>
# - cleanup_freezer_scheduler
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Functions
# ---------
function is_freezer_enabled {
[[ ,${ENABLED_SERVICES} =~ ,"freezer" ]] && return 0
}
# executed during: stack install
function install_freezer{
git_clone $FREEZER_REPO $FREEZER_DIR $FREEZER_BRANCH
setup_develop $FREEZER_DIR
}
# executed during: stack post-config
function configure_freezer_scheduler {
[ ! -d $FREEZER_CONF_DIR ] && sudo mkdir -m 755 -p $FREEZER_CONF_DIR
sudo chown $USER $FREEZER_CONF_DIR
[ ! -d $FREEZER_LOG_DIR ] && sudo mkdir -m 755 -p $FREEZER_LOG_DIR
sudo chown $USER $FREEZER_LOG_DIR
}
# executed during: stack extra
function init_freezer_scheduler {
# Add scheduler settings here
:
}
# executed during: stack extra
function start_freezer_scheduler {
# Add scheduler starts here
:
}
# executed during: stop
function stop_freezer_scheduler {
stop_process freezer-scheduler
}
# utility function
function get_id {
echo `"$@" | awk '/ id / { print $4 }'`
}
# Restore xtrace
$XTRACE

View File

@ -0,0 +1,31 @@
# (c) Copyright 2014,2015 Hewlett-Packard Development Company, L.P.
#
# 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.
[[local|localrc]]
disable_all_services
enable_plugin freezer https://git.openstack.org/openstack/freezer master
enable_service rabbit mysql key
# This is to keep the token small for testing
KEYSTONE_TOKEN_FORMAT=UUID
# Modify passwords as needed
DATABASE_PASSWORD=secretdatabase
RABBIT_PASSWORD=secretrabbit
ADMIN_PASSWORD=secretadmin
SERVICE_PASSWORD=secretservice
SERVICE_TOKEN=111222333444

37
devstack/plugin.sh Executable file
View File

@ -0,0 +1,37 @@
# (c) Copyright 2014,2015 Hewlett-Packard Development Company, L.P.
#
# 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.
# check for service enabled
if is_service_enabled freezer; then
if [[ "$1" == "source" || "`type -t install_freezer`" != 'function' ]]; then
# Initial source
source $FREEZER_DIR/devstack/lib/freezer
fi
if [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing Freezer"
install_freezer
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring Freezer"
configure_freezer
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
echo_summary "Initializing Freezer Scheduler"
init_freezer_scheduler
start_freezer_scheduler
fi
if [[ "$1" == "unstack" ]]; then
stop_freezer_scheduler
fi
fi

28
devstack/settings Normal file
View File

@ -0,0 +1,28 @@
# (c) Copyright 2014,2015 Hewlett-Packard Development Company, L.P.
#
# 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.
# Defaults
# --------
# Set up default directories
FREEZER_DIR=$DEST/freezer
FREEZER_FILES=${FREEZER_API_DIR}/devstack/files
FREEZER_CONF_DIR=${FREEZER_CONF_DIR:-/etc}
FREEZER_LOG_DIR=$DEST/logs
# Freezer API repository
FREEZER_REPO=${FREEZER_REPO:-${GIT_BASE}/stackforge/freezer.git}
FREEZER_BRANCH=${FREEZER_BRANCH:-master}
enable_service freezer

24
tests/post_test_hook.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
#(c) Copyright 2014,2015 Hewlett-Packard Development Company, L.P.
#
# 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.
# This script is executed inside post_test_hook function in devstack gate.
# Install packages from test-requirements.txt
sudo pip install -r /opt/stack/new/freezer-api/test-requirements.txt
cd /opt/stack/new/freezer-api/tests
echo 'Running freezer integration tests'
# Here it goes the command to execute integration tests
# sudo ./run_tests.sh