Add doc architecture.

This commit is contained in:
lvdongbing 2016-01-08 04:48:59 -05:00
parent 684bf3b72e
commit 592f5fb53e
8 changed files with 998 additions and 190 deletions

28
CONTRIBUTING.rst Normal file
View File

@ -0,0 +1,28 @@
Before You Start
================
If you would like to contribute to the development of OpenStack,
you must follow the steps in this page:
http://docs.openstack.org/infra/manual/developers.html
Once those steps have been completed, changes to OpenStack
should be submitted for review via the Gerrit tool, following
the workflow documented at:
http://docs.openstack.org/infra/manual/developers.html#development-workflow
Reporting Bugs
==============
Pull requests submitted through Github will be ignored.
Bugs should be filed on Launchpad, not Github:
https://bugs.launchpad.net/bilean
Meet the Developers
===================
Real-time communication among developers are mostly done via IRC.
The team is using the #openstack-bilean channel on freenode.net.

View File

@ -23,3 +23,10 @@ Blueprints
Bug Tracking Bug Tracking
------------ ------------
- Bugs: https://bugs.launchpad.net/bilean - Bugs: https://bugs.launchpad.net/bilean
IRC
---
IRC Channel: #openstack-bilean on `Freenode`_.
.. _Freenode: http://freenode.net/

786
bilean/locale/bilean.pot Normal file
View File

