在已有OpenStack集群中部署Manila(一):部署Manila控制节点

1、OpenStack集群环境

已经部署好了OpenStack,计算节点和控制节点合一部署,只有一个节点

# nova hypervisor-list
+--------------------------------------+---------------------+-------+---------+
| ID                                   | Hypervisor hostname | State | Status  |
+--------------------------------------+---------------------+-------+---------+
| 784b9864-6854-4135-9ad6-013753e3be24 | openstack4k8s       | up    | enabled |
+--------------------------------------+---------------------+-------+---------+

OpenStack上部署了4个虚拟机,运行着一个K8S集群

# nova list
+--------------------------------------+--------+--------+------------+-------------+----------------------------------------+
| ID                                   | Name   | Status | Task State | Power State | Networks                               |
+--------------------------------------+--------+--------+------------+-------------+----------------------------------------+
| e9d3345b-8952-4bbc-97c2-a611333c63c4 | k8s-m1 | ACTIVE | -          | Running     | net_api=192.168.1.113, 192.168.100.162 |
| d8f26086-0143-4413-afcc-ac5049375fc6 | k8s-m2 | ACTIVE | -          | Running     | net_api=192.168.1.243, 192.168.100.223 |
| 8af936f3-311c-47dd-8e27-e18d2d31ea5a | k8s-m3 | ACTIVE | -          | Running     | net_api=192.168.1.168, 192.168.100.130 |
| 93c95279-e93c-4f41-8fe1-9be8fb875651 | k8s-n1 | ACTIVE | -          | Running     | net_api=192.168.1.189, 192.168.100.23  |
+--------------------------------------+--------+--------+------------+-------------+----------------------------------------+

准备验证K8S对接OpenStack的Manila,之前没有部署manila,所以需要在OpenStack上增加部署manila组件

2、部署Manila控制节点

控制节点手工部署

2.1、创建数据库

$ mysql -u root -p
root

CREATE DATABASE manila;

GRANT ALL PRIVILEGES ON manila.* TO 'manila'@'localhost' IDENTIFIED BY 'manila';
GRANT ALL PRIVILEGES ON manila.* TO 'manila'@'%' IDENTIFIED BY 'manila';

2.2、创建用户信息

用户名和密码均设置为manila

# openstack user create --domain default --password-prompt manila
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | c9e388cc1e3c4f049095983edfe9e8bc |
| name                | manila                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# openstack role add --project services --user manila admin

# 注,这儿的project的名可以使用命令查到,官网上的是service,实际环境中可能不是service

# openstack project list
+----------------------------------+----------+
| ID                               | Name     |
+----------------------------------+----------+
| 23a40789342d4de6bc06d0b0bef7069c | admin    |
| 99671b33717d4be5a6ee2227c39da017 | services |
+----------------------------------+----------+

2.2、创建service

创建v1和v2版本的service

# openstack service create --name manila --description "OpenStack Shared File Systems" share
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Shared File Systems    |
| enabled     | True                             |
| id          | 4c63ed5be5174db29408d30e4ff1f7c5 |
| name        | manila                           |
| type        | share                            |
+-------------+----------------------------------+

# openstack service create --name manilav2 --description "OpenStack Shared File Systems V2" sharev2
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Shared File Systems V2 |
| enabled     | True                             |
| id          | 20f54b78a0f04b17b7c270d29fdf1f03 |
| name        | manilav2                         |
| type        | sharev2                          |
+-------------+----------------------------------+

