Ubuntu 14.04一步一步安装Openstack Kilo版本-12(cinder)

来源:互联网 发布:有源光纤网络 编辑:程序博客网 时间:2024/06/04 19:33

12.1.    cinder(控制)

12.1.1. 创建数据库

mysql -u root -p

create database cinder;

grant all privileges on cinder.* to'cinder'@'kilo' identified by 'cinder_dbpass';

grant all privileges on cinder.* to'cinder'@'localhost' identified by 'cinder_dbpass';

grant all privileges on cinder.* to'cinder'@'%' identified by 'cinder_dbpass';

exit

12.1.2. 创建认证API endpoint

source admin-openrc.sh

openstack user create --password-promptcinder

User Password:

Repeat User Password:

+----------+----------------------------------+

| Field    | Value                            |

+----------+----------------------------------+

| email    | None                             |

| enabled  | True                             |

| id       | edfc9795e8354ab495d76400ccfc23bf |

| name     | cinder                           |

| username |cinder                           |

+----------+----------------------------------+

 

openstack role add --project service --usercinder admin

+-------+----------------------------------+

| Field |Value                            |

+-------+----------------------------------+

| id    | 14b826a870464c67900a963d675cc8cb |

| name  | admin                            |

+-------+----------------------------------+

openstack service create --name cinder--description "OpenStack Block Storage" volume

+-------------+----------------------------------+

| Field       | Value                            |

+-------------+----------------------------------+

| description |OpenStack Block Storage          |

| enabled     | True                             |

| id          | eb7ec7e8a1054e7ca73acb153bd4b33f |

| name        | cinder                           |

| type        | volume                           |

+-------------+----------------------------------+

 

openstack service create --name cinderv2--description "OpenStack Block Storage" volumev2

+-------------+----------------------------------+

| Field       | Value                            |

+-------------+----------------------------------+

| description |OpenStack Block Storage          |

| enabled     | True                             |

| id          | 14e86324e1e544b1a5ae950260954ffb |

| name        | cinderv2                         |

| type        | volumev2                         |

+-------------+----------------------------------+

 

openstack endpoint create --publicurlhttp://kilo:8776/v2/%\(tenant_id\)s --internalurlhttp://kilo:8776/v2/%\(tenant_id\)s --adminurlhttp://kilo:8776/v2/%\(tenant_id\)s --region RegionOne volume

+--------------+-----------------------------------+

| Field        | Value                             |

+--------------+-----------------------------------+

| adminurl     | http://kilo:8776/v2/%(tenant_id)s |

| id           |7067de0993f743f5abc64155832fb4d4  |

|internalurl  |http://kilo:8776/v2/%(tenant_id)s |

| publicurl    | http://kilo:8776/v2/%(tenant_id)s |

| region       | RegionOne                         |

| service_id   | eb7ec7e8a1054e7ca73acb153bd4b33f  |

| service_name |cinder                            |

| service_type |volume                            |

+--------------+-----------------------------------+

 

openstack endpoint create --publicurlhttp://kilo:8776/v2/%\(tenant_id\)s --internalurlhttp://kilo:8776/v2/%\(tenant_id\)s --adminurl http://kilo:8776/v2/%\(tenant_id\)s--region RegionOne volumev2

+--------------+-----------------------------------+

| Field        | Value                             |

+--------------+-----------------------------------+

| adminurl     | http://kilo:8776/v2/%(tenant_id)s |

| id           |7efed14f75384402b56e95fffa20939d  |

|internalurl  |http://kilo:8776/v2/%(tenant_id)s |

| publicurl    | http://kilo:8776/v2/%(tenant_id)s |

| region       | RegionOne                         |

| service_id   | 14e86324e1e544b1a5ae950260954ffb  |

| service_name |cinderv2                          |

| service_type |volumev2                          |

+--------------+-----------------------------------+

 

12.1.3. 安装cinder

sudo apt-get install cinder-api cinder-schedulerpython-cinderclient

 

12.1.4. 配置cinder

vim /etc/cinder/cinder.conf

[DEFAULT]

rootwrap_config = /etc/cinder/rootwrap.conf

api_paste_confg = /etc/cinder/api-paste.ini

iscsi_helper = tgtadm

volume_name_template = volume-%s

volume_group = cinder-volumes

verbose = True

auth_strategy = keystone

state_path = /var/lib/cinder

lock_path = /var/lock/cinder

volumes_dir = /var/lib/cinder/volumes

rpc_backend = rabbit

my_ip = 172.16.4.139

[database]

connection =mysql://cinder:cinder_dbpass@kilo/cinder

[oslo_messaging_rabbit]

rabbit_host = kilo

rabbit_userid = openstack_rabbit_user

rabbit_password = openstack_rabbit_password

[keystone_authtoken]

auth_uri = http://kilo:5000

auth_url = http://kilo:35357

auth_plugin = password

project_domain_id = default

user_domain_id = default

project_name = service

