update higgins with zun

All contents mentioning higgins are updated to zun
using below 3 patterns:
:%s/higgins/zun/g
:%s/HIGGINS/ZUN/g
:%s/Higgins/Zun/g

Co-Authored-By: Hongbin Lu <hongbin.lu@huawei.com>

Change-Id: I33a979aa01421524c1cff6fb5cc2b4023bf1fe84
This commit is contained in:
root 2016-06-07 13:12:22 +05:30 committed by Hongbin Lu
parent 507d781e7c
commit 5f2a016ea3
93 changed files with 747 additions and 747 deletions

2
.gitignore vendored
View File

@ -58,4 +58,4 @@ ChangeLog
releasenotes/build
# generated config file
etc/higgins/higgins.conf.sample
etc/zun/zun.conf.sample

View File

@ -2,6 +2,6 @@
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-45} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./higgins/tests/unit} $LISTOPT $IDOPTION
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./zun/tests/unit} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -14,4 +14,4 @@ Pull requests submitted through GitHub will be ignored.
Bugs should be filed on Launchpad, not GitHub:
https://bugs.launchpad.net/higgins
https://bugs.launchpad.net/zun

View File

@ -1,10 +1,10 @@
Higgins Style Commandments
==========================
Zun Style Commandments
======================
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/
Higgins Specific Commandments
-----------------------------
Zun Specific Commandments
-------------------------
- [M302] Change assertEqual(A is not None) by optimal assert like
assertIsNotNone(A).

View File

@ -1,6 +1,6 @@
=======
Higgins
=======
===
Zun
===
Container Management service for OpenStack
@ -9,11 +9,11 @@ Please fill here a long description which must be at least 3 lines wrapped on
Note that this is a hard requirement.
* Free software: Apache license
* Documentation: http://docs.openstack.org/developer/higgins
* Documentation: http://docs.openstack.org/developer/zun
* Source: http://git.openstack.org/cgit/openstack/higgins
* Bugs: http://bugs.launchpad.net/python-higgins
* Blueprints:** https://blueprints.launchpad.net/higgins
* REST Client:** http://git.openstack.org/cgit/openstack/python-higginsclient
* Bugs: http://bugs.launchpad.net/zun
* Blueprints:** https://blueprints.launchpad.net/zun
* REST Client:** http://git.openstack.org/cgit/openstack/python-zunclient
Features
--------

View File

@ -2,18 +2,18 @@
DevStack Integration
====================
This directory contains the files necessary to integrate higgins with devstack.
This directory contains the files necessary to integrate zun with devstack.
Refer the quickstart guide at
https://github.com/openstack/higgins/blob/master/doc/source/dev/quickstart.rst
for more information on using devstack and higgins.
for more information on using devstack and zun.
To install higgins into devstack, add the following settings to enable the
higgins plugin::
To install zun into devstack, add the following settings to enable the
zun plugin::
cat > /opt/stack/devstack/local.conf << END
[[local|localrc]]
enable_plugin higgins https://git.openstack.org/openstack/higgins master
enable_plugin zun https://git.openstack.org/openstack/higgins master
END
Then run devstack normally::

View File

