Cinder - Block Storage asennus

controller.foo.bar

1. Luodaan cinder-tunnus.

# keystone user-create --name cinder --pass cinder
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | 50e64f58c9c34e03a71bb085d64c70f7 |
|   name   |             cinder               |
| username |             cinder               |
+----------+----------------------------------+

2. Lisätään cinder-tunnukselle admin-rooli ja lisätään tunnus service tenant-ryhmään.

# keystone user-role-add --user cinder --tenant service --role admin
(Tämä komento ei tulosta mitään)

3. Cinderille luodaan kaksi service-tunnusta, joille luodaan kaksi endpointia kahdelle eri autentikointiversiolle.

# keystone service-create --name cinder --type volume --description "OpenStack Block Storage"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |     OpenStack Block Storage      |
|   enabled   |               True               |
|      id     | 5d3e6462fcce4daa9720adb8d279451e |
|     name    |             cinder               |
|     type    |              volume              |
+-------------+----------------------------------+

# keystone service-create --name cinderv2 --type volumev2 --description "OpenStack Block Storage"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |     OpenStack Block Storage      |
|   enabled   |               True               |
|      id     | fc2e6ed68abd1c4f5450e568d2db8184 |
|     name    |             cinderv2             |
|     type    |              volume2             |
+-------------+----------------------------------+

4. Luodaan Cinderin endpointit.

# keystone endpoint-create --service-id $(keystone service-list | awk '/ volume / {print $2}') \
--publicurl http://10.0.0.11:8776/v1/%\(tenant_id\)s \
--internalurl http://10.0.0.11:8776/v1/%\(tenant_id\)s \
--adminurl http://10.0.0.11:8776/v1/%\(tenant_id\)s --region regionOne
+-------------+----------------------------------------+
|   Property  |                 Value                  |
+-------------+----------------------------------------+
|   adminurl  | http://10.0.0.11:8776/v1/%(tenant_id)s |
|      id     |    82f5c5610ed34aa4920a2fe3d1676b4f    |
| internalurl | http://10.0.0.11:8776/v1/%(tenant_id)s |
|  publicurl  | http://10.0.0.11:8776/v1/%(tenant_id)s |
|    region   |               regionOne                |
|  service_id |    5d3e6462fcce4daa9720adb8d279451e    |
+-------------+----------------------------------------+

5. Endpoint versio2 autentikoinnille.

# keystone endpoint-create --service-id $(keystone service-list | awk '/ volumev2 / {print $2}') \
--publicurl http://10.0.0.11:8776/v2/%\(tenant_id\)s \
--internalurl http://10.0.0.11:8776/v2/%\(tenant_id\)s \
--adminurl http://10.0.0.11:8776/v2/%\(tenant_id\)s --region regionOne
+-------------+----------------------------------------+
|   Property  |                 Value                  |
+-------------+----------------------------------------+
|   adminurl  | http://10.0.0.11:8776/v2/%(tenant_id)s |
|      id     |    82f5c5610ed34aa4920a2fe3d1676b4f    |
| internalurl | http://10.0.0.11:8776/v2/%(tenant_id)s |
|  publicurl  | http://10.0.0.11:8776/v2/%(tenant_id)s |
|    region   |               regionOne                |
|  service_id |    fc2e6ed68abd1c4f5450e568d2db8184    |
+-------------+----------------------------------------+

6. Asennetaan cinderin paketit.

# apt-get install cinder-api cinder-scheduler python-cinderclient

7. Muokataan /etc/cinder/cinder.conf -tiedostoa:

[database]
connection = mysql://cinder:cinderdb@10.0.0.11/cinder

[DEFAULT]
rpc_backend = rabbit
rabbit_host = 10.0.0.11
rabbit_userid = openstack
rabbit_password = openstack
my_ip = 10.0.0.11

[keystone_authtoken]
auth_uri = http://10.0.0.11:5000/v2.0
identity_uri = http://10.0.0.11:35357
admin_user = cinder
admin_password = cinder
admin_tenant_name = service