username = cinder

password = cinder_pass

[oslo_concurrency]

lock_path = /var/lock/cinder

12.1.5. 生成数据库

sudo bash -c "cinder-manage dbsync" cinder

12.1.6. 重启服务

sudo service cinder-scheduler restart

sudo service cinder-api restart

sudo rm -f /var/lib/cinder/cinder.sqlite

12.2.    cinder(存储)

 

12.2.1. 安装lvm

sudo apt-get install lvm2

sudo apt-get install cinder-volumepython-mysqldb

12.2.2. 创建卷和卷组

sudo pvcreate /dev/sdb

sudo vgcreate cinder-volumes /dev/sdb

 

12.2.3. 编辑lvm

vim /etc/lvm/lvm.conf

devices {

filter = ["a/sdb/", "r/.*/" ]

}

注:

Each item in the filter array begins with afor accept or r for reject and includes a regular expression for the devicename. The array must end with r/.*/ to reject any remaining devices.

12.2.4. 配置cinder

vim /etc/cinder/cinder.conf

[DEFAULT]

rootwrap_config = /etc/cinder/rootwrap.conf

api_paste_confg = /etc/cinder/api-paste.ini

iscsi_helper = tgtadm

volume_name_template = volume-%s

volume_group = cinder-volumes

verbose = True

auth_strategy = keystone

state_path = /var/lib/cinder

lock_path = /var/lock/cinder

volumes_dir = /var/lib/cinder/volumes

rpc_backend = rabbit

my_ip = 172.16.4.139

enabled_backends = lvm

glance_host = kilo

[database]

connection =mysql://cinder:cinder_dbpass@kilo/cinder

[oslo_messaging_rabbit]

rabbit_host = kilo

rabbit_userid = openstack_rabbit_user

rabbit_password = openstack_rabbit_password

[keystone_authtoken]

auth_uri = http://kilo:5000

auth_url = http://kilo:35357

auth_plugin = password

project_domain_id = default

user_domain_id = default

project_name = service

username = cinder

password = cinder_pass

[oslo_concurrency]

lock_path = /var/lock/cinder

[lvm]

volume_driver =cinder.volume.drivers.lvm.LVMVolumeDriver

volume_group = cinder-volumes

iscsi_protocol = iscsi

iscsi_helper = tgtadm

12.2.5. 重启服务

sudo service tgt restart

sudo service cinder-volume restart

sudo rm -rf /var/lib/cinder/cinder.sqlite

12.2.6. 验证

sudo echo "exportOS_VOLUME_API_VERSION=2" | tee -a admin-openrc.sh demo-openrc.sh

source admin-openrc.sh

cinder service-list

+------------------+------+------+---------+-------+----------------------------+-----------------+

|      Binary      | Host | Zone |  Status | State |         Updated_at         | Disabled Reason |

+------------------+------+------+---------+-------+----------------------------+-----------------+

|cinder-scheduler | kilo | nova | enabled |  up  | 2015-05-26T06:13:58.000000|       None      |

|  cinder-volume   | kilo | nova | enabled |   up  |2015-05-26T06:14:00.000000 |      None      |

+------------------+------+------+---------+-------+----------------------------+-----------------+

 

source demo-openrc.sh

cinder create --name demo-volume1 1

+---------------------------------------+--------------------------------------+

|                Property               |                Value                 |

+---------------------------------------+--------------------------------------+

|              attachments              |                  []                  |

|           availability_zone           |                 nova                 |

|                bootable               |                false                 |

|          consistencygroup_id          |                 None                 |

|               created_at              |      2015-05-26T06:14:44.000000      |

|              description              |                 None                 |

|               encrypted               |                False                 |

|                   id                  | aef32ff0-a816-4a18-9050-af5d21de8760|

|                metadata               |                  {}                  |

|              multiattach              |                False                 |

|                  name                 |             demo-volume1             |

|         os-vol-host-attr:host         |                 None                 |

|     os-vol-mig-status-attr:migstat    |                 None                 |

|     os-vol-mig-status-attr:name_id    |                 None                 |

|      os-vol-tenant-attr:tenant_id     |  9e4ff200c6994bd6bd6e589c21afa2f8  |

|   os-volume-replication:driver_data   |                 None                 |

|os-volume-replication:extended_status |                 None                 |

|           replication_status          |               disabled               |

|                  size                 |                  1                   |

|              snapshot_id              |                 None                 |

|              source_volid             |                 None                 |

|                 status                |               creating               |

|                user_id                |   4d95b044ee0b45b689feb081c59c4dd2   |

|              volume_type              |                 None                 |

+---------------------------------------+--------------------------------------+

 

cinder list

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

|                  ID                  |   Status |     Name     | Size | Volume Type | Bootable | Attachedto |

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

|aef32ff0-a816-4a18-9050-af5d21de8760 | available | demo-volume1 |  1  |     None    | false   |             |

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

 

0 0
原创粉丝点击