@ -1,268 +0,0 @@
#!/bin/bash
#
# lib/higgins
# Functions to control the configuration and operation of the **higgins** service
# Dependencies:
#
# - ``functions`` file
# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
# - ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined
# ``stack.sh`` calls the entry points in this order:
#
# - install_higgins
# - configure_higgins
# - create_higgins_conf
# - create_higgins_accounts
# - init_higgins
# - start_higgins
# - stop_higgins
# - cleanup_higgins
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Defaults
# --------
# Set up default directories
HIGGINS_REPO=${HIGGINS_REPO:-${GIT_BASE}/openstack/higgins.git}
HIGGINS_BRANCH=${HIGGINS_BRANCH:-master}
HIGGINS_DIR=$DEST/higgins
HIGGINS_STATE_PATH=${HIGGINS_STATE_PATH:=$DATA_DIR/higgins}
HIGGINS_AUTH_CACHE_DIR=${HIGGINS_AUTH_CACHE_DIR:-/var/cache/higgins}
HIGGINS_CONF_DIR=/etc/higgins
HIGGINS_CONF=$HIGGINS_CONF_DIR/higgins.conf
HIGGINS_POLICY_JSON=$HIGGINS_CONF_DIR/policy.json
HIGGINS_API_PASTE=$HIGGINS_CONF_DIR/api-paste.ini
if is_ssl_enabled_service "higgins" || is_service_enabled tls-proxy; then
HIGGINS_SERVICE_PROTOCOL="https"
fi
# Public facing bits
HIGGINS_SERVICE_HOST=${HIGGINS_SERVICE_HOST:-$HOST_IP}
HIGGINS_SERVICE_PORT=${HIGGINS_SERVICE_PORT:-9517}
HIGGINS_SERVICE_PORT_INT=${HIGGINS_SERVICE_PORT_INT:-19517}
HIGGINS_SERVICE_PROTOCOL=${HIGGINS_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
HIGGINS_TRUSTEE_DOMAIN_ADMIN_PASSWORD=${HIGGINS_TRUSTEE_DOMAIN_ADMIN_PASSWORD:-secret}
# Support entry points installation of console scripts
if [[ -d $HIGGINS_DIR/bin ]]; then
HIGGINS_BIN_DIR=$HIGGINS_DIR/bin
else
HIGGINS_BIN_DIR=$(get_python_exec_prefix)
fi
# Functions
# ---------
# Test if any higgins services are enabled
# is_higgins_enabled
function is_higgins_enabled {
[[ ,${ENABLED_SERVICES} =~ ,"higgins-" ]] && return 0
return 1
}
# cleanup_higgins() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_higgins {
sudo rm -rf $HIGGINS_STATE_PATH $HIGGINS_AUTH_CACHE_DIR
}
# configure_higgins() - Set config files, create data dirs, etc
function configure_higgins {
# Put config files in ``/etc/higgins`` for everyone to find
if [[ ! -d $HIGGINS_CONF_DIR ]]; then
sudo mkdir -p $HIGGINS_CONF_DIR
sudo chown $STACK_USER $HIGGINS_CONF_DIR
fi
install_default_policy higgins
# Rebuild the config file from scratch
create_higgins_conf
create_api_paste_conf
}
# create_higgins_accounts() - Set up common required HIGGINS accounts
#
# Project User Roles
# ------------------------------------------------------------------
# SERVICE_PROJECT_NAME higgins service
function create_higgins_accounts {
create_service_user "higgins" "admin"
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
local higgins_service=$(get_or_create_service "higgins" \
"container" "Container As Service")
get_or_create_endpoint $higgins_service \
"$REGION_NAME" \
"$HIGGINS_SERVICE_PROTOCOL://$HIGGINS_SERVICE_HOST:$HIGGINS_SERVICE_PORT/v1" \
"$HIGGINS_SERVICE_PROTOCOL://$HIGGINS_SERVICE_HOST:$HIGGINS_SERVICE_PORT/v1" \
"$HIGGINS_SERVICE_PROTOCOL://$HIGGINS_SERVICE_HOST:$HIGGINS_SERVICE_PORT/v1"
fi
}
# create_higgins_conf() - Create a new higgins.conf file
function create_higgins_conf {
# (Re)create ``higgins.conf``
rm -f $HIGGINS_CONF
iniset $HIGGINS_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
iniset $HIGGINS_CONF oslo_messaging_rabbit rabbit_userid $RABBIT_USERID
iniset $HIGGINS_CONF oslo_messaging_rabbit rabbit_password $RABBIT_PASSWORD
iniset $HIGGINS_CONF oslo_messaging_rabbit rabbit_host $RABBIT_HOST
iniset $HIGGINS_CONF database connection `database_connection_url higgins`
iniset $HIGGINS_CONF api host "$HIGGINS_SERVICE_HOST"
iniset $HIGGINS_CONF api port "$HIGGINS_SERVICE_PORT"
iniset $HIGGINS_CONF oslo_policy policy_file $HIGGINS_POLICY_JSON
iniset $HIGGINS_CONF keystone_auth auth_type password
iniset $HIGGINS_CONF keystone_auth username higgins
iniset $HIGGINS_CONF keystone_auth password $SERVICE_PASSWORD
iniset $HIGGINS_CONF keystone_auth project_name $SERVICE_PROJECT_NAME
iniset $HIGGINS_CONF keystone_auth project_domain_id default
iniset $HIGGINS_CONF keystone_auth user_domain_id default
# FIXME(pauloewerton): keystone_authtoken section is deprecated. Remove it
# after deprecation period.
iniset $HIGGINS_CONF keystone_authtoken admin_user higgins
iniset $HIGGINS_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
iniset $HIGGINS_CONF keystone_authtoken admin_tenant_name $SERVICE_PROJECT_NAME
configure_auth_token_middleware $HIGGINS_CONF higgins $HIGGINS_AUTH_CACHE_DIR
iniset $HIGGINS_CONF keystone_auth auth_url $KEYSTONE_SERVICE_URI/v3
iniset $HIGGINS_CONF keystone_authtoken auth_uri \
${KEYSTONE_SERVICE_PROTOCOL}://${HOST_IP}:${KEYSTONE_SERVICE_PORT}/v3
iniset $HIGGINS_CONF keystone_authtoken auth_version v3
if is_fedora || is_suse; then
# higgins defaults to /usr/local/bin, but fedora and suse pip like to
# install things in /usr/bin
iniset $HIGGINS_CONF DEFAULT bindir "/usr/bin"
fi
if [ -n "$HIGGINS_STATE_PATH" ]; then
iniset $HIGGINS_CONF DEFAULT state_path "$HIGGINS_STATE_PATH"
iniset $HIGGINS_CONF oslo_concurrency lock_path "$HIGGINS_STATE_PATH"
fi
if [ "$SYSLOG" != "False" ]; then
iniset $HIGGINS_CONF DEFAULT use_syslog "True"
fi
# Format logging
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
setup_colorized_logging $HIGGINS_CONF DEFAULT
else
# Show user_name and project_name instead of user_id and project_id
iniset $HIGGINS_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
fi
# Register SSL certificates if provided
if is_ssl_enabled_service higgins; then
ensure_certificates higgins
iniset $HIGGINS_CONF DEFAULT ssl_cert_file "$HIGGINS_SSL_CERT"
iniset $HIGGINS_CONF DEFAULT ssl_key_file "$HIGGINS_SSL_KEY"
iniset $HIGGINS_CONF DEFAULT enabled_ssl_apis "$HIGGINS_ENABLED_APIS"
fi
}
function create_api_paste_conf {
# copy api_paste.ini
cp $HIGGINS_DIR/etc/higgins/api-paste.ini $HIGGINS_API_PASTE
}
# create_higgins_cache_dir() - Part of the init_HIGGINS() process
function create_higgins_cache_dir {
# Create cache dir
sudo mkdir -p $HIGGINS_AUTH_CACHE_DIR
sudo chown $STACK_USER $HIGGINS_AUTH_CACHE_DIR
rm -f $HIGGINS_AUTH_CACHE_DIR/*
}
# init_higgins() - Initialize databases, etc.
function init_higgins {
# Only do this step once on the API node for an entire cluster.
if is_service_enabled $DATABASE_BACKENDS && is_service_enabled higgins-api; then
# (Re)create higgins database
recreate_database higgins
# Migrate higgins database
$HIGGINS_BIN_DIR/higgins-db-manage upgrade
fi
create_higgins_cache_dir
}
# install_higginsclient() - Collect source and prepare
function install_higginsclient {
if use_library_from_git "python-higginsclient"; then
echo "we don't have CLI yet.."
#git_clone_by_name "python-higginsclient"
#setup_dev_lib "python-higginsclient"
fi
}
# install_higgins() - Collect source and prepare
function install_higgins {
git_clone $HIGGINS_REPO $HIGGINS_DIR $HIGGINS_BRANCH
setup_develop $HIGGINS_DIR
}
# start_higgins_api() - Start the API process ahead of other things
function start_higgins_api {
# Get right service port for testing
local service_port=$HIGGINS_SERVICE_PORT
local service_protocol=$HIGGINS_SERVICE_PROTOCOL
if is_service_enabled tls-proxy; then
service_port=$HIGGINS_SERVICE_PORT_INT
service_protocol="http"
fi
run_process higgins-api "$HIGGINS_BIN_DIR/higgins-api"
echo "Waiting for higgins-api to start..."
if ! wait_for_service $SERVICE_TIMEOUT $service_protocol://$HIGGINS_SERVICE_HOST:$service_port; then
die $LINENO "higgins-api did not start"
fi
# Start proxies if enabled
if is_service_enabled tls-proxy; then
start_tls_proxy '*' $HIGGINS_SERVICE_PORT $HIGGINS_SERVICE_HOST $HIGGINS_SERVICE_PORT_INT &
fi
}
# start_higgins() - Start running processes, including screen
function start_higgins {
# ``run_process`` checks ``is_service_enabled``, it is not needed here
start_higgins_api
run_process higgins-conductor "$HIGGINS_BIN_DIR/higgins-conductor"
}
# stop_higgins() - Stop running processes (non-screen)
function stop_higgins {
for serv in higgins-api higgins-conductor; do
stop_process $serv
done
}
# Restore xtrace
$XTRACE

268
devstack/lib/zun Normal file
View File

@ -0,0 +1,268 @@
#!/bin/bash
#
# lib/zun
# Functions to control the configuration and operation of the **zun** service
# Dependencies:
#
# - ``functions`` file
# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
# - ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined
# ``stack.sh`` calls the entry points in this order:
#
# - install_zun
# - configure_zun
# - create_zun_conf
# - create_zun_accounts
# - init_zun
# - start_zun
# - stop_zun
# - cleanup_zun
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Defaults
# --------
# Set up default directories
ZUN_REPO=${ZUN_REPO:-${GIT_BASE}/openstack/higgins.git}
ZUN_BRANCH=${ZUN_BRANCH:-master}
ZUN_DIR=$DEST/higgins
ZUN_STATE_PATH=${ZUN_STATE_PATH:=$DATA_DIR/zun}
ZUN_AUTH_CACHE_DIR=${ZUN_AUTH_CACHE_DIR:-/var/cache/zun}
ZUN_CONF_DIR=/etc/zun
ZUN_CONF=$ZUN_CONF_DIR/zun.conf
ZUN_POLICY_JSON=$ZUN_CONF_DIR/policy.json
ZUN_API_PASTE=$ZUN_CONF_DIR/api-paste.ini
if is_ssl_enabled_service "zun" || is_service_enabled tls-proxy; then
ZUN_SERVICE_PROTOCOL="https"
fi
# Public facing bits
ZUN_SERVICE_HOST=${ZUN_SERVICE_HOST:-$HOST_IP}
ZUN_SERVICE_PORT=${ZUN_SERVICE_PORT:-9517}
ZUN_SERVICE_PORT_INT=${ZUN_SERVICE_PORT_INT:-19517}
ZUN_SERVICE_PROTOCOL=${ZUN_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
ZUN_TRUSTEE_DOMAIN_ADMIN_PASSWORD=${ZUN_TRUSTEE_DOMAIN_ADMIN_PASSWORD:-secret}
# Support entry points installation of console scripts
if [[ -d $ZUN_DIR/bin ]]; then
ZUN_BIN_DIR=$ZUN_DIR/bin
else
ZUN_BIN_DIR=$(get_python_exec_prefix)
fi
# Functions
# ---------
# Test if any zun services are enabled
# is_zun_enabled
function is_zun_enabled {
[[ ,${ENABLED_SERVICES} =~ ,"zun-" ]] && return 0
return 1
}
# cleanup_zun() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_zun {
sudo rm -rf $ZUN_STATE_PATH $ZUN_AUTH_CACHE_DIR
}
# configure_zun() - Set config files, create data dirs, etc
function configure_zun {
# Put config files in ``/etc/zun`` for everyone to find
if [[ ! -d $ZUN_CONF_DIR ]]; then
sudo mkdir -p $ZUN_CONF_DIR
sudo chown $STACK_USER $ZUN_CONF_DIR
fi
install_default_policy zun
# Rebuild the config file from scratch
create_zun_conf
create_api_paste_conf
}
# create_zun_accounts() - Set up common required ZUN accounts
#
# Project User Roles
# ------------------------------------------------------------------
# SERVICE_PROJECT_NAME zun service
function create_zun_accounts {
create_service_user "zun" "admin"
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
local zun_service=$(get_or_create_service "zun" \
"container" "Container As Service")
get_or_create_endpoint $zun_service \
"$REGION_NAME" \
"$ZUN_SERVICE_PROTOCOL://$ZUN_SERVICE_HOST:$ZUN_SERVICE_PORT/v1" \
"$ZUN_SERVICE_PROTOCOL://$ZUN_SERVICE_HOST:$ZUN_SERVICE_PORT/v1" \
"$ZUN_SERVICE_PROTOCOL://$ZUN_SERVICE_HOST:$ZUN_SERVICE_PORT/v1"
fi
}
# create_zun_conf() - Create a new zun.conf file
function create_zun_conf {
# (Re)create ``zun.conf``
rm -f $ZUN_CONF
iniset $ZUN_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
iniset $ZUN_CONF oslo_messaging_rabbit rabbit_userid $RABBIT_USERID
iniset $ZUN_CONF oslo_messaging_rabbit rabbit_password $RABBIT_PASSWORD
iniset $ZUN_CONF oslo_messaging_rabbit rabbit_host $RABBIT_HOST
iniset $ZUN_CONF database connection `database_connection_url zun`
iniset $ZUN_CONF api host "$ZUN_SERVICE_HOST"
iniset $ZUN_CONF api port "$ZUN_SERVICE_PORT"
iniset $ZUN_CONF oslo_policy policy_file $ZUN_POLICY_JSON
iniset $ZUN_CONF keystone_auth auth_type password
iniset $ZUN_CONF keystone_auth username zun
iniset $ZUN_CONF keystone_auth password $SERVICE_PASSWORD
iniset $ZUN_CONF keystone_auth project_name $SERVICE_PROJECT_NAME
iniset $ZUN_CONF keystone_auth project_domain_id default
iniset $ZUN_CONF keystone_auth user_domain_id default
# FIXME(pauloewerton): keystone_authtoken section is deprecated. Remove it
# after deprecation period.
iniset $ZUN_CONF keystone_authtoken admin_user zun
iniset $ZUN_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
iniset $ZUN_CONF keystone_authtoken admin_tenant_name $SERVICE_PROJECT_NAME
configure_auth_token_middleware $ZUN_CONF zun $ZUN_AUTH_CACHE_DIR
iniset $ZUN_CONF keystone_auth auth_url $KEYSTONE_SERVICE_URI/v3
iniset $ZUN_CONF keystone_authtoken auth_uri \
${KEYSTONE_SERVICE_PROTOCOL}://${HOST_IP}:${KEYSTONE_SERVICE_PORT}/v3
iniset $ZUN_CONF keystone_authtoken auth_version v3
if is_fedora || is_suse; then
# zun defaults to /usr/local/bin, but fedora and suse pip like to
# install things in /usr/bin
iniset $ZUN_CONF DEFAULT bindir "/usr/bin"
fi
if [ -n "$ZUN_STATE_PATH" ]; then
iniset $ZUN_CONF DEFAULT state_path "$ZUN_STATE_PATH"
iniset $ZUN_CONF oslo_concurrency lock_path "$ZUN_STATE_PATH"
fi
if [ "$SYSLOG" != "False" ]; then
iniset $ZUN_CONF DEFAULT use_syslog "True"
fi
# Format logging
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
setup_colorized_logging $ZUN_CONF DEFAULT
else
# Show user_name and project_name instead of user_id and project_id
iniset $ZUN_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
fi
# Register SSL certificates if provided
if is_ssl_enabled_service zun; then
ensure_certificates zun
iniset $ZUN_CONF DEFAULT ssl_cert_file "$ZUN_SSL_CERT"
iniset $ZUN_CONF DEFAULT ssl_key_file "$ZUN_SSL_KEY"
iniset $ZUN_CONF DEFAULT enabled_ssl_apis "$ZUN_ENABLED_APIS"
fi
}
function create_api_paste_conf {
# copy api_paste.ini
cp $ZUN_DIR/etc/zun/api-paste.ini $ZUN_API_PASTE
}
# create_zun_cache_dir() - Part of the init_ZUN() process
function create_zun_cache_dir {
# Create cache dir
sudo mkdir -p $ZUN_AUTH_CACHE_DIR
sudo chown $STACK_USER $ZUN_AUTH_CACHE_DIR
rm -f $ZUN_AUTH_CACHE_DIR/*
}
# init_zun() - Initialize databases, etc.
function init_zun {
# Only do this step once on the API node for an entire cluster.
if is_service_enabled $DATABASE_BACKENDS && is_service_enabled zun-api; then
# (Re)create zun database
recreate_database zun
# Migrate zun database
$ZUN_BIN_DIR/zun-db-manage upgrade
fi
create_zun_cache_dir
}
# install_zunclient() - Collect source and prepare
function install_zunclient {
if use_library_from_git "python-zunclient"; then
echo "we don't have CLI yet.."
#git_clone_by_name "python-zunclient"
#setup_dev_lib "python-zunclient"
fi
}
# install_zun() - Collect source and prepare
function install_zun {
git_clone $ZUN_REPO $ZUN_DIR $ZUN_BRANCH
setup_develop $ZUN_DIR
}
# start_zun_api() - Start the API process ahead of other things
function start_zun_api {
# Get right service port for testing
local service_port=$ZUN_SERVICE_PORT
local service_protocol=$ZUN_SERVICE_PROTOCOL
if is_service_enabled tls-proxy; then
service_port=$ZUN_SERVICE_PORT_INT
service_protocol="http"
fi
run_process zun-api "$ZUN_BIN_DIR/zun-api"
echo "Waiting for zun-api to start..."
if ! wait_for_service $SERVICE_TIMEOUT $service_protocol://$ZUN_SERVICE_HOST:$service_port; then
die $LINENO "zun-api did not start"
fi
# Start proxies if enabled
if is_service_enabled tls-proxy; then
start_tls_proxy '*' $ZUN_SERVICE_PORT $ZUN_SERVICE_HOST $ZUN_SERVICE_PORT_INT &
fi
}
# start_zun() - Start running processes, including screen
function start_zun {
# ``run_process`` checks ``is_service_enabled``, it is not needed here
start_zun_api
run_process zun-conductor "$ZUN_BIN_DIR/zun-conductor"
}
# stop_zun() - Stop running processes (non-screen)
function stop_zun {
for serv in zun-api zun-conductor; do
stop_process $serv
done
}
# Restore xtrace
$XTRACE

View File

@ -1,47 +1,47 @@
# higgins - Devstack extras script to install higgins
# zun - Devstack extras script to install zun
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set -o xtrace
echo_summary "higgins's plugin.sh was called..."
source $DEST/higgins/devstack/lib/higgins
echo_summary "zun's plugin.sh was called..."
source $DEST/higgins/devstack/lib/zun
(set -o posix; set)
if is_service_enabled higgins-api higgins-conductor; then
if is_service_enabled zun-api zun-conductor; then
if [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing higgins"
install_higgins
echo_summary "Installing zun"
install_zun
# TODO
# LIBS_FROM_GIT="${LIBS_FROM_GIT},python-higginsclient"
# install_higginsclient
# LIBS_FROM_GIT="${LIBS_FROM_GIT},python-zunclient"
# install_zunclient
cleanup_higgins
cleanup_zun
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring higgins"
configure_higgins
echo_summary "Configuring zun"
configure_zun
if is_service_enabled key; then
create_higgins_accounts
create_zun_accounts
fi
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize higgins
init_higgins
# Initialize zun
init_zun
# Start the higgins API and higgins conductor
echo_summary "Starting higgins"
start_higgins
# Start the zun API and zun conductor
echo_summary "Starting zun"
start_zun
fi
if [[ "$1" == "unstack" ]]; then
stop_higgins
stop_zun
fi
if [[ "$1" == "clean" ]]; then
cleanup_higgins
cleanup_zun
fi
fi

View File

@ -15,6 +15,6 @@
# PHYSICAL_NETWORK=public
# OVS_PHYSICAL_BRIDGE=br-ex
# Enable Higgins services
enable_service higgins-api
enable_service higgins-conductor
# Enable Zun services
enable_service zun-api
enable_service zun-conductor

View File

@ -36,7 +36,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'higgins'
project = u'zun'
copyright = u'2013, OpenStack Foundation'
# If true, '()' will be appended to :func: etc. cross-reference text.

View File

@ -4,7 +4,7 @@
Developer Quick-Start
=====================
This is a quick walkthrough to get you started developing code for Higgins.
This is a quick walkthrough to get you started developing code for Zun.
This assumes you are already familiar with submitting code reviews to
an OpenStack project.
@ -36,14 +36,14 @@ upgrade it individually, if you need to::
sudo pip install -U virtualenv
Higgins source code should be pulled directly from git::
Zun source code should be pulled directly from git::
# from your home or source directory
cd ~
git clone https://git.openstack.org/openstack/higgins
cd higgins
cd zun
All unit tests should be run using tox. To run Higgins's entire test suite::
All unit tests should be run using tox. To run Zun's entire test suite::
# run all tests (unit and pep8)
tox
@ -86,7 +86,7 @@ required OpenStack services::
SERVICE_TOKEN=password
SERVICE_PASSWORD=password
ADMIN_PASSWORD=password
# higgins requires the following to be set correctly
# zun requires the following to be set correctly
PUBLIC_INTERFACE=eth1
END
@ -109,79 +109,79 @@ script::
source /opt/stack/devstack/openrc admin admin
Create a database in MySQL for higgins::
Create a database in MySQL for zun::
mysql -h 127.0.0.1 -u root -ppassword mysql <<EOF
CREATE DATABASE IF NOT EXISTS higgins DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON higgins.* TO
CREATE DATABASE IF NOT EXISTS zun DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON zun.* TO
'root'@'%' IDENTIFIED BY 'password'
EOF
Clone and install higgins::
Clone and install zun::
cd ~
git clone https://git.openstack.org/openstack/higgins
cd higgins
cd zun
sudo pip install -e .
Configure higgins::
Configure zun::
# create the higgins conf directory
sudo mkdir -p /etc/higgins
sudo chown -R ${USER} /etc/higgins/
HIGGINS_CONF=/etc/higgins/higgins.conf
# create the zun conf directory
sudo mkdir -p /etc/zun
sudo chown -R ${USER} /etc/zun/
ZUN_CONF=/etc/zun/zun.conf
# generate sample config file and modify it as necessary
tox -egenconfig
sudo cp etc/higgins/higgins.conf.sample /etc/higgins/higgins.conf
sudo cp etc/zun/zun.conf.sample /etc/zun/zun.conf
# copy policy.json
sudo cp etc/higgins/policy.json /etc/higgins/policy.json
sudo cp etc/zun/policy.json /etc/zun/policy.json
# enable debugging output
sudo sed -i "s/#debug\s*=.*/debug=true/" $HIGGINS_CONF
sudo sed -i "s/#debug\s*=.*/debug=true/" $ZUN_CONF
# set RabbitMQ userid
sudo sed -i "s/#rabbit_userid\s*=.*/rabbit_userid=stackrabbit/" \
$HIGGINS_CONF
$ZUN_CONF
# set RabbitMQ password
sudo sed -i "s/#rabbit_password\s*=.*/rabbit_password=password/" \
$HIGGINS_CONF
$ZUN_CONF
# set SQLAlchemy connection string to connect to MySQL
sudo sed -i "s/#connection\s*=.*/connection=mysql:\/\/root:password@localhost\/higgins/" \
$HIGGINS_CONF
sudo sed -i "s/#connection\s*=.*/connection=mysql:\/\/root:password@localhost\/zun/" \
$ZUN_CONF
# set keystone_auth
source /opt/stack/devstack/openrc admin admin
iniset $HIGGINS_CONF keystone_auth auth_type password
iniset $HIGGINS_CONF keystone_auth username higgins
iniset $HIGGINS_CONF keystone_auth password password
iniset $HIGGINS_CONF keystone_auth project_name service
iniset $HIGGINS_CONF keystone_auth project_domain_id default
iniset $HIGGINS_CONF keystone_auth user_domain_id default
iniset $HIGGINS_CONF keystone_auth auth_url ${OS_AUTH_URL/v2.0/v3}
iniset $ZUN_CONF keystone_auth auth_type password
iniset $ZUN_CONF keystone_auth username zun
iniset $ZUN_CONF keystone_auth password password
iniset $ZUN_CONF keystone_auth project_name service
iniset $ZUN_CONF keystone_auth project_domain_id default
iniset $ZUN_CONF keystone_auth user_domain_id default
iniset $ZUN_CONF keystone_auth auth_url ${OS_AUTH_URL/v2.0/v3}
# NOTE: keystone_authtoken section is deprecated and will be removed.
iniset $HIGGINS_CONF keystone_authtoken admin_user higgins
iniset $HIGGINS_CONF keystone_authtoken admin_password password
iniset $HIGGINS_CONF keystone_authtoken admin_tenant_name service
iniset $HIGGINS_CONF keystone_authtoken auth_uri ${OS_AUTH_URL/v2.0/v3}
iniset $HIGGINS_CONF keystone_authtoken auth_version v3
iniset $ZUN_CONF keystone_authtoken admin_user zun
iniset $ZUN_CONF keystone_authtoken admin_password password
iniset $ZUN_CONF keystone_authtoken admin_tenant_name service
iniset $ZUN_CONF keystone_authtoken auth_uri ${OS_AUTH_URL/v2.0/v3}
iniset $ZUN_CONF keystone_authtoken auth_version v3
Configure the database for use with higgins. Please note that DB migration
Configure the database for use with zun. Please note that DB migration
does not work for SQLite backend. The SQLite database does not
have any support for the ALTER statement needed by relational schema
based migration tools. Hence DB Migration will not work for SQLite
backend::
higgins-db-manage upgrade
zun-db-manage upgrade
Configure the keystone endpoint::
openstack service create --name=higgins \
--description="Higgins Container Service" \
openstack service create --name=zun \
--description="Zun Container Service" \
container
openstack endpoint create --publicurl http://127.0.0.1:9512/v1 \
--adminurl http://127.0.0.1:9512/v1 \
@ -191,10 +191,10 @@ Configure the keystone endpoint::
Start the API service in a new screen::
higgins-api
zun-api
Start the conductor service in a new screen::
higgins-conductor
zun-conductor
Higgins should now be up and running!
Zun should now be up and running!

View File

@ -1,10 +1,10 @@
.. higgins documentation master file, created by
.. zun documentation master file, created by
sphinx-quickstart on Tue Jul 9 22:26:36 2013.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Higgins's documentation!
========================================================
Welcome to Zun's documentation!
===============================
Contents:

View File

@ -4,9 +4,9 @@ Installation
At the command line::
$ pip install higgins
$ pip install zun
Or, if you have virtualenvwrapper installed::
$ mkvirtualenv higgins
$ pip install higgins
$ mkvirtualenv zun
$ pip install zun

View File

@ -1,7 +1,7 @@
========
=====
Usage
========
=====
To use higgins in a project::
To use zun in a project::
import higgins
import zun

View File

@ -1,73 +0,0 @@
# 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.
import mock
from higgins.common.rpc_service import CONF
from higgins import objects
from higgins.servicegroup import higgins_service_periodic as periodic
from higgins.tests import base
class HigginsServicePeriodicTestCase(base.BaseTestCase):
def setUp(self):
super(HigginsServicePeriodicTestCase, self).setUp()
mock_higgins_service_refresh = mock.Mock()
class FakeSrv(object):
report_state_up = mock_higgins_service_refresh
self.fake_srv = FakeSrv()
self.fake_srv_refresh = mock_higgins_service_refresh
@mock.patch.object(objects.HigginsService, 'get_by_host_and_binary')
@mock.patch.object(objects.HigginsService, 'create')
@mock.patch.object(objects.HigginsService, 'report_state_up')
def test_update_higgins_service_firsttime(self,
mock_srv_refresh,
mock_srv_create,
mock_srv_get
):
p_task = periodic.HigginsServicePeriodicTasks(CONF,
'fake-conductor')
mock_srv_get.return_value = None
p_task.update_higgins_service(None)
mock_srv_get.assert_called_once_with(mock.ANY, p_task.host,
p_task.binary)
mock_srv_create.assert_called_once_with()
mock_srv_refresh.assert_called_once_with()
@mock.patch.object(objects.HigginsService, 'get_by_host_and_binary')
@mock.patch.object(objects.HigginsService, 'create')
def test_update_higgins_service_on_restart(self,
mock_srv_create,
mock_srv_get):
p_task = periodic.HigginsServicePeriodicTasks(CONF,
'fake-conductor')
mock_srv_get.return_value = self.fake_srv
p_task.update_higgins_service(None)
mock_srv_get.assert_called_once_with(mock.ANY, p_task.host,
p_task.binary)
self.fake_srv_refresh.assert_called_once_with()
def test_update_higgins_service_regular(self):
p_task = periodic.HigginsServicePeriodicTasks(CONF,
'fake-conductor')
p_task.higgins_service_ref = self.fake_srv
p_task.update_higgins_service(None)
self.fake_srv_refresh.assert_called_once_with()

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Higgins Release Notes documentation build configuration file, created by
# Zun Release Notes documentation build configuration file, created by
# sphinx-quickstart on Sat May 14 17:02:44 2016.
#
# This file is execfile()d with the current directory set to its
@ -55,19 +55,19 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'Higgins Release Notes'
copyright = u'2016, Higgins Developers'
project = u'Zun Release Notes'
copyright = u'2016, Zun Developers'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
from higgins.version import version_info as higgins_version
from zun.version import version_info as zun_version
# The full version, including alpha/beta/rc tags.
release = higgins_version.version_string_with_vcs()
release = zun_version.version_string_with_vcs()
# The short X.Y version.
version = higgins_version.canonical_version_string()
version = zun_version.canonical_version_string()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -190,7 +190,7 @@ html_static_path = ['_static']
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'HigginsReleaseNotesdoc'
htmlhelp_basename = 'ZunReleaseNotesdoc'
# -- Options for LaTeX output ---------------------------------------------
@ -210,9 +210,9 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'HigginsReleaseNotes.tex',
u'Higgins Release Notes Documentation',
u'Higgins Developers', 'manual'),
('index', 'ZunReleaseNotes.tex',
u'Zun Release Notes Documentation',
u'Zun Developers', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@ -241,8 +241,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'higginsreleasenotes', u'Higgins Release Notes Documentation',
[u'Higgins Developers'], 1)
('index', 'zunreleasenotes', u'Zun Release Notes Documentation',
[u'Zun Developers'], 1)
]
# If true, show URL addresses after external links.
@ -255,8 +255,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'HigginsReleaseNotes', u'Higgins Release Notes Documentation',
u'Higgins Developers', 'HigginsReleaseNotes',
('index', 'ZunReleaseNotes', u'Zun Release Notes Documentation',
u'Zun Developers', 'ZunReleaseNotes',
'One line description of project.',
'Miscellaneous'),
]