# openstack service list
+----------------------------------+-----------+-----------------+
| ID                               | Name      | Type            |
+----------------------------------+-----------+-----------------+
| 02b2b81b3d614b9b9c96478f1af2e2da | placement | placement       |
| 15461d8a23e54de19f7cfc7d3d03721f | heat      | orchestration   |
| 20f54b78a0f04b17b7c270d29fdf1f03 | manilav2  | sharev2         |
| 337d7c38f07642fd86f6fcc8b285135d | heat-cfn  | cloudformation  |
| 3d3a62f7c5694b3d88ed78243a93103c | nova      | compute         |
| 437fd0627f3443ba855ac67130cb30f1 | glance    | image           |
| 4c63ed5be5174db29408d30e4ff1f7c5 | manila    | share           |
| 4e2c91faa4144531b253a97e6b19c210 | cinderv3  | volumev3        |
| 7cd53069889142aeb25aba83d886a15f | neutron   | network         |
| 7dee1f07a0264019ad910aeba7112c97 | swift     | object-store    |
| 9fa3e981ad2d4164b85f80a2df8f5fb2 | cinderv2  | volumev2        |
| c216be5e4c7f4ef8954f1ee7fc5ab92f | magnum    | container-infra |
| f1b454da27c4441085ad5e2b02d61e45 | keystone  | identity        |
+----------------------------------+-----------+-----------------+

2.3、创建endpoints

v1和v2每个版本创建三个endpoint,分别是internal、public和admin

# openstack endpoint create --region RegionOne share public http://192.168.166.180:8786/v1/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | 4e116bec596346c58b857b756dbd802f           |
| interface    | public                                     |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 4c63ed5be5174db29408d30e4ff1f7c5           |
| service_name | manila                                     |
| service_type | share                                      |
| url          | http://192.168.166.180:8786/v1/%(tenant_id)s |
+--------------+--------------------------------------------+
# openstack endpoint create --region RegionOne share internal http://192.168.166.180:8786/v1/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | a1c1fc73f7b74430adbc73f0deb1e7a4           |
| interface    | internal                                   |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 4c63ed5be5174db29408d30e4ff1f7c5           |
| service_name | manila                                     |
| service_type | share                                      |
| url          | http://192.168.166.180:8786/v1/%(tenant_id)s |
+--------------+--------------------------------------------+
# openstack endpoint create --region RegionOne share admin http://192.168.166.180:8786/v1/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | 56f48079543243c58f607cfd44c3ee7f           |
| interface    | admin                                      |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 4c63ed5be5174db29408d30e4ff1f7c5           |
| service_name | manila                                     |
| service_type | share                                      |
| url          | http://192.168.166.180:8786/v1/%(tenant_id)s |
+--------------+--------------------------------------------+
# openstack endpoint create --region RegionOne sharev2 public http://192.168.166.180:8786/v2/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | 73f34601b0bb4c1b968a33bb1891d646           |
| interface    | public                                     |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 20f54b78a0f04b17b7c270d29fdf1f03           |
| service_name | manilav2                                   |
| service_type | sharev2                                    |
| url          | http://192.168.166.180:8786/v2/%(tenant_id)s |
+--------------+--------------------------------------------+
# openstack endpoint create --region RegionOne sharev2 internal http://192.168.166.180:8786/v2/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | 18c1baf452d94b49b1d1ecaf7a6d238a           |
| interface    | internal                                   |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 20f54b78a0f04b17b7c270d29fdf1f03           |
| service_name | manilav2                                   |
| service_type | sharev2                                    |
| url          | http://192.168.166.180:8786/v2/%(tenant_id)s |
+--------------+--------------------------------------------+
# openstack endpoint create --region RegionOne sharev2 admin http://192.168.166.180:8786/v2/%\(tenant_id\)s
+--------------+--------------------------------------------+
| Field        | Value                                      |
+--------------+--------------------------------------------+
| enabled      | True                                       |
| id           | e3288c6fb3c34590ae987e7be6c961c2           |
| interface    | admin                                      |
| region       | RegionOne                                  |
| region_id    | RegionOne                                  |
| service_id   | 20f54b78a0f04b17b7c270d29fdf1f03           |
| service_name | manilav2                                   |
| service_type | sharev2                                    |
| url          | http://192.168.166.180:8786/v2/%(tenant_id)s |
+--------------+--------------------------------------------+

2.4、安装控制部分rpm包

安装manila组件控制rpm包和ui界面rpm包

# yum install openstack-manila openstack-manila-ui python2-manila -y

2.5、修改配置

# vi /etc/manila/manila.conf
[DEFAULT]
connection=mysql+pymysql://manila:manila@192.168.166.180/manila
transport_url=rabbit://guest:guest@192.168.166.180:5672/
lock_path = /var/lock/manila/tmp

