Can specify OpenStack region

Change-Id: I4ae7efb85da9021c20fe988058ad64220371901c
This commit is contained in:
takehirokaneko 2014-10-06 17:22:47 +09:00
parent 68cab360c8
commit b6867a4540
17 changed files with 61 additions and 48 deletions

View File

@ -1,7 +1,14 @@
RACK(Real Application Centric Kernel) README
=====================
# The concept of RACK: "OpenStack Native Application"
## RACK Project Resources
OpenStack Native Application is the software, which uses OpenStack resource (eg. VM or VNET) directly from application. Recent popular applications are designed before the cloud computing age, so affinity with cloud is not considered. In order to make those applications work on OpenStack, tools such as Chef, Puppet and other tools are required, and it makes systems very complex in design.
* [Wiki](https://wiki.openstack.org/wiki/RACK)
* [Library](https://github.com/stackforge/python-rackclient)
RACK provides the mechanism to create “After the Cloud” applications. Programmer can write codes that are scalable and migratable on OpenStack platform without cooperating with the external systems.
Concepts of RACK are as follows:
1. RACK handles VM with "functions" as a single execution binary file. “Functions” here means OS, middleware and programs that are necessary for application to function. The programs here are made in such a way as to call and operate RACK API.
2. When this execution binary is deployed onto OpenStack, the VM will behave like a Linux process and then finish its own task.
3. This process is based on the descriptions in the program. It does things such as forking and generating a child process, communicating between processes.
Please take a look at our Wiki page to understand RACK more!
**https://wiki.openstack.org/wiki/RACK**

View File

@ -10,5 +10,6 @@
#os_password = password
#os_tenant_name = demo
#os_auth_url = http://localhost:5000/v2.0
#os_region_name = RegionOne
#ipc_port = 8888
#shm_port = 6379

View File

@ -1,7 +1,6 @@
[DEFAULT]
# The list of modules to copy from oslo-incubator.git
module=cliutils
module=config
module=context
module=db
@ -11,37 +10,19 @@ module=excutils
module=fileutils
module=fixture
module=gettextutils
module=imageutils
module=importutils
module=install_venv_common
module=jsonutils
module=local
module=lockutils
module=log
module=loopingcall
module=memorycache
module=middleware/base
module=middleware/request_id
module=network_utils
module=periodic_task
module=policy
module=processutils
module=report
module=report.generators
module=report.models
module=report.views
module=report.views.xml
module=report.views.json
module=report.views.text
module=service
module=sslutils
module=strutils
module=threadgroup
module=timeutils
module=units
module=uuidutils
module=versionutils
module=xmlutils
# The base module to hold the copy of openstack.common
base=rack

View File

@ -250,6 +250,7 @@ class Controller(wsgi.Controller):
default_args["os_password"] = cfg.CONF.os_password
default_args["os_tenant_name"] = cfg.CONF.os_tenant_name
default_args["os_auth_url"] = cfg.CONF.os_auth_url
default_args["os_region_name"] = cfg.CONF.os_region_name
else:
proxy_instance_id = proxy[0]["nova_instance_id"]
default_args["proxy_ip"] = self.manager.get_process_address(

View File

@ -27,7 +27,9 @@ openstack_client_opts = [
cfg.StrOpt('os_tenant_name',
help='Valid tenant name for OpenStack'),
cfg.StrOpt('os_auth_url',
help='The keystone endpoint')
help='The keystone endpoint'),
cfg.StrOpt('os_region_name',
help='Valid region name for OpenStack')
]
CONF = cfg.CONF
@ -41,7 +43,8 @@ def get_nova_client():
"username": CONF.os_username,
"api_key": CONF.os_password,
"project_id": CONF.os_tenant_name,
"auth_url": CONF.os_auth_url
"auth_url": CONF.os_auth_url,
"region_name": CONF.os_region_name
}
for key, value in credentials.items():
@ -56,7 +59,8 @@ def get_neutron_client():
"username": CONF.os_username,
"password": CONF.os_password,
"tenant_name": CONF.os_tenant_name,
"auth_url": CONF.os_auth_url
"auth_url": CONF.os_auth_url,
"region_name": CONF.os_region_name
}
for key, value in credentials.items():

View File