View File

@ -1,6 +1,6 @@
======================
Higgins Release Notes
======================
==================
Zun Release Notes
==================
.. toctree::
:maxdepth: 1

View File

@ -1,5 +1,5 @@
[metadata]
name = higgins
name = zun
summary = Container Management service for OpenStack
description-file =
README.rst
@ -20,7 +20,7 @@ classifier =
[files]
packages =
higgins
zun
[build_sphinx]
source-dir = doc/source
@ -31,28 +31,28 @@ all_files = 1
upload-dir = doc/build/html
[compile_catalog]
directory = higgins/locale
domain = higgins
directory = zun/locale
domain = zun
[update_catalog]
domain = higgins
output_dir = higgins/locale
input_file = higgins/locale/higgins.pot
domain = zun
output_dir = zun/locale
input_file = zun/locale/zun.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = higgins/locale/higgins.pot
output_file = zun/locale/zun.pot
[entry_points]
console_scripts =
higgins-api = higgins.cmd.api:main
higgins-conductor = higgins.cmd.conductor:main
higgins-db-manage = higgins.cmd.db_manage:main
zun-api = zun.cmd.api:main
zun-conductor = zun.cmd.conductor:main
zun-db-manage = zun.cmd.db_manage:main
oslo.config.opts =
higgins = higgins.opts:list_opts
zun = zun.opts:list_opts
higgins.database.migration_backend =
sqlalchemy = higgins.db.sqlalchemy.migration
zun.database.migration_backend =
sqlalchemy = zun.db.sqlalchemy.migration