[keystone_authtoken]
www_authenticate_uri=http://192.168.166.180:5000/
auth_strategy=keystone
auth_url=http://192.168.166.180:5000
auth_type=password
username=manila
password=manila
user_domain_name=Default
project_name=services
project_domain_name=Default

2.6、启动服务

# makdir -p /var/lock/manila/tmp
# chown manila:manila /var/lock/manila/tmp
# systemctl enable openstack-manila-api.service openstack-manila-scheduler.service
# systemctl start openstack-manila-api.service openstack-manila-scheduler.service

2.7、创建manila数据表

# manila-manage db sync
2020-04-29 07:13:40.930 113581 INFO alembic.runtime.migration [-] Context impl MySQLImpl.
2020-04-29 07:13:40.931 113581 INFO alembic.runtime.migration [-] Will assume non-transactional DDL.
2020-04-29 07:13:40.964 113581 INFO alembic.runtime.migration [-] Running upgrade  -> 162a3e673105, manila_init
2020-04-29 07:13:41.155 113581 INFO alembic.runtime.migration [-] Running upgrade 162a3e673105 -> 211836bf835c, add access level
2020-04-29 07:13:41.159 113581 INFO alembic.runtime.migration [-] Running upgrade 211836bf835c -> 38e632621e5a, change volume_type to share_type
2020-04-29 07:13:41.160 113581 INFO 38e632621e5a_change_volume_type_to_share_type_py [-] Renaming column name shares.volume_type_id to shares.share_type.id
2020-04-29 07:13:41.162 113581 INFO 38e632621e5a_change_volume_type_to_share_type_py [-] Renaming volume_types table to share_types
2020-04-29 07:13:41.182 113581 INFO 38e632621e5a_change_volume_type_to_share_type_py [-] Creating share_type_extra_specs table
2020-04-29 07:13:41.187 113581 INFO 38e632621e5a_change_volume_type_to_share_type_py [-] Migrating volume_type_extra_specs to share_type_extra_specs
2020-04-29 07:13:41.189 113581 INFO 38e632621e5a_change_volume_type_to_share_type_py [-] Dropping volume_type_extra_specs table
2020-04-29 07:13:41.193 113581 INFO alembic.runtime.migration [-] Running upgrade 38e632621e5a -> 17115072e1c3, add_nova_net_id_column_to_share_networks
2020-04-29 07:13:41.195 113581 INFO alembic.runtime.migration [-] Running upgrade 17115072e1c3 -> 4ee2cf4be19a, Remove share_snapshots.export_location
2020-04-29 07:13:41.204 113581 INFO alembic.runtime.migration [-] Running upgrade 4ee2cf4be19a -> 59eb64046740, Add required extra spec
2020-04-29 07:13:41.209 113581 INFO alembic.runtime.migration [-] Running upgrade 59eb64046740 -> ef0c02b4366, Add_share_type_projects
2020-04-29 07:13:41.227 113581 INFO alembic.runtime.migration [-] Running upgrade ef0c02b4366 -> 30cb96d995fa, add public column for share
2020-04-29 07:13:41.240 113581 INFO alembic.runtime.migration [-] Running upgrade 30cb96d995fa -> 56cdbe267881, Add share_export_locations table
2020-04-29 07:13:41.256 113581 INFO alembic.runtime.migration [-] Running upgrade 56cdbe267881 -> 3a482171410f, add_driver_private_data_table
2020-04-29 07:13:41.261 113581 INFO alembic.runtime.migration [-] Running upgrade 3a482171410f -> 533646c7af38, Remove unused attr status
2020-04-29 07:13:41.277 113581 INFO alembic.runtime.migration [-] Running upgrade 533646c7af38 -> 3db9992c30f3, Transform statuses to lowercase
2020-04-29 07:13:41.305 113581 INFO alembic.runtime.migration [-] Running upgrade 3db9992c30f3 -> 5077ffcc5f1c, add_share_instances
2020-04-29 07:13:41.474 113581 INFO alembic.runtime.migration [-] Running upgrade 5077ffcc5f1c -> 579c267fbb4d, add_share_instances_access_map
2020-04-29 07:13:41.503 113581 INFO alembic.runtime.migration [-] Running upgrade 579c267fbb4d -> 1f0bd302c1a6, add_availability_zones_table
2020-04-29 07:13:41.560 113581 INFO alembic.runtime.migration [-] Running upgrade 1f0bd302c1a6 -> 55761e5f59c5, Add 'snapshot_support' extra spec to share types
2020-04-29 07:13:41.578 113581 INFO alembic.runtime.migration [-] Running upgrade 55761e5f59c5 -> 3651e16d7c43, Create Consistency Groups Tables and Columns
2020-04-29 07:13:41.616 113581 INFO alembic.runtime.migration [-] Running upgrade 3651e16d7c43 -> 323840a08dc4, Add shares.task_state
2020-04-29 07:13:41.619 113581 INFO alembic.runtime.migration [-] Running upgrade 323840a08dc4 -> dda6de06349, Add DB support for share instance export locations metadata.
2020-04-29 07:13:41.649 113581 INFO alembic.runtime.migration [-] Running upgrade dda6de06349 -> 344c1ac4747f, Remove access rules status and add access_rule_status to share_instance
model
2020-04-29 07:13:41.692 113581 INFO alembic.runtime.migration [-] Running upgrade 344c1ac4747f -> 293fac1130ca, Add replication attributes to Share and ShareInstance models.
2020-04-29 07:13:41.697 113581 INFO alembic.runtime.migration [-] Running upgrade 293fac1130ca -> 5155c7077f99, Add more network info attributes to 'network_allocations' table.
2020-04-29 07:13:41.705 113581 INFO alembic.runtime.migration [-] Running upgrade 5155c7077f99 -> eb6d5544cbbd, add provider_location to share_snapshot_instances
2020-04-29 07:13:41.708 113581 INFO alembic.runtime.migration [-] Running upgrade eb6d5544cbbd -> 221a83cfd85b, change_user_id_length
2020-04-29 07:13:41.708 113581 INFO 221a83cfd85b_change_user_project_id_length_py [-] Changing user_id length for share_networks
2020-04-29 07:13:41.716 113581 INFO 221a83cfd85b_change_user_project_id_length_py [-] Changing project_id length for share_networks
2020-04-29 07:13:41.724 113581 INFO 221a83cfd85b_change_user_project_id_length_py [-] Changing project_id length for security_services
2020-04-29 07:13:41.733 113581 INFO alembic.runtime.migration [-] Running upgrade 221a83cfd85b -> fdfb668d19e1, add_gateway_to_network_allocations_table
2020-04-29 07:13:41.737 113581 INFO alembic.runtime.migration [-] Running upgrade fdfb668d19e1 -> e8ea58723178, Remove host from driver private data
2020-04-29 07:13:41.759 113581 INFO alembic.runtime.migration [-] Running upgrade e8ea58723178 -> 493eaffd79e1, add_mtu_network_allocations
2020-04-29 07:13:41.764 113581 INFO alembic.runtime.migration [-] Running upgrade 493eaffd79e1 -> 63809d875e32, add_access_key
2020-04-29 07:13:41.766 113581 INFO alembic.runtime.migration [-] Running upgrade 63809d875e32 -> 48a7beae3117, move_share_type_id_to_instances
2020-04-29 07:13:41.812 113581 INFO alembic.runtime.migration [-] Running upgrade 48a7beae3117 -> 3e7d62517afa, Add 'create_share_from_snapshot_support' extra spec to share types
2020-04-29 07:13:41.827 113581 INFO alembic.runtime.migration [-] Running upgrade 3e7d62517afa -> 95e3cf760840, remove_nova_net_id_column_from_share_networks
2020-04-29 07:13:41.834 113581 INFO alembic.runtime.migration [-] Running upgrade 95e3cf760840 -> 87ce15c59bbe, add_revert_to_snapshot_support
2020-04-29 07:13:41.846 113581 INFO alembic.runtime.migration [-] Running upgrade 87ce15c59bbe -> 54667b9cade7, add_share_instance_access_map_state
2020-04-29 07:13:41.888 113581 INFO alembic.runtime.migration [-] Running upgrade 54667b9cade7 -> e9f79621d83f, add_cast_rules_to_readonly_to_share_instances
2020-04-29 07:13:41.888 113581 INFO e9f79621d83f_add_cast_rules_to_readonly_to_share_instances_py [-] Adding cast_rules_to_readonly column to share instances.
2020-04-29 07:13:41.936 113581 INFO alembic.runtime.migration [-] Running upgrade e9f79621d83f -> 03da71c0e321, Convert consistency groups to share groups
2020-04-29 07:13:41.936 113581 INFO 03da71c0e321_convert_cgs_to_share_groups_py [-] Renaming consistency group tables
2020-04-29 07:13:42.080 113581 INFO alembic.runtime.migration [-] Running upgrade 03da71c0e321 -> e1949a93157a, Add share group types table
2020-04-29 07:13:42.113 113581 INFO alembic.runtime.migration [-] Running upgrade e1949a93157a -> a77e2ad5012d, add_share_snapshot_access
2020-04-29 07:13:42.155 113581 INFO alembic.runtime.migration [-] Running upgrade a77e2ad5012d -> 927920b37453, Add 'provider_location' attr to 'share_group_snapshot_members' model.
2020-04-29 07:13:42.157 113581 INFO alembic.runtime.migration [-] Running upgrade 927920b37453 -> d5db24264f5c, Add enum 'consistent_snapshot_support' attr to 'share_groups' model.
2020-04-29 07:13:42.162 113581 INFO alembic.runtime.migration [-] Running upgrade d5db24264f5c -> 7d142971c4ef, add_reservation_expire_index
2020-04-29 07:13:42.166 113581 INFO alembic.runtime.migration [-] Running upgrade 7d142971c4ef -> 5237b6625330, Add 'availability_zone_id' field to 'share_groups' table.
2020-04-29 07:13:42.171 113581 INFO alembic.runtime.migration [-] Running upgrade 5237b6625330 -> 31252d671ae5, Squash 'share_group_snapshot_members' and 'share_snapshot_instances' models.
2020-04-29 07:13:42.229 113581 INFO alembic.runtime.migration [-] Running upgrade 31252d671ae5 -> 238720805ce1, Add messages table
2020-04-29 07:13:42.234 113581 INFO alembic.runtime.migration [-] Running upgrade 238720805ce1 -> b516de97bfee, Add ProjectShareTypeQuota model
2020-04-29 07:13:42.242 113581 INFO alembic.runtime.migration [-] Running upgrade b516de97bfee -> 829a09b0ddd4, Fix 'project_share_type_quotas' unique constraint
2020-04-29 07:13:42.258 113581 INFO alembic.runtime.migration [-] Running upgrade 829a09b0ddd4 -> 27cb96d991fa, add description for share type
2020-04-29 07:13:42.261 113581 INFO alembic.runtime.migration [-] Running upgrade 27cb96d991fa -> 4a482571410f, add_backend_info_table
2020-04-29 07:13:42.265 113581 INFO alembic.runtime.migration [-] Running upgrade 4a482571410f -> 0274d20c560f, Add ou to security service
2020-04-29 07:13:42.268 113581 INFO alembic.runtime.migration [-] Running upgrade 0274d20c560f -> 097fad24d2fc, add_share_instances_share_id_index
2020-04-29 07:13:42.273 113581 INFO alembic.runtime.migration [-] Running upgrade 097fad24d2fc -> 11ee96se625f3, add metadata for access rule
2020-04-29 07:13:42.278 113581 INFO alembic.runtime.migration [-] Running upgrade 11ee96se625f3 -> 6a3fd2984bc31, Add is_auto_deletable and identifier fields for share servers
2020-04-29 07:13:42.296 113581 INFO alembic.runtime.migration [-] Running upgrade 6a3fd2984bc31 -> 805685098bd2, add_share_network_subnets_table_and_modify_share_networks_and_servers
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值