Skip navigation

2015-07-27

OpenStack RDO Managerインストール後の操作 (1)

動作確認として、OpenStack RedHat RDO Managerのインストール後の操作を行います。 instackへログインして、そこからOvercloudのOpenStackを操作します。 実際には、基本的なOpenStackの操作と同じです。 ここでは、

  1. テナントの作成
  2. テナントネットワークの作成
  3. セキュリティグループの作成 を行います。

instackへログインしていない場合は、 stackユーザーでRDOマネージャホストへssh公開鍵ログインし、instack VMへrootログインし、stackへ遷移します。 Overcloud のOpenStackを操作するため source overcloudrc で各種環境変数をロードしておく必要があります。

$ ssh -i ~/.ssh/id_rsa stack@192.168.100.30
[stack@rdo ~]$ su - stack
Password:
[stack@rdo ~]$ ssh root@192.168.122.221
[root@instack ~]# su - stack
[stack@instack ~]$ source overcloudrc
[stack@instack ~]$ screen

ここからの作業は、時間がかかることがありますので、上記のように screen を使用してください。

テナントの作成

動作確認のためのテナントを作成します。

テナントの作成

テナントを作成します。test_tenantとします。

[stack@instack ~]$ keystone tenant-list
+----------------------------------+---------+---------+
|                id                |   name  | enabled |
+----------------------------------+---------+---------+
| daede38bd58b44608fd46322c5862f9f |  admin  |   True  |
| df2635f58967453b986c57c72780db3e | service |   True  |
+----------------------------------+---------+---------+
[stack@instack ~]$ keystone tenant-create --name test_tenant --description "test_tenant" --enabled true
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |           test_tenant            |
|   enabled   |               True               |
|      id     | 2fc48b580ade4758a382694689d15a86 |
|     name    |           test_tenant            |
+-------------+----------------------------------+

テナントユーザーの作成

テナントのIDを使用して、テナントユーザーを作成します。 現時点では、既存の管理者ロール admin のロールとします。

[stack@instack ~]$ keystone user-create --tenant_id 2fc48b580ade4758a382694689d15a86 --name test_tenant_admin --pass test_tenant_admin --enable true
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | c353396d52a14bd99ef0131ff555057d |
|   name   |        test_tenant_admin         |
| tenantId | 2fc48b580ade4758a382694689d15a86 |
| username |        test_tenant_admin         |
+----------+----------------------------------+
[stack@instack ~]$ keystone role-list
+----------------------------------+-----------------+
|                id                |       name      |
+----------------------------------+-----------------+
| 04e3b05a95db49be87ef0356618b9b45 |  ResellerAdmin  |
| 9fe2ff9ee4384b1894a90878d3e92bab |     _member_    |
| cd31ee0cfee1445195b4021e7985fb71 |      admin      |
| 13b510bcc2234fc08b75e65ef391201a | heat_stack_user |
| a163c3cf5b4a403ebd4ca86e42ab0fff |  swiftoperator  |
+----------------------------------+-----------------+
[stack@instack ~]$ keystone user-role-add --user test_tenant_admin --tenant_id 2fc48b580ade4758a382694689d15a86 --role admin

テナントユーザーの環境設定

overcloudrcをコピーして、テナントユーザーの環境変数を設定します。

[stack@instack ~]$ cp overcloudrc test_tenant_admin_rc
[stack@instack ~]$ sed -i "s/OS_USERNAME=.*$/OS_USERNAME=test_tenant_admin/g" test_tenant_admin_rc
[stack@instack ~]$ sed -i "s/OS_TENANT_NAME.*$/OS_TENANT_NAME=test_tenant/g" test_tenant_admin_rc
[stack@instack ~]$ sed -i "s/OS_PASSWORD.*$/OS_PASSWORD=test_tenant_admin/g" test_tenant_admin_rc
[stack@instack ~]$ echo "export PS1='[\u@\h \W(tenant_admin)]\$ '" >> test_tenant_admin_rc

以下のようになります。

[stack@instack ~]$ cat test_tenant_admin_rc
export OS_NO_CACHE=True
export COMPUTE_API_VERSION=1.1
export OS_USERNAME=test_tenant_admin
export no_proxy=,192.0.2.7
export OS_TENANT_NAME=test_tenant
export OS_CLOUDNAME=overcloud
export OS_AUTH_URL=http://192.0.2.7:5000/v2.0/
export NOVA_VERSION=1.1
export OS_PASSWORD=test_tenant_admin
export PS1='[\u@\h \W(tenant_admin)]$ '

テナントネットワークの作成

Neutronのコマンドを使用して、テナントネットワークを作成します。 source test_tenant_admin_rc で該当テナントを使用するようにします。