@ -485,6 +485,7 @@ class ProcessesTest(test.NoDBTestCase):
self.mox.StubOutWithMock(cfg.CONF, "os_password")
self.mox.StubOutWithMock(cfg.CONF, "os_tenant_name")
self.mox.StubOutWithMock(cfg.CONF, "os_auth_url")
self.mox.StubOutWithMock(cfg.CONF, "os_region_name")
db.process_get_all(
IsA(context.RequestContext), GID, filters=IsA(dict))\
.AndReturn([])
@ -509,6 +510,7 @@ class ProcessesTest(test.NoDBTestCase):
cfg.CONF.os_password = "os_password_data"
cfg.CONF.os_tenant_name = "os_tenant_name_data"
cfg.CONF.os_auth_url = "os_auth_url_data"
cfg.CONF.os_region_name = "os_region_name"
self.mox.ReplayAll()
process = _base_process1(GID, PID1)
@ -528,6 +530,7 @@ class ProcessesTest(test.NoDBTestCase):
expect["proxy"]["args"].update(os_password="os_password_data")
expect["proxy"]["args"].update(os_tenant_name="os_tenant_name_data")
expect["proxy"]["args"].update(os_auth_url="os_auth_url_data")
expect["proxy"]["args"].update(os_region_name="os_region_name")
for key in body["proxy"]:
self.assertEqual(body["proxy"][key], expect["proxy"][key])
@ -540,6 +543,7 @@ class ProcessesTest(test.NoDBTestCase):
self.mox.StubOutWithMock(cfg.CONF, "os_password")
self.mox.StubOutWithMock(cfg.CONF, "os_tenant_name")
self.mox.StubOutWithMock(cfg.CONF, "os_auth_url")
self.mox.StubOutWithMock(cfg.CONF, "os_region_name")
db.process_get_all(
IsA(context.RequestContext), GID, filters=IsA(dict))\
.AndReturn([])
@ -564,6 +568,7 @@ class ProcessesTest(test.NoDBTestCase):
cfg.CONF.os_password = "os_password_data"
cfg.CONF.os_tenant_name = "os_tenant_name_data"
cfg.CONF.os_auth_url = "os_auth_url_data"
cfg.CONF.os_region_name = "os_region_name"
self.mox.ReplayAll()
process = _base_process1(GID, PID1)
@ -584,6 +589,7 @@ class ProcessesTest(test.NoDBTestCase):
expect["proxy"]["args"].update(os_password="os_password_data")
expect["proxy"]["args"].update(os_tenant_name="os_tenant_name_data")
expect["proxy"]["args"].update(os_auth_url="os_auth_url_data")
expect["proxy"]["args"].update(os_region_name="os_region_name")
expect["proxy"].update(name="proxy-" + PID1)
for key in body["proxy"]:
self.assertEqual(body["proxy"][key], expect["proxy"][key])
@ -596,6 +602,7 @@ class ProcessesTest(test.NoDBTestCase):
self.mox.StubOutWithMock(cfg.CONF, "os_password")
self.mox.StubOutWithMock(cfg.CONF, "os_tenant_name")
self.mox.StubOutWithMock(cfg.CONF, "os_auth_url")
self.mox.StubOutWithMock(cfg.CONF, "os_region_name")
db.process_get_all(
IsA(context.RequestContext), GID, filters=IsA(dict))\
.AndReturn([])
@ -610,6 +617,7 @@ class ProcessesTest(test.NoDBTestCase):
cfg.CONF.os_password = "os_password_data"
cfg.CONF.os_tenant_name = "os_tenant_name_data"
cfg.CONF.os_auth_url = "os_auth_url_data"
cfg.CONF.os_region_name = "os_region_name"
self.mox.ReplayAll()
process = _base_process1(GID, PID1)
@ -629,6 +637,7 @@ class ProcessesTest(test.NoDBTestCase):
self.mox.StubOutWithMock(cfg.CONF, "os_password")
self.mox.StubOutWithMock(cfg.CONF, "os_tenant_name")
self.mox.StubOutWithMock(cfg.CONF, "os_auth_url")
self.mox.StubOutWithMock(cfg.CONF, "os_region_name")
db.process_get_all(
IsA(context.RequestContext), GID, filters=IsA(dict))\
.AndReturn([])
@ -643,6 +652,7 @@ class ProcessesTest(test.NoDBTestCase):
cfg.CONF.os_password = "os_password_data"
cfg.CONF.os_tenant_name = "os_tenant_name_data"
cfg.CONF.os_auth_url = "os_auth_url_data"
cfg.CONF.os_region_name = "os_region_name"
self.mox.ReplayAll()
process = _base_process1(GID, PID1)
@ -662,6 +672,7 @@ class ProcessesTest(test.NoDBTestCase):
self.mox.StubOutWithMock(cfg.CONF, "os_password")
self.mox.StubOutWithMock(cfg.CONF, "os_tenant_name")
self.mox.StubOutWithMock(cfg.CONF, "os_auth_url")
self.mox.StubOutWithMock(cfg.CONF, "os_region_name")
db.process_get_all(
IsA(context.RequestContext), GID, filters=IsA(dict))\
.AndReturn([])
@ -676,6 +687,7 @@ class ProcessesTest(test.NoDBTestCase):
cfg.CONF.os_password = "os_password_data"
cfg.CONF.os_tenant_name = "os_tenant_name_data"
cfg.CONF.os_auth_url = "os_auth_url_data"
cfg.CONF.os_region_name = "os_region_name"
self.mox.ReplayAll()
process = _base_process1(GID, PID1)