View File

@ -1,12 +0,0 @@
To generate the sample higgins.conf file, run gen-config tools
from the top level of the higgins directory:
tools/gen-config
Or run the following command from the top level of the
higgins directory:
tox -egenconfig
Generated sample configuration file will be put into etc/higgins/
directory.

12
tools/README-zun.conf.txt Normal file
View File

@ -0,0 +1,12 @@
To generate the sample zun.conf file, run gen-config tools
from the top level of the zun directory:
tools/gen-config
Or run the following command from the top level of the
zun directory:
tox -egenconfig
Generated sample configuration file will be put into etc/zun/
directory.

View File

@ -1,3 +1,3 @@
#!/bin/sh
oslo-config-generator --config-file=tools/higgins-config-generator.conf
oslo-config-generator --config-file=tools/zun-config-generator.conf

View File

@ -1,8 +1,8 @@
[DEFAULT]
output_file = etc/higgins/higgins.conf.sample
output_file = etc/zun/zun.conf.sample
wrap_width = 79
namespace = higgins
namespace = zun
namespace = keystonemiddleware.auth_token
namespace = oslo.concurrency
namespace = oslo.db

View File

@ -29,7 +29,7 @@ install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstac
commands =
doc8 -e .rst doc/source/ CONTRIBUTING.rst HACKING.rst README.rst
bash tools/flake8wrap.sh {posargs}
bandit -r higgins -x tests -n5 -ll
bandit -r zun -x tests -n5 -ll
[testenv:pep8-constraints]
install_command = {[testenv:common-constraints]install_command}
@ -71,7 +71,7 @@ builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
[hacking]
local-check-factory = higgins.hacking.checks.factory
local-check-factory = zun.hacking.checks.factory
[testenv:fast8]
# NOTE(sheel.rana): `tox -e fast8` cab be used to run pep8 command only for

View File

@ -16,4 +16,4 @@ import pbr.version
__version__ = pbr.version.VersionInfo(
'higgins').version_string()
'zun').version_string()

View File

@ -14,19 +14,19 @@ from oslo_config import cfg
from oslo_log import log
import pecan
from higgins.api import config as api_config
from higgins.api import middleware
from higgins.common.i18n import _
from zun.api import config as api_config
from zun.api import middleware
from zun.common.i18n import _
# Register options for the service
API_SERVICE_OPTS = [
cfg.PortOpt('port',
default=9512,
help='The port for the higgins API server.'),
help='The port for the zun API server.'),
cfg.IPOpt('host',
default='127.0.0.1',
help='The listen IP for the higgins API server.'),
help='The listen IP for the zun API server.'),
cfg.BoolOpt('enable_ssl_api',
default=False,
help=_("Enable the integrated stand-alone API to service "
@ -36,13 +36,13 @@ API_SERVICE_OPTS = [
"will want to change public API endpoint to represent "
"SSL termination URL with 'public_endpoint' option.")),
cfg.IntOpt('workers',
help=_("Number of workers for higgins-api service. "
help=_("Number of workers for zun-api service. "
"The default will be the number of CPUs available.")),
]
CONF = cfg.CONF
opt_group = cfg.OptGroup(name='api',
title='Options for the higgins-api service')
title='Options for the zun-api service')
CONF.register_group(opt_group)
CONF.register_opts(API_SERVICE_OPTS, opt_group)

View File

