瀏覽代碼

Use devstack for service broker use separate paste and db

1.Add the devstack support for new cfapi
2.service broker use separate paste file
3.service broker use separate db

Closes-Bug: #1500777
Closes-Bug: #1500827
Change-Id: I2842828fe14878e6ff5ac194473f2ffa619370df
partial-implement: bp separate-service-broker-from-murano
tags/3.0.0.0b3
zhurong 3 年之前
父節點
當前提交
3d8d5a0b0e
共有 6 個文件被更改,包括 85 次插入21 次删除
  1. +49
    -7
      devstack/plugin.sh
  2. +1
    -0
      devstack/settings
  3. +0
    -6
      etc/murano/murano-paste.ini
  4. +29
    -7
      murano/cfapi/cfapi.py
  5. +1
    -1
      murano/db/services/cf_connections.py
  6. +5
    -0
      releasenotes/notes/separate-service-broker-from-murano-f6ee48576f51d893.yaml

+ 49
- 7
devstack/plugin.sh 查看文件

@@ -219,6 +219,20 @@ function set_packages_service_backend() {
fi
}

# configure_murano_cfapi() - Set config files
function configure_murano_cfapi {

# Generate Murano configuration file and configure common parameters.
oslo-config-generator --namespace keystonemiddleware.auth_token \
--namespace murano.cfapi \
--namespace oslo.db \
> $MURANO_CFAPI_CONF_FILE
cp $MURANO_DIR/etc/murano/murano-cfapi-paste.ini $MURANO_CONF_DIR

configure_service_broker

}