[stack@instack ~]$ source test_tenant_admin_rc

Neutronコマンドで、テストテナントネットワーク test_tenant を作成します。

[stack@instack ~(tenant_admin)]$ neutron net-create test_tenant --shared
Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | d6865968-ef6c-46ee-8eca-b934a36f5531 |
| mtu                       | 0                                    |
| name                      | test_tenant                          |
| provider:network_type     | gre                                  |
| provider:physical_network |                                      |
| provider:segmentation_id  | 1                                    |
| router:external           | False                                |
| shared                    | True                                 |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | 2fc48b580ade4758a382694689d15a86     |
+---------------------------+--------------------------------------+

テナントプライベートネットワークの作成

同一テナントでのみ使用できるプライベートネットワークを作成します。

ここでは、サブネット名 private でCIDRは、192.168.1.0/24とし、test_tenant ネットワークのサブネットとします。

[stack@instack ~(tenant_admin)]$ neutron subnet-create --name private --enable_dhcp=True --allocation-pool=start=192.168.1.5,end=192.168.1.254 --gateway=192.168.1.1 --dns-nameserver 8.8.8.8 test_tenant 192.168.1.0/24
Created a new subnet:
+-------------------+--------------------------------------------------+
| Field             | Value                                            |
+-------------------+--------------------------------------------------+
| allocation_pools  | {"start": "192.168.1.5", "end": "192.168.1.254"} |
| cidr              | 192.168.1.0/24                                   |
| dns_nameservers   | 8.8.8.8                                          |
| enable_dhcp       | True                                             |
| gateway_ip        | 192.168.1.1                                      |
| host_routes       |                                                  |
| id                | 8d41327a-8cda-4c29-9a5a-cc408eec8a10             |
| ip_version        | 4                                                |
| ipv6_address_mode |                                                  |
| ipv6_ra_mode      |                                                  |
| name              | private                                          |
| network_id        | d6865968-ef6c-46ee-8eca-b934a36f5531             |
| subnetpool_id     |                                                  |
| tenant_id         | 2fc48b580ade4758a382694689d15a86                 |
+-------------------+--------------------------------------------------+

外部ネットワークの作成

外部へ抜けるための外部ネットワーク test_ext を作成します。 ここに、テナントパブリックネットワーク・サブネットを割り当てます。

[stack@instack ~(tenant_admin)]$ neutron net-create test_ext --router:external --provider:network_type gre
Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | 5d02cce0-4c3c-4806-a13e-29d538a5857f |
| mtu                       | 0                                    |
| name                      | test_ext                             |
| provider:network_type     | gre                                  |
| provider:physical_network |                                      |
| provider:segmentation_id  | 2                                    |
| router:external           | True                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | 2fc48b580ade4758a382694689d15a86     |
+---------------------------+--------------------------------------+

テナントパブリックネットワークの作成

パブリックネットワークを作成します。

ここでは、サブネット名 public でCIDRは、VMのコントロールプレーンで作成されているネットワーク192.168.2.0/24を利用することとし、test_ext ネットワークのサブネットとします。 割り当てレンジは、192.0.2.128 - 192.0.2.254 を設定します。

[stack@instack ~(tenant_admin)]$ neutron subnet-create --name public --enable_dhcp=False --allocation-pool=start=192.0.2.128,end=192.0.2.254 --gateway=192.0.2.1 --dns-nameserver 8.8.8.8 test_ext 192.0.2.0/24
Created a new subnet:
+-------------------+------------------------------------------------+
| Field             | Value                                          |
+-------------------+------------------------------------------------+
| allocation_pools  | {"start": "192.0.2.128", "end": "192.0.2.254"} |
| cidr              | 192.0.2.0/24                                   |
| dns_nameservers   | 8.8.8.8                                        |
| enable_dhcp       | False                                          |
| gateway_ip        | 192.0.2.1                                      |
| host_routes       |                                                |
| id                | 51612275-d249-4c76-9f12-49bd13bec5dc           |
| ip_version        | 4                                              |
| ipv6_address_mode |                                                |
| ipv6_ra_mode      |                                                |
| name              | public                                         |
| network_id        | 5d02cce0-4c3c-4806-a13e-29d538a5857f           |
| subnetpool_id     |                                                |
| tenant_id         | 2fc48b580ade4758a382694689d15a86               |
+-------------------+------------------------------------------------+

テナントルータの作成

ネットワークルーティングのために、テナントにはルータが必要です。 下記、Neutronコマンドで test_tenant_router を作成します。