@ -12,12 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from higgins.api import hooks
from zun.api import hooks
# Pecan Application Configurations
app = {
'root': 'higgins.api.controllers.root.RootController',
'modules': ['higgins'],
'root': 'zun.api.controllers.root.RootController',
'modules': ['zun'],
'hooks': [
hooks.ContextHook(),
hooks.NoExceptionTracebackHook(),

View File

@ -16,7 +16,7 @@
import pecan
from wsme import types as wtypes
from higgins.api.controllers import base
from zun.api.controllers import base
def build_url(resource, resource_args, bookmark=False, base_url=None):

View File

@ -13,7 +13,7 @@
# under the License.
"""
Version 1 of the Higgins API
Version 1 of the Zun API
NOTE: IN PROGRESS AND NOT FULLY IMPLEMENTED.
"""
@ -23,9 +23,9 @@ import pecan
from pecan import rest
from wsme import types as wtypes
from higgins.api.controllers import base as controllers_base
from higgins.api.controllers import link
from higgins.api import expose
from zun.api.controllers import base as controllers_base
from zun.api.controllers import link
from zun.api import expose
LOG = logging.getLogger(__name__)
@ -61,11 +61,11 @@ class V1(controllers_base.APIBase):
'v1', '', bookmark=True),
link.Link.make_link('describedby',
'http://docs.openstack.org',
'developer/higgins/dev',
'developer/zun/dev',
'api-spec-v1.html',
bookmark=True, type='text/html')]
v1.media_types = [MediaType('application/json',
'application/vnd.openstack.higgins.v1+json')]
'application/vnd.openstack.zun.v1+json')]
return v1

View File