# install_murano_apps() - Install Murano apps from repository murano-apps, if required
function install_murano_apps() {
if [[ -z $MURANO_APPS ]]; then
@@ -256,11 +270,29 @@ function install_murano_apps() {

# configure_service_broker() - set service broker specific options to config
function configure_service_broker {
#Add needed options to murano.conf
iniset $MURANO_CONF_FILE cfapi tenant "$MURANO_CFAPI_DEFAULT_TENANT"
iniset $MURANO_CONF_FILE cfapi bind_host "$MURANO_SERVICE_HOST"
iniset $MURANO_CONF_FILE cfapi bind_port "$MURANO_CFAPI_SERVICE_PORT"
iniset $MURANO_CONF_FILE cfapi auth_url "http://${KEYSTONE_AUTH_HOST}:5000"

iniset $MURANO_CFAPI_CONF_FILE DEFAULT debug $MURANO_DEBUG
iniset $MURANO_CFAPI_CONF_FILE DEFAULT use_syslog $SYSLOG

#Add needed options to murano-cfapi.conf
iniset $MURANO_CFAPI_CONF_FILE cfapi tenant "$MURANO_CFAPI_DEFAULT_TENANT"
iniset $MURANO_CFAPI_CONF_FILE cfapi bind_host "$MURANO_SERVICE_HOST"
iniset $MURANO_CFAPI_CONF_FILE cfapi bind_port "$MURANO_CFAPI_SERVICE_PORT"
iniset $MURANO_CFAPI_CONF_FILE cfapi auth_url "http://${KEYSTONE_AUTH_HOST}:5000"

# configure the database.
iniset $MURANO_CFAPI_CONF_FILE database connection `database_connection_url murano_cfapi`

# Setup keystone_authtoken section
iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken auth_uri "http://${KEYSTONE_AUTH_HOST}:5000"
iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken auth_host $KEYSTONE_AUTH_HOST
iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken auth_port $KEYSTONE_AUTH_PORT
iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken cafile $KEYSTONE_SSL_CA
iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken admin_user $MURANO_ADMIN_USER
iniset $MURANO_CFAPI_CONF_FILE keystone_authtoken admin_password $SERVICE_PASSWORD

}

function prepare_core_library() {
@@ -281,6 +313,15 @@ function init_murano() {
$MURANO_BIN_DIR/murano-db-manage --config-file $MURANO_CONF_FILE upgrade
}

# init_murano_cfapi() - Initialize databases, etc.
function init_murano_cfapi() {

# (re)create Murano database
recreate_database murano_cfapi utf8

$MURANO_BIN_DIR/murano-cfapi-db-manage --config-file $MURANO_CFAPI_CONF_FILE upgrade
}

function setup_core_library() {
prepare_core_library

@@ -341,7 +382,7 @@ function stop_murano() {

# start_service_broker() - start murano CF service broker
function start_service_broker() {
screen_it murano-cfapi "cd $MURANO_DIR && $MURANO_BIN_DIR/murano-cfapi --config-file $MURANO_CONF_DIR/murano.conf"
screen_it murano-cfapi "cd $MURANO_DIR && $MURANO_BIN_DIR/murano-cfapi --config-file $MURANO_CONF_DIR/murano-cfapi.conf"
}


@@ -518,7 +559,7 @@ if is_service_enabled murano; then
configure_murano_dashboard
fi
if is_service_enabled murano-cfapi; then
configure_service_broker
configure_murano_cfapi
fi
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
echo_summary "Initializing Murano"
@@ -531,6 +572,7 @@ if is_service_enabled murano; then
restart_glare_service
fi
if is_service_enabled murano-cfapi; then
init_murano_cfapi
start_service_broker
fi
setup_core_library


+ 1
- 0
devstack/settings 查看文件

@@ -15,6 +15,7 @@ GITDIR["python-muranoclient"]=$DEST/python-muranoclient
MURANO_DIR=$DEST/murano
MURANO_CONF_DIR=${MURANO_CONF_DIR:-/etc/murano}
MURANO_CONF_FILE=${MURANO_CONF_DIR}/murano.conf
MURANO_CFAPI_CONF_FILE=${MURANO_CONF_DIR}/murano-cfapi.conf
MURANO_POLICY_FILE=${MURANO_CONF_DIR}/policy.json
MURANO_DEBUG=${MURANO_DEBUG:-True}
MURANO_ENABLE_MODEL_POLICY_ENFORCEMENT=${MURANO_ENABLE_MODEL_POLICY_ENFORCEMENT:-False}


+ 0
- 6
etc/murano/murano-paste.ini 查看文件

@@ -1,6 +1,3 @@
[pipeline:cloudfoundry]
pipeline = cors request_id ssl ext_context authtoken context cloudfoundryapi

[pipeline:murano]
pipeline = cors request_id ssl versionnegotiation faultwrap authtoken context rootapp

@@ -23,9 +20,6 @@ paste.app_factory = murano.api.versions:create_resource
[app:apiv1app]
paste.app_factory = murano.api.v1.router:API.factory

[app:cloudfoundryapi]
paste.app_factory = murano.cfapi.router:API.factory

[filter:versionnegotiation]
paste.filter_factory = murano.api.middleware.version_negotiation:VersionNegotiationFilter.factory



+ 29
- 7
murano/cfapi/cfapi.py 查看文件

@@ -26,6 +26,7 @@ from murano.common import auth_utils # noqa
from murano.common import wsgi
from murano.db.services import cf_connections as db_cf
import muranoclient.client as muranoclient
from muranoclient.common import exceptions
from muranoclient.glance import client as glare_client


@@ -116,16 +117,37 @@ class Controller(object):

token = req.headers['X-Auth-Token']
m_cli = _get_muranoclient(token, req)

def _set_new_environment_for_space(space_guid, log_msg):
body = {'name': 'my_{uuid}'.format(uuid=uuid.uuid4().hex)}
env = m_cli.environments.create(body)
db_cf.set_environment_for_space(space_guid, env.id)
LOG.info(log_msg.format(space_id=space_guid,
environment_id=env.id))
return env.id

try:
environment_id = db_cf.get_environment_for_space(space_guid)
# NOTE: Check that environment which was previously linked with
# CF space still exist, reset a new environment for space.
try:
env = m_cli.environments.get(environment_id)
except exceptions.HTTPNotFound:
msg = (_LI("Can not find environment_id {environment_id}, "
"will create a new one."
).format(environment_id=environment_id))
LOG.info(msg)
env = {}
if not env:
log_msg = (_LI("Cloud Foundry {space_id} remapped to "
"{environment_id}"))
environment_id = _set_new_environment_for_space(
space_guid, log_msg)
except AttributeError:
body = {'name': 'my_{uuid}'.format(uuid=uuid.uuid4().hex)}
env = m_cli.environments.create(body)
environment_id = env.id
db_cf.set_environment_for_space(space_guid, environment_id)
LOG.info(_LI("Cloud Foundry {space_id} mapped to {environment_id}")
.format(space_id=space_guid,
environment_id=environment_id))
log_msg = (_LI("Cloud Foundry {space_id} mapped to "
"{environment_id}"))
environment_id = _set_new_environment_for_space(
space_guid, log_msg)

package = m_cli.packages.get(service_id)
LOG.debug('Adding service {name}'.format(name=package.name))


+ 1
- 1
murano/db/services/cf_connections.py 查看文件

@@ -13,7 +13,7 @@
from oslo_db import exception
import sqlalchemy

from murano.db import models
from murano.db import cfapi_models as models
from murano.db import session as db_session




+ 5
- 0
releasenotes/notes/separate-service-broker-from-murano-f6ee48576f51d893.yaml 查看文件

@@ -0,0 +1,5 @@
---
features:
- Separate murano service broker from murano. Create separate db
and paste.ini for service broker. And move service broker api
to the top level.

Loading…
取消
儲存