@ -0,0 +1,786 @@
# Translations template for bilean.
# Copyright (C) 2016 ORGANIZATION
# This file is distributed under the same license as the bilean project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2016.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: bilean 2015.2.0.dev20\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-01-08 03:12-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.1.1\n"
#: bilean/api/validator.py:92
msgid "The input is not a string or unicode"
msgstr ""
#: bilean/api/validator.py:94
#, python-format
msgid "%s is not a string or unicode"
msgstr ""
#: bilean/api/validator.py:102
#, python-format
msgid "%(name)s must be in %(fields)s"
msgstr ""
#: bilean/api/validator.py:107
#, python-format
msgid "%(name)s has a minimum character requirement of %(min_length)s."
msgstr ""
#: bilean/api/validator.py:112
#, python-format
msgid "%(name)s has more than %(max_length)s characters."
msgstr ""
#: bilean/api/validator.py:121
#, python-format
msgid "%s is not a dict"
msgstr ""
#: bilean/api/validator.py:127
msgid "Expected resource_type field for resource"
msgstr ""
#: bilean/api/validator.py:132
msgid "Expected resource value field for resource"
msgstr ""
#: bilean/api/validator.py:142
#, python-format
msgid "%(value_name)s must be an integer"
msgstr ""
#: bilean/api/validator.py:148 bilean/api/validator.py:175
#, python-format
msgid "%(value_name)s must be >= %(min_value)d"
msgstr ""
#: bilean/api/validator.py:154 bilean/api/validator.py:181
#, python-format
msgid "%(value_name)s must be <= %(max_value)d"
msgstr ""
#: bilean/api/validator.py:169
#, python-format
msgid "%(value_name)s must be an float"
msgstr ""
#: bilean/api/validator.py:202
#, python-format
msgid "Expected object of type: %s"
msgstr ""
#: bilean/api/openstack/v1/policies.py:34
msgid "No policy name specified"
msgstr ""
#: bilean/api/openstack/v1/policies.py:105
#: bilean/api/openstack/v1/policies.py:122
msgid "Malformed request data, missing 'policy' key in request body."
msgstr ""
#: bilean/api/openstack/v1/resources.py:99
msgid "Resources is empty"
msgstr ""
#: bilean/api/openstack/v1/rules.py:34
msgid "No rule name specified"
msgstr ""
#: bilean/api/openstack/v1/rules.py:39
msgid "No rule spec provided"
msgstr ""
#: bilean/api/openstack/v1/rules.py:108
msgid "Malformed request data, missing 'rule' key in request body."
msgstr ""
#: bilean/api/openstack/v1/users.py:91
msgid "Malformed request data, missing 'value' key in request body."
msgstr ""
#: bilean/cmd/manage.py:64
msgid "How long to preserve deleted data."
msgstr ""
#: bilean/cmd/manage.py:68
msgid "Granularity to use for age argument, defaults to days."
msgstr ""
#: bilean/common/config.py:31
msgid "The API paste config file to use."
msgstr ""
#: bilean/common/config.py:36
msgid "Seconds between running periodic tasks."
msgstr ""
#: bilean/common/config.py:38
msgid "Default region name used to get services endpoints."
msgstr ""
#: bilean/common/config.py:41
msgid "Maximum raw byte size of data from web response."
msgstr ""
#: bilean/common/config.py:44
msgid "Number of heat-engine processes to fork and run."
msgstr ""
#: bilean/common/config.py:47
msgid "The directory to search for environment files."
msgstr ""
#: bilean/common/config.py:53
msgid ""
"Name of the engine node. This can be an opaque identifier. It is not "
"necessarily a hostname, FQDN, or IP address."
msgstr ""
#: bilean/common/config.py:61
msgid "Complete public identity V3 API endpoint."
msgstr ""
#: bilean/common/config.py:63
msgid "Bilean service user name"
msgstr ""
#: bilean/common/config.py:65
msgid "Password specified for the Bilean service user."
msgstr ""
#: bilean/common/config.py:67
msgid "Name of the service project."
msgstr ""
#: bilean/common/config.py:69
msgid "Name of the domain for the service user."
msgstr ""
#: bilean/common/config.py:71
msgid "Name of the domain for the service project."
msgstr ""
#: bilean/common/config.py:77
msgid ""
"Type of endpoint in Identity service catalog to use for communication "
"with the OpenStack service."
msgstr ""
#: bilean/common/config.py:81
msgid "Optional CA cert file to use in SSL connections."
msgstr ""
#: bilean/common/config.py:83
msgid "Optional PEM-formatted certificate chain file."
msgstr ""
#: bilean/common/config.py:85
msgid "Optional PEM-formatted file that contains the private key."
msgstr ""
#: bilean/common/config.py:88
msgid "If set, then the server's certificate will not be verified."
msgstr ""
#: bilean/common/config.py:94
msgid "Allow client's debug log output."
msgstr ""
#: bilean/common/config.py:99
msgid "Bilean API revision."
msgstr ""
#: bilean/common/config.py:101
msgid "Bilean engine revision."
msgstr ""
#: bilean/common/config.py:151
#, python-format
msgid "Unable to locate config file [%s]"
msgstr ""
#: bilean/common/config.py:164
#, python-format
msgid ""
"Unable to load %(app_name)s from configuration file %(conf_file)s.\n"
"Got: %(e)r"
msgstr ""
#: bilean/common/exception.py:41
msgid "An unknown exception occurred."
msgstr ""
#: bilean/common/exception.py:71
msgid "System SIGHUP signal received."
msgstr ""
#: bilean/common/exception.py:75
msgid "You are not authenticated."
msgstr ""
#: bilean/common/exception.py:79
msgid "You are not authorized to complete this action."
msgstr ""
#: bilean/common/exception.py:83
#, python-format
msgid "The request is malformed: %(msg)s"
msgstr ""
#: bilean/common/exception.py:87
#, python-format
msgid ""
"Multiple results found matching the query criteria %(arg)s. Please be "
"more specific."
msgstr ""
#: bilean/common/exception.py:92
#, python-format
msgid "Invalid value '%(value)s' specified for '%(name)s'"
msgstr ""
#: bilean/common/exception.py:96
#, python-format
msgid "Rule type (%(rule_type)s) is not found."
msgstr ""
#: bilean/common/exception.py:100 bilean/common/exception.py:112
#: bilean/common/exception.py:116 bilean/common/exception.py:128
#: bilean/common/exception.py:132 bilean/common/exception.py:207
#: bilean/common/exception.py:211
#, python-format
msgid "%(message)s"
msgstr ""
#: bilean/common/exception.py:104
#, python-format
msgid "The rule (%(rule)s) could not be found."
msgstr ""
#: bilean/common/exception.py:108
msgid "Rule not specified."
msgstr ""
#: bilean/common/exception.py:120
#, python-format
msgid "The policy (%(policy)s) could not be found."
msgstr ""
#: bilean/common/exception.py:124
#, python-format
msgid "The user (%(user)s) could not be found."
msgstr ""
#: bilean/common/exception.py:136
#, python-format
msgid "%(feature)s is not supported."
msgstr ""
#: bilean/common/exception.py:147
#, python-format
msgid "The %(resource_type)s (%(resource_id)s) is still in use."
msgstr ""
#: bilean/common/exception.py:151
#, python-format
msgid "Invalid content type %(content_type)s"
msgstr ""
#: bilean/common/exception.py:155
#, python-format
msgid "Request limit exceeded: %(message)s"
msgstr ""
#: bilean/common/exception.py:159
#, python-format
msgid "The event (%(event)s) could not be found."
msgstr ""
#: bilean/common/exception.py:163
msgid "%(msg)"
msgstr ""
#: bilean/common/exception.py:173
#, python-format
msgid "ERROR %(code)s happens for %(message)s."
msgstr ""
#: bilean/common/exception.py:174
msgid "Internal error happens"
msgstr ""
#: bilean/common/exception.py:184
#, python-format
msgid "The %(resource_type)s (%(resource_id)s) is busy now."
msgstr ""
#: bilean/common/exception.py:189
#, python-format
msgid "The trust for trustor (%(trustor)s) could not be found."
msgstr ""
#: bilean/common/exception.py:194
#, python-format
msgid "Failed in deleting %(resource)s."
msgstr ""
#: bilean/common/exception.py:198
#, python-format
msgid "The resource (%(resource)s) could not be found."
msgstr ""
#: bilean/common/exception.py:202
#, python-format
msgid ""
"The resource %(resource_id)s is in error status - '%(status)s' due to "
"'%(reason)s'."
msgstr ""
#: bilean/common/schema.py:33
#, python-format
msgid "Invalid key %s"
msgstr ""
#: bilean/common/schema.py:67
#, python-format
msgid "Schema valid only for List or Map, not \"%s\""
msgstr ""
#: bilean/common/schema.py:98
#, python-format
msgid "Invalid default %(default)s (%(exc)s)"
msgstr ""
#: bilean/common/schema.py:174
#, python-format
msgid "The value \"%s\" is not a valid Boolean"
msgstr ""
#: bilean/common/schema.py:199
#, python-format
msgid "%s is not an intger."
msgstr ""
#: bilean/common/schema.py:207
#, python-format
msgid "The value \"%s\" cannot be converted into an integer."
msgstr ""
#: bilean/common/schema.py:236
#, python-format
msgid "The value \"%s\" cannot be converted into a string."
msgstr ""
#: bilean/common/schema.py:299 bilean/common/schema.py:305
#, python-format
msgid "\"%s\" is not a List"
msgstr ""
#: bilean/common/schema.py:313 bilean/common/schema.py:345
#: bilean/common/schema.py:351 bilean/common/schema.py:357
#, python-format
msgid "\"%s\" is not a Map"
msgstr ""
#: bilean/common/schema.py:377
#, python-format
msgid "Spec validation error (%(key)s): %(err)s"
msgstr ""
#: bilean/common/schema.py:383
#, python-format
msgid "Unrecognizable spec item \"%s\""
msgstr ""
#: bilean/common/schema.py:388
#, python-format
msgid "Invalid spec item: \"%s\""
msgstr ""
#: bilean/common/schema.py:397
#, python-format
msgid "Required spec item \"%s\" not assigned"
msgstr ""
#: bilean/common/schema.py:419
msgid "The provided spec is not a map."
msgstr ""
#: bilean/common/schema.py:423
msgid "The 'type' key is missing from the provided spec map."
msgstr ""
#: bilean/common/schema.py:427
msgid "The 'version' key is missing from the provided spec map."
msgstr ""
#: bilean/common/utils.py:85
#, python-format
msgid "Invalid URL scheme %s"
msgstr ""
#: bilean/common/utils.py:91 bilean/common/utils.py:114
#, python-format
msgid "Failed to retrieve data: %s"
msgstr ""
#: bilean/common/wsgi.py:62
msgid ""
"Address to bind the server. Useful when selecting a particular network "
"interface."
msgstr ""
#: bilean/common/wsgi.py:65
msgid "The port on which the server will listen."
msgstr ""
#: bilean/common/wsgi.py:67
msgid "Number of backlog requests to configure the socket with."
msgstr ""
#: bilean/common/wsgi.py:70
msgid "Location of the SSL certificate file to use for SSL mode."
msgstr ""
#: bilean/common/wsgi.py:73
msgid "Location of the SSL key file to use for enabling SSL mode."
msgstr ""
#: bilean/common/wsgi.py:76
msgid "Number of workers for Bilean service."
msgstr ""
#: bilean/common/wsgi.py:78
msgid ""
"Maximum line size of message headers to be accepted. max_header_line may "
"need to be increased when using large tokens (typically those generated "
"by the Keystone v3 API with big service catalogs)."
msgstr ""
#: bilean/common/wsgi.py:83
msgid ""
"The value for the socket option TCP_KEEPIDLE. This is the time in "
"seconds that the connection must be idle before TCP starts sending "
"keepalive probes."
msgstr ""
#: bilean/common/wsgi.py:93
msgid "If false, closes the client socket explicitly."
msgstr ""
#: bilean/common/wsgi.py:95
msgid ""
"Timeout for client connections' socket operations. If an incoming "
"connection is idle for this number of seconds it will be closed. A value "
"of '0' indicates waiting forever."
msgstr ""
#: bilean/common/wsgi.py:105
msgid ""
"Maximum raw byte size of JSON request body. Should be larger than "
"max_template_size."
msgstr ""
#: bilean/common/wsgi.py:143
msgid ""
"When running server in SSL mode, you must specify both a cert_file and "
"key_file option value in your configuration file"
msgstr ""
#: bilean/common/wsgi.py:159
#, python-format
msgid "Could not bind to %(bind_addr)s after trying 30 seconds"
msgstr ""
#: bilean/common/wsgi.py:662
#, python-format
msgid ""
"JSON body size (%(len)s bytes) exceeds maximum allowed size (%(limit)s "
"bytes)."
msgstr ""
#: bilean/common/wsgi.py:727
msgid ""
"The server could not comply with the request since it is either malformed"
" or otherwise incorrect."
msgstr ""
#: bilean/engine/environment.py:83
#, python-format
msgid "environment has unknown section \"%s\""
msgstr ""
#: bilean/engine/environment.py:101
#, python-format
msgid "%s type name not specified"
msgstr ""
#: bilean/engine/environment.py:104
#, python-format
msgid "%s type name is not a string"
msgstr ""
#: bilean/engine/environment.py:129
#, python-format
msgid "Driver plugin %(name)s is not found."
msgstr ""
#: bilean/engine/event.py:144
#, python-format
msgid "Error generate events: %s"
msgstr ""
#: bilean/engine/parser.py:76
#, python-format
msgid "Error parsing input: %s"
msgstr ""
#: bilean/engine/parser.py:83
msgid "The input is not a JSON object or YAML mapping."
msgstr ""
#: bilean/engine/scheduler.py:34
msgid "The time zone of job, default is utc"
msgstr ""
#: bilean/engine/scheduler.py:37
msgid "The days notify user before user's balance is used up, default is 3 days."
msgstr ""
#: bilean/engine/scheduler.py:41
msgid ""
"Seconds after the designated run time that the job is still allowed to be"
" run."
msgstr ""
#: bilean/engine/scheduler.py:45
msgid "Allow bilean to store apscheduler job."
msgstr ""
#: bilean/engine/scheduler.py:154
msgid "Starting Billing scheduler"
msgstr ""
#: bilean/engine/scheduler.py:158
msgid "Stopping Billing scheduler"
msgstr ""
#: bilean/engine/scheduler.py:181 bilean/engine/scheduler.py:192
#: bilean/engine/scheduler.py:202 bilean/engine/scheduler.py:260
#: bilean/engine/scheduler.py:275
#, python-format
msgid "Failed in deleting job: %s"
msgstr ""
#: bilean/engine/service.py:162
#, python-format
msgid "The rule (%(name)s) already exists."
msgstr ""
#: bilean/engine/service.py:170
#, python-format
msgid "The specified rule type (%(type)s) is not supported."
msgstr ""
#: bilean/engine/service.py:323
#, python-format
msgid "Delete resource error %s"
msgstr ""
#: bilean/engine/service.py:352 bilean/engine/service.py:413
#, python-format
msgid "The policy (%(name)s) already exists."
msgstr ""
#: bilean/engine/service.py:366
#, python-format
msgid "More than one rule in type: '%s', it's not allowed."
msgstr ""
#: bilean/engine/user.py:220
msgid "Status change from freeze to active because of recharge."
msgstr ""
#: bilean/engine/user.py:227
msgid "Status change from warning to active because of recharge."
msgstr ""
#: bilean/engine/user.py:235
#, python-format
msgid "Freeze user because of: %s"
msgstr ""
#: bilean/engine/user.py:237
#, python-format
msgid "Balance of user %s overdraft, change user's status to 'freeze'"
msgstr ""
#: bilean/engine/clients/__init__.py:106
#, python-format
msgid "Invalid cloud_backend setting in bilean.conf detected - %s"
msgstr ""
#: bilean/engine/clients/os/cinder.py:59
msgid "No volume service available."
msgstr ""
#: bilean/engine/clients/os/glance.py:91
#, python-format
msgid "Error retrieving image list from glance: %s"
msgstr ""
#: bilean/engine/clients/os/nova.py:195
#, python-format
msgid "Server %(name)s delete failed: (%(code)s) %(message)s"
msgstr ""
#: bilean/engine/clients/os/nova.py:227
#, python-format
msgid "Resizing to '%(flavor)s' failed, status '%(status)s'"
msgstr ""
#: bilean/engine/clients/os/nova.py:246
#, python-format
msgid "Rebuilding server failed, status '%s'"
msgstr ""
#: bilean/engine/clients/os/nova.py:251
msgid "nova server metadata needs to be a Map."
msgstr ""
#: bilean/notification/action.py:68
msgid "Id of resource can not be None"
msgstr ""
#: bilean/notification/action.py:71
msgid "User_id of resource can not be None"
msgstr ""
#: bilean/notification/action.py:74
msgid "Resource_type of resource can not be None"
msgstr ""
#: bilean/notification/action.py:77
msgid "Properties of resource can not be empty"
msgstr ""
#: bilean/notification/converter.py:56
#, python-format
msgid "Resource Definitions configuration file: %s"
msgstr ""
#: bilean/notification/converter.py:67
#, python-format
msgid ""
"Invalid YAML syntax in Resource Definitions file %(file)s at line: "
"%(line)s, column: %(column)s."
msgstr ""
#: bilean/notification/converter.py:73
#, python-format
msgid "YAML error reading Resource Definitions file %(file)s"
msgstr ""
#: bilean/notification/converter.py:79
msgid "No Resource Definitions configuration file found! Using default config."
msgstr ""
#: bilean/notification/converter.py:83
#, python-format
msgid "Resource Definitions: %s"
msgstr ""
#: bilean/notification/converter.py:110
#, python-format
msgid "Dropping Notification %(type)s"
msgstr ""
#: bilean/notification/converter.py:136 bilean/notification/converter.py:191
#, python-format
msgid "Required field %s not specified"
msgstr ""
#: bilean/notification/converter.py:225
#, python-format
msgid "Required field in trait definition not specified: '%s'"
msgstr ""
#: bilean/notification/converter.py:240
#, python-format
msgid ""
"Parse error in JSONPath specification '%(jsonpath)s' for %(trait)s: "
"%(err)s"
msgstr ""
#: bilean/notification/converter.py:246
#, python-format
msgid "Invalid trait type '%(type)s' for trait %(trait)s"
msgstr ""
#: bilean/notification/endpoint.py:47
#, python-format
msgid "Receive notification: %s"
msgstr ""
#: bilean/notification/endpoint.py:62
#, python-format
msgid "Notify engine to %(action)s user: %(user)s"
msgstr ""
#: bilean/notification/endpoint.py:81
#, python-format
msgid "Notify engine to %(action)s resource: %(resource)s"
msgstr ""
#: bilean/notification/endpoint.py:93
#, python-format
msgid "Can not get action info in event_type: %s"
msgstr ""
#: bilean/notification/notification.py:43
#, python-format
msgid "Starting listener on topic: %s"
msgstr ""
#: bilean/rules/base.py:37
msgid "Name of the rule type."
msgstr ""
#: bilean/rules/base.py:41
msgid "Version number of the rule type."
msgstr ""
#: bilean/rules/base.py:45
msgid "Properties for the rule."
msgstr ""
#: bilean/rules/os/nova/server.py:46
msgid "A list specifying the price of each flavor"
msgstr ""
#: bilean/rules/os/nova/server.py:48
msgid "A map specifying the pricce of a flavor."
msgstr ""
#: bilean/rules/os/nova/server.py:51
msgid "Flavor id to set price."
msgstr ""
#: bilean/rules/os/nova/server.py:54
msgid "Price of this flavor."
msgstr ""
#: bilean/rules/os/nova/server.py:62
msgid "Unit of price, per_hour or per_sec."
msgstr ""