@ -16,7 +16,7 @@
from oslo_config import cfg
from pecan import hooks
from higgins.common import context
from zun.common import context
CONF = cfg.CONF
CONF.import_opt('auth_uri', 'keystonemiddleware.auth_token',

View File

@ -10,8 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from higgins.api.middleware import auth_token
from higgins.api.middleware import parsable_error
from zun.api.middleware import auth_token
from zun.api.middleware import parsable_error
AuthTokenMiddleware = auth_token.AuthTokenMiddleware

View File

@ -15,9 +15,9 @@ import re
from keystonemiddleware import auth_token
from oslo_log import log
from higgins.common import exception
from higgins.common.i18n import _
from higgins.common import utils
from zun.common import exception
from zun.common.i18n import _
from zun.common import utils
LOG = log.getLogger(__name__)

View File

@ -21,7 +21,7 @@ Based on pecan.middleware.errordocument
import json
import six
from higgins.common.i18n import _
from zun.common.i18n import _
class ParsableErrorMiddleware(object):

View File

@ -15,29 +15,29 @@
# License for the specific language governing permissions and limitations
# under the License.
"""The Higgins Service API."""
"""The Zun Service API."""
import sys
from oslo_config import cfg
from higgins.common import service as higgins_service
from zun.common import service as zun_service
CONF = cfg.CONF
def main():
# Parse config file and command line options, then start logging
higgins_service.prepare_service(sys.argv)
zun_service.prepare_service(sys.argv)
# Enable object backporting via the conductor
# TODO(yuanying): Uncomment after rpc services are implemented
# base.higginsObject.indirection_api = base.higginsObjectIndirectionAPI()
# base.zunObject.indirection_api = base.zunObjectIndirectionAPI()
# Build and start the WSGI app
launcher = higgins_service.process_launcher()
server = higgins_service.WSGIService(
'higgins_api',
launcher = zun_service.process_launcher()
server = zun_service.WSGIService(
'zun_api',
CONF.api.enable_ssl_api
)
launcher.launch_service(server, workers=server.workers)

View File

@ -10,7 +10,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Starter script for the Higgins conductor service."""
"""Starter script for the Zun conductor service."""
import os
import sys
@ -19,22 +19,22 @@ from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import service
from higgins.common.i18n import _LI
from higgins.common import rpc_service
from higgins.common import service as higgins_service
from higgins.common import short_id
from higgins.conductor.handlers import default as default_handler
from zun.common.i18n import _LI
from zun.common import rpc_service
from zun.common import service as zun_service
from zun.common import short_id
from zun.conductor.handlers import default as default_handler
LOG = logging.getLogger(__name__)
def main():
higgins_service.prepare_service(sys.argv)
zun_service.prepare_service(sys.argv)
LOG.info(_LI('Starting server in PID %s'), os.getpid())
cfg.CONF.log_opt_values(LOG, logging.DEBUG)
cfg.CONF.import_opt('topic', 'higgins.conductor.config', group='conductor')
cfg.CONF.import_opt('topic', 'zun.conductor.config', group='conductor')
conductor_id = short_id.generate_id()
endpoints = [
@ -43,6 +43,6 @@ def main():
server = rpc_service.Service.create(cfg.CONF.conductor.topic,
conductor_id, endpoints,
binary='higgins-conductor')
binary='zun-conductor')
launcher = service.launch(cfg.CONF, server)
launcher.wait()

View File

@ -11,11 +11,11 @@
# License for the specific language governing permissions and limitations
# under the License.
"""Starter script for higgins-db-manage."""
"""Starter script for zun-db-manage."""
from oslo_config import cfg
from higgins.db import migration
from zun.db import migration
CONF = cfg.CONF
@ -63,5 +63,5 @@ def main():
handler=add_command_parsers)
CONF.register_cli_opt(command_opt)
CONF(project='higgins')
CONF(project='zun')
CONF.command.func()

View File

@ -17,15 +17,15 @@
from oslo_config import cfg
# from higgins.common import rpc
from higgins import version
# from zun.common import rpc
from zun import version
def parse_args(argv, default_config_files=None):
# TODO(yuanying): Uncomment after rpc is implemented
# rpc.set_defaults(control_exchange='higgins')
# rpc.set_defaults(control_exchange='zun')
cfg.CONF(argv[1:],
project='higgins',
project='zun',
version=version.version_info.release_string(),
default_config_files=default_config_files)
# rpc.init(cfg.CONF)

View File

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Higgins base exception handling.
"""Zun base exception handling.
Includes decorator for re-raising Higgins-type exceptions.
Includes decorator for re-raising Zun-type exceptions.
"""
@ -30,9 +30,9 @@ import pecan
import six
import wsme
from higgins.common.i18n import _
from higgins.common.i18n import _LE
from higgins.common import safe_utils
from zun.common.i18n import _
from zun.common.i18n import _LE
from zun.common import safe_utils
LOG = logging.getLogger(__name__)
@ -43,8 +43,8 @@ try:
CONF.import_opt('fatal_exception_format_errors',
'oslo_versionedobjects.exception')
except cfg.NoSuchOptError as e:
# Note:work around for higgins run against master branch
# in devstack gate job, as higgins not branched yet
# Note:work around for zun run against master branch
# in devstack gate job, as zun not branched yet
# verisonobjects kilo/master different version can
# cause issue here. As it changed import group. So
# add here before branch to prevent gate failure.
@ -96,11 +96,11 @@ OBFUSCATED_MSG = _('Your request could not be handled '
def wrap_controller_exception(func, func_server_error, func_client_error):
"""This decorator wraps controllers methods to handle exceptions:
- if an unhandled Exception or a HigginsException with an error code >=500
- if an unhandled Exception or a ZunException with an error code >=500
is catched, raise a http 5xx ClientSideError and correlates it with a log
message
- if a HigginsException is catched and its error code is <500, raise a http
- if a ZunException is catched and its error code is <500, raise a http
4xx and logs the excp in debug mode
"""
@ -109,7 +109,7 @@ def wrap_controller_exception(func, func_server_error, func_client_error):
try:
return func(*args, **kw)
except Exception as excp:
if isinstance(excp, HigginsException):
if isinstance(excp, ZunException):
http_error_code = excp.code
else:
http_error_code = 500
@ -162,7 +162,7 @@ def wrap_pecan_controller_exception(func):
def wrap_keystone_exception(func):
"""Wrap keystone exceptions and throw Higgins specific exceptions."""
"""Wrap keystone exceptions and throw Zun specific exceptions."""
@functools.wraps(func)
def wrapped(*args, **kw):
try:
@ -178,8 +178,8 @@ def wrap_keystone_exception(func):
return wrapped
class HigginsException(Exception):
"""Base Higgins Exception
class ZunException(Exception):
"""Base Zun Exception
To correctly use this class, inherit from it and define
a 'message' property. That message will get printf'd
@ -212,7 +212,7 @@ class HigginsException(Exception):
if CONF.oslo_versionedobjects.fatal_exception_format_errors:
raise e
super(HigginsException, self).__init__(self.message)
super(ZunException, self).__init__(self.message)
def __str__(self):
if six.PY3:
@ -229,11 +229,11 @@ class HigginsException(Exception):
return six.text_type(self)
class ObjectNotFound(HigginsException):
class ObjectNotFound(ZunException):
message = _("The %(name)s %(id)s could not be found.")
class ObjectNotUnique(HigginsException):
class ObjectNotUnique(ZunException):
message = _("The %(name)s already exists.")
@ -247,23 +247,23 @@ class ResourceExists(ObjectNotUnique):
code = 409
class AuthorizationFailure(HigginsException):
class AuthorizationFailure(ZunException):
message = _("%(client)s connection failed. %(message)s")
class UnsupportedObjectError(HigginsException):
class UnsupportedObjectError(ZunException):
message = _('Unsupported object type %(objtype)s')
class IncompatibleObjectVersion(HigginsException):
class IncompatibleObjectVersion(ZunException):
message = _('Version %(objver)s of %(objname)s is not supported')
class OrphanedObjectError(HigginsException):
class OrphanedObjectError(ZunException):
message = _('Cannot call %(method)s on orphaned %(objtype)s object')
class Invalid(HigginsException):
class Invalid(ZunException):
message = _("Unacceptable parameters.")
code = 400
@ -281,7 +281,7 @@ class InvalidDiscoveryURL(Invalid):
"discovery endpoint '%(discovery_endpoint)s'.")
class GetDiscoveryUrlFailed(HigginsException):
class GetDiscoveryUrlFailed(ZunException):
message = _("Failed to get discovery url from '%(discovery_endpoint)s'.")
@ -301,7 +301,7 @@ class HTTPNotFound(ResourceNotFound):
pass
class Conflict(HigginsException):
class Conflict(ZunException):
message = _('Conflict.')
code = 409
@ -324,10 +324,10 @@ class PatchError(Invalid):
message = _("Couldn't apply patch '%(patch)s'. Reason: %(reason)s")
class NotAuthorized(HigginsException):
class NotAuthorized(ZunException):
message = _("Not authorized.")
code = 403
class ConfigInvalid(HigginsException):
class ConfigInvalid(ZunException):
message = _("Invalid configuration file. %(error_msg)s")

View File

@ -19,7 +19,7 @@
import oslo_i18n
_translators = oslo_i18n.TranslatorFactory(domain='higgins')
_translators = oslo_i18n.TranslatorFactory(domain='zun')
# The primary translation function using the well-known name "_"
_ = _translators.primary

View File

@ -18,8 +18,8 @@ from keystoneclient.v3 import client as kc_v3
from oslo_config import cfg
from oslo_log import log as logging
from higgins.common import exception
from higgins.common.i18n import _LE
from zun.common import exception
from zun.common.i18n import _LE
CONF = cfg.CONF
CFG_GROUP = 'keystone_auth'

View File

@ -31,8 +31,8 @@ from oslo_config import cfg
import oslo_messaging as messaging
from oslo_serialization import jsonutils
from higgins.common import context as higgins_context
from higgins.common import exception
from zun.common import context as zun_context
from zun.common import exception
CONF = cfg.CONF
@ -44,15 +44,15 @@ ALLOWED_EXMODS = [
]
EXTRA_EXMODS = []
# NOTE(lucasagomes): The higgins.openstack.common.rpc entries are for
# NOTE(lucasagomes): The zun.openstack.common.rpc entries are for
# backwards compat with IceHouse rpc_backend configuration values.
TRANSPORT_ALIASES = {
'higgins.openstack.common.rpc.impl_kombu': 'rabbit',
'higgins.openstack.common.rpc.impl_qpid': 'qpid',
'higgins.openstack.common.rpc.impl_zmq': 'zmq',
'higgins.rpc.impl_kombu': 'rabbit',
'higgins.rpc.impl_qpid': 'qpid',
'higgins.rpc.impl_zmq': 'zmq',
'zun.openstack.common.rpc.impl_kombu': 'rabbit',
'zun.openstack.common.rpc.impl_qpid': 'qpid',
'zun.openstack.common.rpc.impl_zmq': 'zmq',
'zun.rpc.impl_kombu': 'rabbit',
'zun.rpc.impl_qpid': 'qpid',
'zun.rpc.impl_zmq': 'zmq',
}
@ -115,7 +115,7 @@ class RequestContextSerializer(messaging.Serializer):
return context.to_dict()
def deserialize_context(self, context):
return higgins_context.RequestContext.from_dict(context)
return zun_context.RequestContext.from_dict(context)
def get_transport_url(url_str=None):

View File

@ -12,16 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Common RPC service and API tools for Higgins."""
"""Common RPC service and API tools for Zun."""
import eventlet
from oslo_config import cfg
import oslo_messaging as messaging
from oslo_service import service
from higgins.common import rpc
from higgins.objects import base as objects_base
from higgins.servicegroup import higgins_service_periodic as servicegroup
from zun.common import rpc
from zun.objects import base as objects_base
from zun.servicegroup import zun_service_periodic as servicegroup
# NOTE(paulczar):
# Ubuntu 14.04 forces librabbitmq when kombu is used
@ -31,12 +31,12 @@ from higgins.servicegroup import higgins_service_periodic as servicegroup
eventlet.monkey_patch()
# NOTE(asalkeld):
# The higgins.openstack.common.rpc entries are for compatibility
# The zun.openstack.common.rpc entries are for compatibility
# with devstack rpc_backend configuration values.
TRANSPORT_ALIASES = {
'higgins.openstack.common.rpc.impl_kombu': 'rabbit',
'higgins.openstack.common.rpc.impl_qpid': 'qpid',
'higgins.openstack.common.rpc.impl_zmq': 'zmq',
'zun.openstack.common.rpc.impl_kombu': 'rabbit',
'zun.openstack.common.rpc.impl_qpid': 'qpid',
'zun.openstack.common.rpc.impl_zmq': 'zmq',
}
periodic_opts = [
@ -55,7 +55,7 @@ class Service(service.Service):
def __init__(self, topic, server, handlers, binary):
super(Service, self).__init__()
serializer = rpc.RequestContextSerializer(
objects_base.HigginsObjectSerializer())
objects_base.ZunObjectSerializer())
transport = messaging.get_transport(cfg.CONF,
aliases=TRANSPORT_ALIASES)
# TODO(asalkeld) add support for version='x.y'
@ -84,7 +84,7 @@ class API(object):
def __init__(self, transport=None, context=None, topic=None, server=None,
timeout=None):
serializer = rpc.RequestContextSerializer(
objects_base.HigginsObjectSerializer())
objects_base.ZunObjectSerializer())
if transport is None:
exmods = rpc.get_allowed_exmods()
transport = messaging.get_transport(cfg.CONF,

View File

@ -22,10 +22,10 @@ from oslo_log import log
from oslo_service import service
from oslo_service import wsgi
from higgins.api import app
from higgins.common import config
from higgins.common import exception
from higgins.common.i18n import _
from zun.api import app
from zun.common import config
from zun.common import exception
from zun.common.i18n import _
service_opts = [
@ -49,7 +49,7 @@ def prepare_service(argv=None):
argv = []
log.register_options(CONF)
config.parse_args(argv)
log.setup(CONF, 'higgins')
log.setup(CONF, 'zun')
# TODO(yuanying): Uncomment after objects are implemented
# objects.register_all()
@ -59,7 +59,7 @@ def process_launcher():
class WSGIService(service.ServiceBase):
"""Provides ability to launch Higgins API from wsgi app."""
"""Provides ability to launch Zun API from wsgi app."""
def __init__(self, name, use_ssl=False):
"""Initialize, but do not start the WSGI server.

View File

@ -20,7 +20,7 @@ import uuid
import six
from higgins.common.i18n import _
from zun.common.i18n import _
def _to_byte_string(value, num_bits):

View File

@ -20,7 +20,7 @@ from oslo_log import log as logging
import six
import uuid
from higgins.common.i18n import _LW
from zun.common.i18n import _LW
LOG = logging.getLogger(__name__)

View File

@ -10,10 +10,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""API for interfacing with Higgins Backend."""
"""API for interfacing with Zun Backend."""
from oslo_config import cfg
from higgins.common import rpc_service
from zun.common import rpc_service
# The Backend API class serves as a AMQP client for communicating
@ -23,7 +23,7 @@ from higgins.common import rpc_service
class API(rpc_service.API):
def __init__(self, transport=None, context=None, topic=None):
if topic is None:
cfg.CONF.import_opt('topic', 'higgins.conductor.config',
cfg.CONF.import_opt('topic', 'zun.conductor.config',
group='conductor')
super(API, self).__init__(transport, context,
topic=cfg.CONF.conductor.topic)

View File

@ -10,19 +10,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Config options for Higgins Backend service."""
"""Config options for Zun Backend service."""
from oslo_config import cfg
SERVICE_OPTS = [
cfg.StrOpt('topic',
default='higgins-conductor',
default='zun-conductor',
help='The queue to add conductor tasks to.'),
]
opt_group = cfg.OptGroup(
name='conductor',
title='Options for the higgins-conductor service')
title='Options for the zun-conductor service')
cfg.CONF.register_group(opt_group)
cfg.CONF.register_opts(SERVICE_OPTS, opt_group)

View File

@ -10,7 +10,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Higgins Conductor default handler."""
"""Zun Conductor default handler."""
# These are the database operations - They are executed by the conductor

View File

@ -22,7 +22,7 @@ from oslo_db import api as db_api
import six
_BACKEND_MAPPING = {'sqlalchemy': 'higgins.db.sqlalchemy.api'}
_BACKEND_MAPPING = {'sqlalchemy': 'zun.db.sqlalchemy.api'}
IMPL = db_api.DBAPI.from_config(cfg.CONF, backend_mapping=_BACKEND_MAPPING,
lazy=True)
@ -41,49 +41,49 @@ class Connection(object):
"""Constructor."""
@abc.abstractmethod
def destroy_higgins_service(self, higgins_service_id):
"""Destroys a higgins_service record.
def destroy_zun_service(self, zun_service_id):
"""Destroys a zun_service record.
:param higgins_service_id: The id of a higgins_service.
:param zun_service_id: The id of a zun_service.
"""
@abc.abstractmethod
def update_higgins_service(self, higgins_service_id, values):
"""Update properties of a higgins_service.
def update_zun_service(self, zun_service_id, values):
"""Update properties of a zun_service.
:param higgins_service_id: The id of a higgins_service record.
:param zun_service_id: The id of a zun_service record.
"""
@abc.abstractmethod
def get_higgins_service_by_host_and_binary(self, context, host, binary):
"""Return a higgins_service record.
def get_zun_service_by_host_and_binary(self, context, host, binary):
"""Return a zun_service record.
:param context: The security context
:param host: The host where the binary is located.
:param binary: The name of the binary.
:returns: A higgins_service record.
:returns: A zun_service record.
"""
@abc.abstractmethod
def create_higgins_service(self, values):
"""Create a new higgins_service record.
def create_zun_service(self, values):
"""Create a new zun_service record.
:param values: A dict containing several items used to identify
and define the higgins_service record.
:returns: A higgins_service record.
and define the zun_service record.
:returns: A zun_service record.
"""
@abc.abstractmethod
def get_higgins_service_list(self, context, disabled=None, limit=None,
marker=None, sort_key=None, sort_dir=None):
"""Get matching higgins_service records.
def get_zun_service_list(self, context, disabled=None, limit=None,
marker=None, sort_key=None, sort_dir=None):
"""Get matching zun_service records.
Return a list of the specified columns for all higgins_services
Return a list of the specified columns for all zun_services
those match the specified filters.
:param context: The security context
:param disabled: Filters disbaled services. Defaults to None.
:param limit: Maximum number of higgins_services to return.
:param limit: Maximum number of zun_services to return.
:param marker: the last item of the previous page; we return the next
result set.
:param sort_key: Attribute by which results should be sorted.

View File

@ -23,7 +23,7 @@ def get_backend():
global _IMPL
if not _IMPL:
cfg.CONF.import_opt('backend', 'oslo_db.options', group='database')
_IMPL = driver.DriverManager("higgins.database.migration_backend",
_IMPL = driver.DriverManager("zun.database.migration_backend",
cfg.CONF.database.backend).driver
return _IMPL

View File

@ -1,11 +1,11 @@
Please see https://alembic.readthedocs.org/en/latest/index.html for general documentation
To create alembic migrations use:
$ higgins-db-manage revision --message "description of revision" --autogenerate
$ zun-db-manage revision --message "description of revision" --autogenerate
Stamp db with most recent migration version, without actually running migrations
$ higgins-db-manage stamp head
$ zun-db-manage stamp head
Upgrade can be performed by:
$ higgins-db-manage upgrade
$ higgins-db-manage upgrade head
$ zun-db-manage upgrade
$ zun-db-manage upgrade head

View File

@ -15,8 +15,8 @@ from __future__ import with_statement
from alembic import context
from logging.config import fileConfig
from higgins.db.sqlalchemy import api as sqla_api
from higgins.db.sqlalchemy import models
from zun.db.sqlalchemy import api as sqla_api
from zun.db.sqlalchemy import models
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config

View File

@ -11,7 +11,7 @@
# under the License.
"""create_table_higgins_service
"""create_table_zun_service
Revision ID: a9a92eebd9a8
Revises:
@ -31,7 +31,7 @@ import sqlalchemy as sa
def upgrade():
op.create_table(
'higgins_service',
'zun_service',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
@ -44,5 +44,5 @@ def upgrade():
sa.Column('forced_down', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('host', 'binary',
name='uniq_higgins_service0host0binary')
name='uniq_zun_service0host0binary')
)

View File

@ -21,11 +21,11 @@ from oslo_db.sqlalchemy import utils as db_utils
from oslo_utils import timeutils
from sqlalchemy.orm.exc import NoResultFound
from higgins.common import exception
from higgins.common.i18n import _
from higgins.common import utils
from higgins.db import api
from higgins.db.sqlalchemy import models
from zun.common import exception
from zun.common.i18n import _
from zun.common import utils
from zun.db import api
from zun.db.sqlalchemy import models
CONF = cfg.CONF
@ -107,24 +107,24 @@ class Connection(api.Connection):
def __init__(self):
pass
def destroy_higgins_service(self, higgins_service_id):
def destroy_zun_service(self, zun_service_id):
session = get_session()
with session.begin():
query = model_query(models.HigginsService, session=session)
query = add_identity_filter(query, higgins_service_id)
query = model_query(models.ZunService, session=session)
query = add_identity_filter(query, zun_service_id)
count = query.delete()
if count != 1:
raise exception.HigginsServiceNotFound(higgins_service_id)
raise exception.ZunServiceNotFound(zun_service_id)
def update_higgins_service(self, higgins_service_id, values):
def update_zun_service(self, zun_service_id, values):
session = get_session()
with session.begin():
query = model_query(models.HigginsService, session=session)
query = add_identity_filter(query, higgins_service_id)
query = model_query(models.ZunService, session=session)
query = add_identity_filter(query, zun_service_id)
try:
ref = query.with_lockmode('update').one()
except NoResultFound:
raise exception.HigginsServiceNotFound(higgins_service_id)
raise exception.ZunServiceNotFound(zun_service_id)
if 'report_count' in values:
if values['report_count'] > ref.report_count:
@ -133,30 +133,30 @@ class Connection(api.Connection):
ref.update(values)
return ref
def get_higgins_service_by_host_and_binary(self, context, host, binary):
query = model_query(models.HigginsService)
def get_zun_service_by_host_and_binary(self, context, host, binary):
query = model_query(models.ZunService)
query = query.filter_by(host=host, binary=binary)
try:
return query.one()
except NoResultFound:
return None
def create_higgins_service(self, values):
higgins_service = models.HigginsService()
higgins_service.update(values)
def create_zun_service(self, values):
zun_service = models.ZunService()
zun_service.update(values)
try:
higgins_service.save()
zun_service.save()
except db_exc.DBDuplicateEntry:
raise exception.HigginsServiceAlreadyExists(
id=higgins_service['id'])
return higgins_service
raise exception.ZunServiceAlreadyExists(
id=zun_service['id'])
return zun_service
def get_higgins_service_list(self, context, disabled=None, limit=None,
marker=None, sort_key=None, sort_dir=None
):
query = model_query(models.HigginsService)
def get_zun_service_list(self, context, disabled=None, limit=None,
marker=None, sort_key=None, sort_dir=None
):
query = model_query(models.ZunService)
if disabled:
query = query.filter_by(disabled=disabled)
return _paginate_query(models.HigginsService, limit, marker,
return _paginate_query(models.ZunService, limit, marker,
sort_key, sort_dir, query)

View File

@ -73,8 +73,8 @@ class JSONEncodedList(JsonEncodedType):
type = list
class HigginsBase(models.TimestampMixin,
models.ModelBase):
class ZunBase(models.TimestampMixin,
models.ModelBase):
metadata = None
@ -85,23 +85,23 @@ class HigginsBase(models.TimestampMixin,
return d
def save(self, session=None):
import higgins.db.sqlalchemy.api as db_api
import zun.db.sqlalchemy.api as db_api
if session is None:
session = db_api.get_session()
super(HigginsBase, self).save(session)
super(ZunBase, self).save(session)
Base = declarative_base(cls=HigginsBase)
Base = declarative_base(cls=ZunBase)
class HigginsService(Base):
"""Represents health status of various higgins services"""
__tablename__ = 'higgins_service'
class ZunService(Base):
"""Represents health status of various zun services"""
__tablename__ = 'zun_service'
__table_args__ = (
schema.UniqueConstraint("host", "binary",
name="uniq_higgins_service0host0binary"),
name="uniq_zun_service0host0binary"),
table_args()
)

View File

@ -18,7 +18,7 @@ import re
"""
Guidelines for writing new hacking checks
- Use only for Higgins specific tests. OpenStack general tests
- Use only for Zun specific tests. OpenStack general tests
should be submitted to the common 'hacking' module.
- Pick numbers in the range M3xx. Find the current test with
the highest allocated number and then pick the next value.
@ -26,7 +26,7 @@ Guidelines for writing new hacking checks
- Keep the test method code in the source file ordered based
on the M3xx value.
- List the new rule in the top level HACKING.rst file
- Add test cases for each new rule to higgins/tests/unit/test_hacking.py
- Add test cases for each new rule to zun/tests/unit/test_hacking.py
"""

View File

@ -11,9 +11,9 @@
# under the License.
from higgins.objects import higgins_service
from zun.objects import zun_service
HigginsService = higgins_service.HigginsService
ZunService = zun_service.ZunService
__all__ = (HigginsService,)
__all__ = (ZunService,)

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
"""Higgins common internal object model"""
"""Zun common internal object model"""
from oslo_versionedobjects import base as ovoo_base
from oslo_versionedobjects import fields as ovoo_fields
@ -22,11 +22,11 @@ remotable_classmethod = ovoo_base.remotable_classmethod
remotable = ovoo_base.remotable
class HigginsObjectRegistry(ovoo_base.VersionedObjectRegistry):
class ZunObjectRegistry(ovoo_base.VersionedObjectRegistry):
pass
class HigginsObject(ovoo_base.VersionedObject):
class ZunObject(ovoo_base.VersionedObject):
"""Base class and object factory.
This forms the base of all objects that can be remoted or instantiated
@ -35,7 +35,7 @@ class HigginsObject(ovoo_base.VersionedObject):
necessary "get" classmethod routines as well as "save" object methods
as appropriate.
"""
OBJ_PROJECT_NAMESPACE = 'higgins'
OBJ_PROJECT_NAMESPACE = 'zun'
def as_dict(self):
return {k: getattr(self, k)
@ -43,11 +43,11 @@ class HigginsObject(ovoo_base.VersionedObject):
if self.obj_attr_is_set(k)}
class HigginsObjectDictCompat(ovoo_base.VersionedObjectDictCompat):
class ZunObjectDictCompat(ovoo_base.VersionedObjectDictCompat):
pass
class HigginsPersistentObject(object):
class ZunPersistentObject(object):
"""Mixin class for Persistent objects.
This adds the fields that we use in common for all persistent objects.
@ -58,6 +58,6 @@ class HigginsPersistentObject(object):
}
class HigginsObjectSerializer(ovoo_base.VersionedObjectSerializer):
class ZunObjectSerializer(ovoo_base.VersionedObjectSerializer):
# Base class to use for object hydration
OBJ_BASE_CLASS = HigginsObject
OBJ_BASE_CLASS = ZunObject

View File

@ -12,13 +12,13 @@
from oslo_versionedobjects import fields
from higgins.db import api as dbapi
from higgins.objects import base
from zun.db import api as dbapi
from zun.objects import base
@base.HigginsObjectRegistry.register
class HigginsService(base.HigginsPersistentObject, base.HigginsObject,
base.HigginsObjectDictCompat):
@base.ZunObjectRegistry.register
class ZunService(base.ZunPersistentObject, base.ZunObject,
base.ZunObjectDictCompat):
# Version 1.0: Initial version
VERSION = '1.0'
@ -36,88 +36,88 @@ class HigginsService(base.HigginsPersistentObject, base.HigginsObject,
}
@staticmethod
def _from_db_object(higgins_service, db_higgins_service):
def _from_db_object(zun_service, db_zun_service):
"""Converts a database entity to a formal object."""
for field in higgins_service.fields:
higgins_service[field] = db_higgins_service[field]
for field in zun_service.fields:
zun_service[field] = db_zun_service[field]
higgins_service.obj_reset_changes()
return higgins_service
zun_service.obj_reset_changes()
return zun_service
@staticmethod
def _from_db_object_list(db_objects, cls, context):
"""Converts a list of database entities to a list of formal objects."""
return [HigginsService._from_db_object(cls(context), obj)
return [ZunService._from_db_object(cls(context), obj)
for obj in db_objects]
@base.remotable_classmethod
def get_by_host_and_binary(cls, context, host, binary):
"""Find a higgins_service based on its hostname and binary.
"""Find a zun_service based on its hostname and binary.
:param host: The host on which the binary is running.
:param binary: The name of the binary.
:param context: Security context.
:returns: a :class:`HigginsService` object.
:returns: a :class:`ZunService` object.
"""
db_higgins_service = cls.dbapi.get_higgins_service_by_host_and_binary(
db_zun_service = cls.dbapi.get_zun_service_by_host_and_binary(
context, host, binary)
if db_higgins_service is None:
if db_zun_service is None:
return None
higgins_service = HigginsService._from_db_object(
cls(context), db_higgins_service)
return higgins_service
zun_service = ZunService._from_db_object(
cls(context), db_zun_service)
return zun_service
@base.remotable_classmethod
def list(cls, context, limit=None, marker=None,
sort_key=None, sort_dir=None):
"""Return a list of HigginsService objects.
"""Return a list of ZunService objects.
:param context: Security context.
:param limit: maximum number of resources to return in a single result.
:param marker: pagination marker for large data sets.
:param sort_key: column to sort results by.
:param sort_dir: direction to sort. "asc" or "desc".
:returns: a list of :class:`HigginsService` object.
:returns: a list of :class:`ZunService` object.
"""
db_higgins_services = cls.dbapi.get_higgins_service_list(
db_zun_services = cls.dbapi.get_zun_service_list(
context, limit=limit, marker=marker, sort_key=sort_key,
sort_dir=sort_dir)
return HigginsService._from_db_object_list(db_higgins_services, cls,
context)
return ZunService._from_db_object_list(db_zun_services, cls,
context)
@base.remotable
def create(self, context=None):
"""Create a HigginsService record in the DB.
"""Create a ZunService record in the DB.
:param context: Security context. NOTE: This should only
be used internally by the indirection_api.
Unfortunately, RPC requires context as the first
argument, even though we don't use it.
A context should be set when instantiating the
object, e.g.: HigginsService(context)
object, e.g.: ZunService(context)
"""
values = self.obj_get_changes()
db_higgins_service = self.dbapi.create_higgins_service(values)
self._from_db_object(self, db_higgins_service)
db_zun_service = self.dbapi.create_zun_service(values)
self._from_db_object(self, db_zun_service)
@base.remotable
def destroy(self, context=None):
"""Delete the HigginsService from the DB.
"""Delete the ZunService from the DB.
:param context: Security context. NOTE: This should only
be used internally by the indirection_api.
Unfortunately, RPC requires context as the first
argument, even though we don't use it.
A context should be set when instantiating the
object, e.g.: HigginsService(context)
object, e.g.: ZunService(context)
"""
self.dbapi.destroy_higgins_service(self.id)
self.dbapi.destroy_zun_service(self.id)
self.obj_reset_changes()
@base.remotable
def save(self, context=None):
"""Save updates to this HigginsService.
"""Save updates to this ZunService.
Updates will be made column by column based on the result
of self.what_changed().
@ -127,22 +127,22 @@ class HigginsService(base.HigginsPersistentObject, base.HigginsObject,
Unfortunately, RPC requires context as the first
argument, even though we don't use it.
A context should be set when instantiating the
object, e.g.: HigginsService(context)
object, e.g.: ZunService(context)
"""
updates = self.obj_get_changes()
self.dbapi.update_higgins_service(self.id, updates)
self.dbapi.update_zun_service(self.id, updates)
self.obj_reset_changes()
@base.remotable
def report_state_up(self, context=None):
"""Touching the higgins_service record to show aliveness.
"""Touching the zun_service record to show aliveness.
:param context: Security context. NOTE: This should only
be used internally by the indirection_api.
Unfortunately, RPC requires context as the first
argument, even though we don't use it.
A context should be set when instantiating the
object, e.g.: HigginsService(context)
object, e.g.: ZunService(context)
"""
self.report_count += 1
self.save()

View File

@ -12,21 +12,21 @@
import itertools
import higgins.api.app
import higgins.common.keystone
import higgins.common.rpc_service
import higgins.common.service
import higgins.conductor.config
import zun.api.app
import zun.common.keystone
import zun.common.rpc_service
import zun.common.service
import zun.conductor.config
def list_opts():
return [
('DEFAULT',
itertools.chain(
higgins.common.rpc_service.periodic_opts,
higgins.common.service.service_opts,
zun.common.rpc_service.periodic_opts,
zun.common.service.service_opts,
)),
('api', higgins.api.app.API_SERVICE_OPTS),
('conductor', higgins.conductor.config.SERVICE_OPTS),
('keystone_auth', higgins.common.keystone.keystone_auth_opts),
('api', zun.api.app.API_SERVICE_OPTS),
('conductor', zun.conductor.config.SERVICE_OPTS),
('keystone_auth', zun.common.keystone.keystone_auth_opts),
]

View File

@ -13,7 +13,7 @@
import functools
from higgins.common import context
from zun.common import context
def set_context(func):

View File

@ -10,51 +10,51 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Higgins Service Layer"""
"""Zun Service Layer"""
from oslo_log import log
from oslo_service import periodic_task
from higgins import objects
from higgins.service import periodic
from zun import objects
from zun.service import periodic
LOG = log.getLogger(__name__)
class HigginsServicePeriodicTasks(periodic_task.PeriodicTasks):
'''Higgins periodic Task class
class ZunServicePeriodicTasks(periodic_task.PeriodicTasks):
'''Zun periodic Task class
Any periodic task job need to be added into this class
'''
def __init__(self, conf, binary):
self.higgins_service_ref = None
self.zun_service_ref = None
self.host = conf.host
self.binary = binary
super(HigginsServicePeriodicTasks, self).__init__(conf)
super(ZunServicePeriodicTasks, self).__init__(conf)
@periodic_task.periodic_task(run_immediately=True)
@periodic.set_context
def update_higgins_service(self, ctx):
LOG.debug('Update higgins_service')
if self.higgins_service_ref is None:
self.higgins_service_ref = \
objects.HigginsService.get_by_host_and_binary(
def update_zun_service(self, ctx):
LOG.debug('Update zun_service')
if self.zun_service_ref is None:
self.zun_service_ref = \
objects.ZunService.get_by_host_and_binary(
ctx, self.host, self.binary)
if self.higgins_service_ref is None:
higgins_service_dict = {
if self.zun_service_ref is None:
zun_service_dict = {
'host': self.host,
'binary': self.binary
}
self.higgins_service_ref = objects.HigginsService(
ctx, **higgins_service_dict)
self.higgins_service_ref.create()
self.higgins_service_ref.report_state_up()
self.zun_service_ref = objects.ZunService(
ctx, **zun_service_dict)
self.zun_service_ref.create()
self.zun_service_ref.report_state_up()
def setup(conf, binary, tg):
pt = HigginsServicePeriodicTasks(conf, binary)
pt = ZunServicePeriodicTasks(conf, binary)
tg.add_dynamic_timer(
pt.run_periodic_tasks,
periodic_interval_max=conf.periodic_interval_max,

View File

@ -17,7 +17,7 @@ from oslo_config import cfg
from oslo_log import log
from oslotest import base
from higgins.tests import conf_fixture
from zun.tests import conf_fixture
CONF = cfg.CONF

View File

@ -17,10 +17,10 @@
import fixtures
from oslo_config import cfg
# from higgins.common import config
# from zun.common import config
CONF = cfg.CONF
CONF.import_opt('host', 'higgins.common.service')
CONF.import_opt('host', 'zun.common.service')
class ConfFixture(fixtures.Fixture):

View File

@ -0,0 +1,73 @@
# 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.
import mock
from zun.common.rpc_service import CONF
from zun import objects
from zun.servicegroup import zun_service_periodic as periodic
from zun.tests import base
class ZunServicePeriodicTestCase(base.BaseTestCase):
def setUp(self):
super(ZunServicePeriodicTestCase, self).setUp()
mock_zun_service_refresh = mock.Mock()
class FakeSrv(object):
report_state_up = mock_zun_service_refresh
self.fake_srv = FakeSrv()
self.fake_srv_refresh = mock_zun_service_refresh
@mock.patch.object(objects.ZunService, 'get_by_host_and_binary')
@mock.patch.object(objects.ZunService, 'create')
@mock.patch.object(objects.ZunService, 'report_state_up')
def test_update_zun_service_firsttime(self,
mock_srv_refresh,
mock_srv_create,
mock_srv_get
):
p_task = periodic.ZunServicePeriodicTasks(CONF,
'fake-conductor')
mock_srv_get.return_value = None
p_task.update_zun_service(None)
mock_srv_get.assert_called_once_with(mock.ANY, p_task.host,
p_task.binary)
mock_srv_create.assert_called_once_with()
mock_srv_refresh.assert_called_once_with()
@mock.patch.object(objects.ZunService, 'get_by_host_and_binary')
@mock.patch.object(objects.ZunService, 'create')
def test_update_zun_service_on_restart(self,
mock_srv_create,
mock_srv_get):
p_task = periodic.ZunServicePeriodicTasks(CONF,
'fake-conductor')
mock_srv_get.return_value = self.fake_srv
p_task.update_zun_service(None)
mock_srv_get.assert_called_once_with(mock.ANY, p_task.host,
p_task.binary)
self.fake_srv_refresh.assert_called_once_with()
def test_update_zun_service_regular(self):
p_task = periodic.ZunServicePeriodicTasks(CONF,
'fake-conductor')
p_task.zun_service_ref = self.fake_srv
p_task.update_zun_service(None)
self.fake_srv_refresh.assert_called_once_with()

View File

@ -17,14 +17,14 @@ import textwrap
import mock
import pep8
from higgins.hacking import checks
from higgins.tests import base
from zun.hacking import checks
from zun.tests import base
class HackingTestCase(base.BaseTestCase):
"""Hacking test class.
This class tests the hacking checks higgins .hacking.checks by passing
This class tests the hacking checks zun .hacking.checks by passing
strings to the check methods like the pep8/flake8 parser would. The parser
loops over each line in the file and then passes the parameters to the
check method. The parameter names in the check method dictate what type of

View File

@ -13,16 +13,16 @@
# under the License.
"""
test_higgins
test_zun
----------------------------------
Tests for `higgins` module.
Tests for `zun` module.
"""
from higgins.tests import base
from zun.tests import base
class TestHiggins(base.BaseTestCase):
class TestZun(base.BaseTestCase):
def test_something(self):
pass

View File

@ -13,5 +13,5 @@
from pbr import version as pbr_version
version_info = pbr_version.VersionInfo('higgins')
version_info = pbr_version.VersionInfo('zun')
version_string = version_info.version_string