8. Synkronoidaan cinder-tietokanta ja uudelleenkäynnistetään Cinder-API ja Scheduler.

# cinder-manage db sync
# service cinder-scheduler restart
# service cinder-api restart

block.foo.bar

9. Oletuksena on, että palvelimella on käytettävissä oleva levy sdb1. Luodaan osio sdb1 ja volumegroup cinder-volumes.

# pvcreate /dev/sdb1
    Physical volume "/dev/sdb1" successfully created
# vgcreate cinder-volumes /dev/sdb1
    Volume group "cinder-volumes" successfully created

10. Muokataan /etc/lvm/lvm.conf -tiedostoa siten, että LVM näkee vain käyttöjärjestelmälevyn sba ja cinder-osion sdb. Oletuksena LVM skannaa /dev -alla olevia levyjä ja osioita. Jos Cinderiä käyttävä instanssi käyttää LVM:a ja yrittää skannata samaa /dev -osioita omaan välimuistiin, niin tämä luultavasti aiheuttaa ongelmia instanssille ja Cinder-palvelimelle. Suodatinrivillä a=accept, r=reject, eli hyväksytään sda ja sba, jonka jälkeen hylätään kaikki muut.

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

compute.foo.bar

11. Instanssi-palvelin compute käyttää LVM:a, joten suodatetaan myös computelta kaikki muut levyt käyttöjärjestelmälevyä lukuunottamatta. Muokataan /etc/lvm/lvm.conf -tiedostoa:

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

block.foo.bar

12. Takaisin Block-palvelimelle ja asennetaan Cinder -paketti.

# apt-get install cinder-volume

13. Muokataan /etc/cinder/cinder.conf -tiedostoa.

[database]
connection = mysql://cinder:cinderdb@10.0.0.11/cinder

[keystone_authtoken]
auth_uri = http://10.0.0.11:5000/v2.0
identity_uri = http://10.0.0.11:35357
admin_tenant_name = service
admin_user = cinder
admin_password = cinder

[default]
rabbit_host = 10.0.0.11
rabbit_userid = openstack
rabbit_password = openstack
rpc_backend=rabbit
my_ip = 10.0.0.41
glance_host = 10.0.0.11
auth_strategy = keystone

14. Uudelleenkäynnistetään Cinder- ja tgt-palvelut.

# service tgt restart
# service cinder-volume restart

controller.foo.bar

15. Testataan Cinderin toiminta.

# . ./adminrc.sh
# cinder service-list
+------------------+------------+------+---------+-------+----------------------------+
|      Binary      |    Host    | Zone |  Status | State |         Updated_at         |
+------------------+------------+------+---------+-------+----------------------------+
| cinder-scheduler | controller | nova | enabled |   up  | 2016-09-14T08:35:16.000000 |
|  cinder-volume   |   block    | nova | enabled |   up  | 2016-09-14T08:35:13.000000 |
+------------------+------------+------+---------+-------+----------------------------+

16. Luodaan 1Gt osio.

# . ./demorc.sh

# cinder create --display-name demo-volume1 1
+---------------------+--------------------------------------+
|       Property      |                Value                 |
+---------------------+--------------------------------------+
|     attachments     |                  []                  |
|  availability_zone  |                 nova                 |
|       bootable      |                false                 |
|      created_at     |      2016-10-07T08:48:33.247093      |
| display_description |                 None                 |
|     display_name    |             demo-volume1             |
|      encrypted      |                False                 |
|          id         | b92d1fa0-b9df-4104-aa5f-1e5a49fa3dc8 |
|       metadata      |                  {}                  |
|         size        |                  1                   |
|     snapshot_id     |                 None                 |
|     source_volid    |                 None                 |
|        status       |               creating               |
|     volume_type     |                 None                 |
+---------------------+--------------------------------------+

17. Tarkastetaan, että osion luonti onnistui.

# cinder list
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
|                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| b92d1fa0-b9df-4104-aa5f-1e5a49fa3dc8 | available | demo-volume1 |  1   |     None    |  false   |             |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+