102
doc/source/install.rst Normal file
View File

@ -0,0 +1,102 @@
..
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.
.. _guide-install:
============
Installation
============
1. Get Bilean source code from Github
::
$ cd /opt/stack
$ git clone https://github.com/lvdongbing/bilean.git
2. Install Bilean with required packages
::
$ cd /opt/stack/bilean
$ sudo pip install -e .
3. Register Bilean service with keystone.
This can be done using the :command:`setup-service` script under the
:file:`tools` folder.
::
$ source ~/devstack/openrc admin
$ cd /opt/stack/bilean/tools
$ ./setup-service <HOST IP> <SERVICE_PASSWORD>
4. Generate configuration file for the Bilean service.
::
$ cd /opt/stack/bilean
$ tools/gen-config
$ sudo mkdir /etc/bilean
$ sudo cp etc/bilean/api-paste.ini /etc/bilean
$ sudo cp etc/bilean/policy.json /etc/bilean
$ sudo cp etc/bilean/resource_definitions.yaml /etc/bilean
$ sudo cp etc/bilean/bilean.conf.sample /etc/bilean/bilean.conf
Edit file :file:`/etc/bilean/bilean.conf` according to your system settings.
The most common options to be customized include:
::
[database]
connection = mysql://root:<DB PASSWORD>@127.0.0.1/bilean?charset=utf8
[keystone_authtoken]
auth_uri = http://<HOST>:5000/v3
auth_version = 3
cafile = /opt/stack/data/ca-bundle.pem
identity_uri = http://<HOST>:35357
admin_user = bilean
admin_password = <BILEAN PASSWORD>
admin_tenant_name = service
[authentication]
auth_url = http://<HOST>:5000/v3
service_username = bilean
service_password = <BILEAN PASSWORD>
service_project_name = service
[oslo_messaging_rabbit]
rabbit_userid = <RABBIT USER ID>
rabbit_hosts = <HOST>
rabbit_password = <RABBIT PASSWORD>
5. Create Bilean Database
Create Bilean database using the :command:`bilean-db-recreate` script under
the :file:`tools` subdirectory.
::
$ cd /opt/stack/bilean/tools
$ ./bilean-db-recreate <DB PASSWORD>
6. Start bilean engine and api service.
You may need two consoles for the services each.
::
$ bilean-engine --config-file /etc/bilean/bilean.conf
$ bilean-api --config-file /etc/bilean/bilean.conf