[stack@instack ~(tenant_admin)]$ neutron router-create test_tenant_router
Created a new router:
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| admin_state_up        | True                                 |
| distributed           | False                                |
| external_gateway_info |                                      |
| ha                    | False                                |
| id                    | d1a0efe6-c327-4e09-92ec-a8315820c6ef |
| name                  | test_tenant_router                   |
| routes                |                                      |
| status                | ACTIVE                               |
| tenant_id             | 2fc48b580ade4758a382694689d15a86     |
+-----------------------+--------------------------------------+

プライベートネットワークをルータへ接続

プライベートネットワーク・サブネット privatetest_tenant_router ルータへ接続します。

[stack@instack ~(tenant_admin)]$ neutron router-interface-add test_tenant_router private
Added interface ef970538-87e0-4970-9b03-9efb6b8734a7 to router test_tenant_router.

パブリックネットワークをルータへ接続

外部ネットワーク test_ext をテナントルータのゲートウェイにします。

[stack@instack ~(tenant_admin)]$ neutron router-gateway-set test_tenant_router test_ext
Set gateway for router test_tenant_router

セキュリティグループの作成

セキュリティグループを作成します。 defaultセキュリティグループは、SSH, ICMPを許可していません。そこで any セキュリティグループを作成します。

[stack@instack ~(tenant_admin)]$ neutron security-group-list
+--------------------------------------+---------+----------------------------------------------------------------------+
| id                                   | name    | security_group_rules                                                 |
+--------------------------------------+---------+----------------------------------------------------------------------+
| e68c9e68-c01a-498e-b011-fdfed1b7e973 | default | egress, IPv4                                                         |
|                                      |         | egress, IPv6                                                         |
|                                      |         | ingress, IPv4, remote_group_id: e68c9e68-c01a-498e-b011-fdfed1b7e973 |
|                                      |         | ingress, IPv6, remote_group_id: e68c9e68-c01a-498e-b011-fdfed1b7e973 |
+--------------------------------------+---------+----------------------------------------------------------------------+
[stack@instack ~(tenant_admin)]$ neutron security-group-create any
Created a new security_group:
...
[stack@instack ~(tenant_admin)]$ neutron security-group-rule-create --protocol icmp --direction ingress --remote-ip-prefix 0.0.0.0/0 any
Created a new security_group_rule:
+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| direction         | ingress                              |
| ethertype         | IPv4                                 |
| id                | 4157caab-ee24-4edc-baef-96df34a3fe71 |
| port_range_max    |                                      |
| port_range_min    |                                      |
| protocol          | icmp                                 |
| remote_group_id   |                                      |
| remote_ip_prefix  | 0.0.0.0/0                            |
| security_group_id | 36fa4a9c-222f-4753-b49e-461865acace1 |
| tenant_id         | 2fc48b580ade4758a382694689d15a86     |
+-------------------+--------------------------------------+
[stack@instack ~(tenant_admin)]$ neutron security-group-rule-create --protocol tcp --port-range-min 22 --port-range-max 22 --direction ingress --remote-ip-prefix 0.0.0.0/0 any
Created a new security_group_rule:
+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| direction         | ingress                              |
| ethertype         | IPv4                                 |
| id                | fadc5438-f418-45f8-a17b-f53c1cf2a857 |
| port_range_max    | 22                                   |
| port_range_min    | 22                                   |
| protocol          | tcp                                  |
| remote_group_id   |                                      |
| remote_ip_prefix  | 0.0.0.0/0                            |
| security_group_id | 36fa4a9c-222f-4753-b49e-461865acace1 |
| tenant_id         | 2fc48b580ade4758a382694689d15a86     |
+-------------------+--------------------------------------+
[stack@instack ~(tenant_admin)]$ neutron security-group-list
+--------------------------------------+---------+----------------------------------------------------------------------+
| id                                   | name    | security_group_rules                                                 |
+--------------------------------------+---------+----------------------------------------------------------------------+
| 36fa4a9c-222f-4753-b49e-461865acace1 | any     | egress, IPv4                                                         |
|                                      |         | egress, IPv6                                                         |
|                                      |         | ingress, IPv4, 22/tcp, remote_ip_prefix: 0.0.0.0/0                   |
|                                      |         | ingress, IPv4, icmp, remote_ip_prefix: 0.0.0.0/0                     |
| e68c9e68-c01a-498e-b011-fdfed1b7e973 | default | egress, IPv4                                                         |
|                                      |         | egress, IPv6                                                         |
|                                      |         | ingress, IPv4, remote_group_id: e68c9e68-c01a-498e-b011-fdfed1b7e973 |
|                                      |         | ingress, IPv6, remote_group_id: e68c9e68-c01a-498e-b011-fdfed1b7e973 |
+--------------------------------------+---------+----------------------------------------------------------------------+

次にGlanceイメージの登録を行います。

OpenStack RDO Managerインストール後の操作 (2)