View File

@ -30,7 +30,8 @@ CREDENTIALS = {
"os_username": "fake",
"os_password": "fake",
"os_tenant_name": "fake",
"os_auth_url": "fake"
"os_auth_url": "fake",
"os_region_name": "fake"
}
cfg.set_defaults(os_client.openstack_client_opts, **CREDENTIALS)

View File

@ -25,7 +25,8 @@ CREDENTIALS = {
"os_username": "fake",
"os_password": "fake",
"os_tenant_name": "fake",
"os_auth_url": "fake"
"os_auth_url": "fake",
"os_region_name": "fake"
}
cfg.set_defaults(os_client.openstack_client_opts, **CREDENTIALS)

View File

@ -33,6 +33,7 @@ class ProcessesTest(test.NoDBTestCase):
cfg.CONF.os_password = "os_password"
cfg.CONF.os_tenant_name = "os_tenant_name"
cfg.CONF.os_auth_url = "os_auth_url"
cfg.CONF.os_region_name = "os_region_name"
self.process_client = processes.ProcessesAPI()
self.nova = os_client.get_nova_client()

View File

@ -27,7 +27,8 @@ CREDENTIALS = {
"os_username": "fake",
"os_password": "fake",
"os_tenant_name": "fake",
"os_auth_url": "fake"
"os_auth_url": "fake",
"os_region_name": "fake"
}
cfg.set_defaults(os_client.openstack_client_opts, **CREDENTIALS)

View File