16
tools/bilean-db-recreate Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` <MYSQL_PASSWORD>"
exit
fi
MYSQL_PASSWORD=$1
echo "Recreating 'bilean' database."
cat << EOF | mysql -u root --password=${MYSQL_PASSWORD}
DROP DATABASE IF EXISTS bilean;
CREATE DATABASE bilean DEFAULT CHARACTER SET utf8;
EOF
bilean-manage db_sync

View File

@ -1,18 +0,0 @@
#!/bin/bash
HOST_IP="192.168.142.14"
REGION="RegionOne"
BILEAN_USER="bileanUser"
BILEAN_PASS="bileanPass"
mysql -u root -p123123 -e "DROP DATABASE IF EXISTS bilean;"
mysql -u root -p123123 -e "CREATE DATABASE bilean;"
mysql -u root -p123123 -e "GRANT ALL PRIVILEGES ON bilean.* TO '$BILEAN_USER'@'%' IDENTIFIED BY '$BILEAN_PASS';"
bilean-manage db_sync
keystone service-create --name bilean --type billing --description "Openstack Billing Service"
service_id=`keystone service-list|grep billing |awk '{print $2}'`
keystone endpoint-create --region $REGION --service $service_id --publicurl http://$HOST_IP:8770/v1/$\(tenant_id\)s --adminurl http://$HOST_IP:8770/v1/$\(tenant_id\)s --internalurl http://$HOST_IP:8770/v1/$\(tenant_id\)s
keystone user-create --name $BILEAN_USER --pass $BILEAN_PASS --email bilean@domain.com
keystone user-role-add --user=$BILEAN_USER --tenant=service --role=admin

View File

@ -1,172 +0,0 @@
# Copyright 2013 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# 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.
"""Provides methods needed by installation script for OpenStack development
virtual environments.
Since this script is used to bootstrap a virtualenv from the system's Python
environment, it should be kept strictly compatible with Python 2.6.
Synced in from openstack-common
"""
from __future__ import print_function
import optparse
import os
import subprocess
import sys
class InstallVenv(object):
def __init__(self, root, venv, requirements,
test_requirements, py_version,
project):
self.root = root
self.venv = venv
self.requirements = requirements
self.test_requirements = test_requirements
self.py_version = py_version
self.project = project
def die(self, message, *args):
print(message % args, file=sys.stderr)
sys.exit(1)
def check_python_version(self):
if sys.version_info < (2, 6):
self.die("Need Python Version >= 2.6")
def run_command_with_code(self, cmd, redirect_output=True,
check_exit_code=True):
"""Runs a command in an out-of-process shell.
Returns the output of that command. Working directory is self.root.
"""
if redirect_output:
stdout = subprocess.PIPE
else:
stdout = None
proc = subprocess.Popen(cmd, cwd=self.root, stdout=stdout)
output = proc.communicate()[0]
if check_exit_code and proc.returncode != 0:
self.die('Command "%s" failed.\n%s', ' '.join(cmd), output)
return (output, proc.returncode)
def run_command(self, cmd, redirect_output=True, check_exit_code=True):
return self.run_command_with_code(cmd, redirect_output,
check_exit_code)[0]
def get_distro(self):
if (os.path.exists('/etc/fedora-release') or
os.path.exists('/etc/redhat-release')):
return Fedora(
self.root, self.venv, self.requirements,
self.test_requirements, self.py_version, self.project)
else:
return Distro(
self.root, self.venv, self.requirements,
self.test_requirements, self.py_version, self.project)
def check_dependencies(self):
self.get_distro().install_virtualenv()
def create_virtualenv(self, no_site_packages=True):
"""Creates the virtual environment and installs PIP.
Creates the virtual environment and installs PIP only into the
virtual environment.
"""
if not os.path.isdir(self.venv):
print('Creating venv...', end=' ')
if no_site_packages:
self.run_command(['virtualenv', '-q', '--no-site-packages',
self.venv])
else:
self.run_command(['virtualenv', '-q', self.venv])
print('done.')
else:
print("venv already exists...")
pass
def pip_install(self, *args):
self.run_command(['tools/with_venv.sh',
'pip', 'install', '--upgrade'] + list(args),
redirect_output=False)
def install_dependencies(self):
print('Installing dependencies with pip (this can take a while)...')
# First things first, make sure our venv has the latest pip and
# setuptools and pbr
self.pip_install('pip>=1.4')
self.pip_install('setuptools')
self.pip_install('pbr')
self.pip_install('-r', self.requirements, '-r', self.test_requirements)
def parse_args(self, argv):
"""Parses command-line arguments."""
parser = optparse.OptionParser()
parser.add_option('-n', '--no-site-packages',
action='store_true',
help="Do not inherit packages from global Python "
"install.")
return parser.parse_args(argv[1:])[0]
class Distro(InstallVenv):
def check_cmd(self, cmd):
return bool(self.run_command(['which', cmd],
check_exit_code=False).strip())
def install_virtualenv(self):
if self.check_cmd('virtualenv'):
return
if self.check_cmd('easy_install'):
print('Installing virtualenv via easy_install...', end=' ')
if self.run_command(['easy_install', 'virtualenv']):
print('Succeeded')
return
else:
print('Failed')
self.die('ERROR: virtualenv not found.\n\n%s development'
' requires virtualenv, please install it using your'
' favorite package management tool' % self.project)
class Fedora(Distro):
"""This covers all Fedora-based distributions.
Includes: Fedora, RHEL, CentOS, Scientific Linux
"""
def check_pkg(self, pkg):
return self.run_command_with_code(['rpm', '-q', pkg],
check_exit_code=False)[1] == 0
def install_virtualenv(self):
if self.check_cmd('virtualenv'):
return
if not self.check_pkg('python-virtualenv'):
self.die("Please install 'python-virtualenv'.")
super(Fedora, self).install_virtualenv()

59
tools/setup-service Executable file
View File

@ -0,0 +1,59 @@
#!/bin/bash
if [[ -z $OS_AUTH_URL ]]; then
echo "This script must have proper environment variables exported."
echo "Please check if you have sourced bileanrc file or openrc file if "
echo "you are using devstack."
exit -1
fi
if [ $OS_USERNAME != 'admin' ]; then
echo "This script has to be executed as an 'admin' user."
echo "Please set environment variable OS_USERNAME to 'admin'."
exit -1
fi
if [ $# -ne 2 ]; then
echo "Usage: `basename $0` <HOST_IP> <SERVICE_PASSWORD>"
exit -1
fi
PORT=8770
HOST=$1 # Put your host IP here
SVC_PASSWD=$2
SERVICE_ID=$(openstack service show bilean -f value -cid 2>/dev/null)
if [[ -z $SERVICE_ID ]]; then
SERVICE_ID=$(openstack service create \
--name bilean \
--description 'Billing Service V1' \
-f value -cid \
billing)
fi
if [[ -z $SERVICE_ID ]]; then
exit
fi
openstack endpoint create \
--adminurl "http://$HOST:$PORT/v1" \
--publicurl "http://$HOST:$PORT/v1" \
--internalurl "http://$HOST:$PORT/v1" \
--region RegionOne \
bilean
openstack user create \
--password "$SVC_PASSWD" \
--project service \
bilean
openstack role add \
admin \
--user bilean \
--project service
# make sure 'bilean' has 'service' role in 'demo' project
openstack role add \
service \
--user bilean \
--project demo