@ -89,9 +89,10 @@ Error: Installing the required packages
### 2. Initialize the process group
This section describes how to set up an environment for this application. `rack-api` needs to be run before proceeding this step.
For details of installation of `rack-api`, please refer to [**here**](https://github.com/stackforge/rack/tree/master/tools/setup).
First, we will create a configuration file for process group initialization on RACK CLI installed machine.
For details of installation of RACK CLI, please refer to [**here**](https://github.com/stackforgehon-rackclient).
For details of installation of RACK CLI, please refer to [**here**](https://github.com/stackforge/python-rackclient).
Please fill empty section with your environment parameters.

View File

@ -93,7 +93,7 @@ Error: Installing the required packages
本アプリケーションを動作させるための環境を用意します。
事前に`rack-api`が起動している必要があります。
`rack-api`の準備については[**こちら**](https://github.com/stackforge/rack/tree/master/tools/setup/)をご覧ください。
`rack-api`の準備については[**こちら**](https://github.com/stackforge/rack/blob/master/tools/setup/README_ja.md)をご覧ください。
RACK CLIを導入したマシン上で、グループ初期化用の設定ファイルを作成します。
RACK CLIの導入方法については[**こちら**](https://github.com/stackforge/python-rackclient)をご覧ください。

View File

@ -87,11 +87,11 @@ Error: Installing the required packages
### 2. Initialize the process group
This section explains how to set up an environment for this application. `rack-api` needs to be run before proceeding this step.
For details of installation of RACK CLI, please refer to [**here**](https://github.com/stackforgehon-rackclient).
This section describes how to set up an environment for this application. `rack-api` needs to be run before proceeding this step.
For details of installation of `rack-api`, please refer to [**here**](https://github.com/stackforge/rack/tree/master/tools/setup).
First, we will create a configuration file for process group initialization on RACK CLI installed machine.
For details of installation of RACK CLI, please refer to [**here**](https://github.com/stackforgehon-rackclient).
For details of installation of RACK CLI, please refer to [**here**](https://github.com/stackforge/python-rackclient).
Please fill empty section with your environment parameters.

View File

@ -95,7 +95,7 @@ Error: Installing the required packages
本アプリケーションを動作させるための環境を用意します。
事前に`rack-api`が起動している必要があります。
`rack-api`の準備については[**こちら**](https://github.com/stackforge/rack/tree/master/tools/setup/)をご覧ください。
`rack-api`の準備については[**こちら**](https://github.com/stackforge/rack/blob/master/tools/setup/README_ja.md)をご覧ください。
RACK CLIを導入したマシン上で、グループ初期化用の設定ファイルを作成します。
RACK CLIの導入方法については[**こちら**](https://github.com/stackforge/python-rackclient)をご覧ください。

View File

@ -99,14 +99,15 @@ Please note that OpenStack authentication info fed as meta-data will be written
```
# nova boot ¥
--flavor { any flavor with more than 2GB RAM } ¥
--image { snapshot created at step #3.1 } ¥
--nic net-id={ virtual network created at step #3.2 } ¥
--meta os_username={Keystone username} ¥
--meta os_password={Keystone password} ¥
--meta os_tenant_name={Keystone tenant name} ¥
--meta os_auth_url={Keystone API URL} ¥
# nova boot \
--flavor { any flavor with more than 2GB RAM } \
--image { snapshot created at step #3.1 } \
--nic net-id={ virtual network created at step #3.2 } \
--meta os_username={Keystone username} \
--meta os_password={Keystone password} \
--meta os_tenant_name={Keystone tenant name} \
--meta os_auth_url={Keystone API URL} \
--meta os_region_name={region name} \
rack-api
```
@ -119,7 +120,6 @@ $ rack group-list
+-----+------+-------------+--------+
| gid | name | description | status |
+-----+------+-------------+--------+
| | | | |
+-----+------+-------------+--------+
```
@ -127,4 +127,4 @@ $ rack group-list
## <a name="procedure2">Test RACK with devstack</a>
**to be continued**
**to be continued**

View File

@ -108,6 +108,7 @@ Nova CLIを利用し、以下のコマンドを実行してください。
--meta os_password={Keystone認証用のパスワード} \
--meta os_tenant_name={Keystone認証用のテナント名} \
--meta os_auth_url={Keystone APIのURL} \
--meta os_region_name={リージョン名}
rack-api
```
@ -121,7 +122,6 @@ $ rack group-list
+-----+------+-------------+--------+
| gid | name | description | status |
+-----+------+-------------+--------+
| | | | |
+-----+------+-------------+--------+
```
@ -129,4 +129,4 @@ $ rack group-list
## <a name="procedure2">devstackを使ってRACKを試す</a>
**準備中**
**準備中**

View File

@ -11,6 +11,7 @@ OS_USERNAME=$(echo $META | jq -r '.os_username')
OS_PASSWORD=$(echo $META | jq -r '.os_password')
OS_TENANT_NAME=$(echo $META | jq -r '.os_tenant_name')
OS_AUTH_URL=$(echo $META | jq -r '.os_auth_url')
OS_REGION_NAME=$(echo $META | jq -r '.os_region_name')
if [ "$OS_USERNAME" == "null" ] || [ "$OS_PASSWORD" == "null" ] ||\
[ "$OS_TENANT_NAME" == "null" ] || [ "$OS_AUTH_URL" == "null" ]; then
echo "Error: OpenStack credentials are required."
@ -21,6 +22,7 @@ os_username = $OS_USERNAME
os_password = $OS_PASSWORD
os_tenant_name = $OS_TENANT_NAME
os_auth_url = $OS_AUTH_URL
os_region_name = $OS_REGION_NAME
EOF