블럭 스토리지 서비스는 인스턴스들에게 local disk 형태의 블럭 스토리지를 제공하는 서비스로 코드명은 cinder이다.

cinder는 기본적으로 lvm으로 볼륨을 관리하고 iSCSI로 서비스를 한다. lvm 방식외에도 타 벤더의 스토리지를 사용할때는

Ceph 방식도 존재하며 현재 설치 과정은 lvm방식으로 진행한다.

설치는 컨트롤러와 block1 노드에 설치 되며

 

우선 컨트롤러 부터 설치한다.

다른 서비스와 마찬가지로 DB 생성 및 권한설정을 한다. 

[root@controller ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 732
Server version: 5.5.44-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE cinder;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
       IDENTIFIED BY 'CINDER_DBPASS';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'controller' \
       IDENTIFIED BY 'CINDER_DBPASS';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
       IDENTIFIED BY 'CINDER_DBPASS';
Query OK, 0 rows affected (0.00 sec) 

 

 

cinder 유저를 생성하고 admin 롤을 부여한다.

[root@controller ~]# openstack user create --domain default --password-prompt cinder
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | default                          |
| enabled   | True                             |
| id        | c573d53072ee49c1945eeadffff98362 |
| name      | cinder                           |
+-----------+----------------------------------+

[root@controller ~]# openstack role add --project service --user cinder admin

 

cinder 및 cinderv2의 서비스를 만든다. 참고로 블럭 스토리지는 두개의 서비스 entity가 필요하다고함

[root@controller ~]# openstack service create --name cinder --description "OpenStack Block Storage" volume
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Block Storage          |
| enabled     | True                             |
| id          | 3eb647fd3fd446d99d5da6361189a4a3 |
| name        | cinder                           |
| type        | volume                           |
+-------------+----------------------------------+
[root@controller ~]# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Block Storage          |
| enabled     | True                             |
| id          | 5794fcb4caaf4ed2977d4dbf38fa11f5 |
| name        | cinderv2                         |
| type        | volumev2                         |
+-------------+----------------------------------+

 

두개의 서비스에 각각 인터널, 퍼블릭, 관리자 API endpoint를 생성한다.

[root@controller ~]# openstack endpoint create --region RegionOne volume public http://controller:8776/v1/%\(tenant_id\)s
+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | 1d8ca25354cc42518c2bdaebb49b2beb        |
| interface    | public                                  |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | 3eb647fd3fd446d99d5da6361189a4a3        |
| service_name | cinder                                  |
| service_type | volume                                  |
| url          | http://controller:8776/v1/%(tenant_id)s |
+--------------+-----------------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne volume internal http://controller:8776/v1/%\(tenant_id\)s
+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | 2037fde213a644ef8cf267d700055a2f        |
| interface    | internal                                |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | 3eb647fd3fd446d99d5da6361189a4a3        |
| service_name | cinder                                  |
| service_type | volume                                  |
| url          | http://controller:8776/v1/%(tenant_id)s |
+--------------+-----------------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne volume admin http://controller:8776/v1/%\(tenant_id\)s
+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | 93c669d42b344fa7b4d8e169bbf9d88c        |
| interface    | admin                                   |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | 3eb647fd3fd446d99d5da6361189a4a3        |
| service_name | cinder                                  |
| service_type | volume                                  |
| url          | http://controller:8776/v1/%(tenant_id)s |
+--------------+-----------------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne volumev2 public http://controller:8776/v2/%\(tenant_id\)s
+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | ec98e3e108224304a2a961c6aa621f4c        |
| interface    | public                                  |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | 5794fcb4caaf4ed2977d4dbf38fa11f5        |
| service_name | cinderv2                                |
| service_type | volumev2                                |
| url          | http://controller:8776/v2/%(tenant_id)s |
+--------------+-----------------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(tenant_id\)s
+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | d8ac4574dd964f30bbe0699af65168ba        |
| interface    | internal                                |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | 5794fcb4caaf4ed2977d4dbf38fa11f5        |
| service_name | cinderv2                                |
| service_type | volumev2                                |
| url          | http://controller:8776/v2/%(tenant_id)s |
+--------------+-----------------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(tenant_id\)s
+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | 2ea1438ad32d4fa4b065afec0e7624d9        |
| interface    | admin                                   |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | 5794fcb4caaf4ed2977d4dbf38fa11f5        |
| service_name | cinderv2                                |
| service_type | volumev2                                |
| url          | http://controller:8776/v2/%(tenant_id)s |
+--------------+-----------------------------------------+

 

패키지를 설치한다.

[root@controller ~]# yum install -y openstack-cinder python-cinderclient
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.cdnetworks.com
 * extras: centos.mirror.cdnetworks.com
 * updates: centos.mirror.cdnetworks.com
Package python-cinderclient-1.4.0-1.el7.noarch already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package openstack-cinder.noarch 1:7.0.1-1.el7 will be installed

...(중략)...

  qemu-img.x86_64 10:1.5.3-105.el7_2.3
  rsyslog-mmjsonparse.x86_64 0:7.4.7-12.el7                 

  sysfsutils.x86_64 0:2.1.0-16.el7

Complete!
[root@controller ~]#

 

/etc/cinder/cinder.conf 파일을 아래와 같이 수정한다.

[database] 섹션에 db 접근 설정을 한다. CINDER_DBPASS는 설정된 패스워드로 변경한다.
[DEFAULT] 와 [oslo_messaging_rabbit] 섹션에 RabbitMQ 설정을 한다. RABBIT_PASS는 설정된 패스워드로 변경한다.
[DEFAULT] 와 [keystone_authtoken] 섹션에 인증 설정을 한다. CINDER_PASS는 설정된 패스워드로 변경. [keystone_authtoken] 엔 해당 내용외에는 모두 지운다.

[DEFAULT] 섹션의 my_ip에 cinder 서비스가 수행되는 컨트롤러의 IP를 설정한다.
[oslo_concurrency] 섹션에 lock path를 설정한다.

(옵션)[DEFAULT] 섹션에서 트러블슈팅시 도움이 될수 있게 verbose를 활성화한다.

[root@controller ~]# vi /etc/cinder/cinder.conf

[DEFAULT]
...
rpc_backend = rabbit
...
auth_strategy = keystone
...
my_ip = 10.0.0.11

...
verbose = True

...


 


[database]
...
connection = mysql://cinder:CINDER_DBPASS@controller/cinder
...


[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS
...


[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller: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/lib/cinder/tmp

 

/etc/nova/nova.conf파일을 수정한다.

[root@controller ~]# vi /etc/nova/nova.conf

 

[cinder]
os_region_name = RegionOne

 

수정한 Nova 재시작, Cinder 시작 및 부팅시 시작하게 설정한다.

[root@controller ~]# systemctl restart openstack-nova-api.service
[root@controller ~]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-cinder-api.service to /usr/lib/systemd/system/openstack-cinder-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-cinder-scheduler.service to /usr/lib/systemd/system/openstack-cinder-scheduler.service.
[root@controller ~]# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

 

 

 

block 노드에 패키지를 설치하기 전에 host 박스에 먼저 접속한다.

block1 노드에 서비스 용 디바이스를 붙여준다.

[root@localhost ~]# qemu-img create -f qcow2 /home/blockdisk.qcow2 100G
Formatting '/home/blockdisk.qcow2', fmt=qcow2 size=107374182400 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
[root@localhost ~]#
[root@localhost ~]# chown qemu:qemu /home/blockdisk.qcow2
[root@localhost ~]#
[root@localhost ~]# virsh pool-refresh home
Pool home refreshed

[root@localhost ~]# virsh vol-list home
 Name                 Path
------------------------------------------------------------------------------
 blockdisk.qcow2      /home/blockdisk.qcow2
 CentOS-6.6-x86_64-bin-DVD1.iso /home/CentOS-6.6-x86_64-bin-DVD1.iso
 CentOS-7-x86_64-DVD-1503-01.iso /home/CentOS-7-x86_64-DVD-1503-01.iso
 CentOS-7-x86_64-DVD-1511.iso /home/CentOS-7-x86_64-DVD-1511.iso
...(중략)...

[root@localhost ~]# vi /etc/libvirt/qemu/newstorage.xml

<disk type='file' device='disk'>
   <driver name='qemu' type='qcow2'/>
   <source file='/home/blockdisk.qcow2'/>
   <target dev='vdb'/>
</disk>

[root@localhost ~]# virsh attach-device --config block1 /etc/libvirt/qemu/newstorage.xml --live
Device attached successfully

 

 

이제 block1 노드에서 작업한다.

디바이스 붙은거 부터 확인해준다.

[root@block1 ~]# parted -l
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/centos-home: 44.8GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0.00B  44.8GB  44.8GB  xfs

...(중략)...


Error: /dev/vdb: unrecognised disk label
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

 

먼저 lvm 패키지를 설치 후 서비스를 등록한다. 리눅스 버전에 따라 설치 되어 있으면 생략한다.

[root@block1 ~]# yum -y install lvm2
Determining fastest mirrors
 * base: ftp.neowiz.com
 * extras: ftp.neowiz.com
 * updates: ftp.neowiz.com
Package 7:lvm2-2.02.130-5.el7_2.1.x86_64 already installed and latest version
Nothing to do

[root@block1 ~]# 

[root@block1 ~]# systemctl enable lvm2-lvmetad.service
Created symlink from /etc/systemd/system/sysinit.target.wants/lvm2-lvmetad.service to /usr/lib/systemd/system/lvm2-lvmetad.service.
[root@block1 ~]# systemctl start lvm2-lvmetad.service

 

PV 생성, VG 생성 순서로

[root@block1 ~]# pvcreate /dev/vdb
  Physical volume "/dev/vdb" successfully created

[root@block1 ~]# vgcreate cinder-volumes /dev/vdb
  Volume group "cinder-volumes" successfully created

 

LVM에서 기본적으로 시스템의 /dev 밑의 모든 디스크를 검색하기 때문에 제외 설정을 해줘야 한다.

/etc/lvm/lvm.conf 파일을 아래와 같이 수정한다. a/가 Accept, r/은 reject이며 기본적으로 cinder에서 사용할 vdb은 포함하고

루트에서 사용중인 vda의 경우도 lvm을 사용중이라면 포함시킨다. 그외에 모든 장비는 제외시킨다.

[root@block1 ~]# vi /etc/lvm/lvm.conf

...

devices {

...
filter = [ "a/vda/", "a/vdb/", "r/.*/"] 

 

이제 cinder 패키지를 설치한다.

[root@block1 ~]# yum install -y openstack-cinder targetcli python-oslo-policy

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.neowiz.com
 * extras: ftp.neowiz.com
 * updates: ftp.neowiz.com
Resolving Dependencies
--> Running transaction check
---> Package openstack-cinder.noarch 1:7.0.1-1.el7 will be installed

...(중략)...

  sysfsutils.x86_64 0:2.1.0-16.el7                          

  tbb.x86_64 0:4.1-9.20130314.el7

Complete!

[root@block1 ~]#

 

/etc/cinder/cinder.conf 파일을 아래와 같이 수정한다.

[database] 섹션에서 DB 접근을 설정한다. CINDER_DBPASS는 설정한 패스워드로 바꾼다.
[DEFAULT] 와 [oslo_messaging_rabbit] 섹션에서 RabbitMQ 설정을 한다.  RABBIT_PASS는 설정한 패스워드로 바꾼다.
[DEFAULT] 와 [keystone_authtoken] 섹션에 인증서비스 정보를 설정을 한다. CINDER_PASS는 설정한 패스워드로 바꾼다.
[DEFAULT] 섹션에서 my_ip 를 block1노드의 아이피인 10.0.0.41로 설정한다.
[lvm] 섹션에 lvm 관련 설정을 해준다.
[DEFAULT] 섹션에서 LVM backend를 활성화 한다.
[DEFAULT] 섹션에서 Image service의 위치를 설정한다.
[oslo_concurrency] 에서 lock path를 설정한다.

(옵션)[DEFAULT] 섹션에서 트러블슈팅시 도움이 될수 있게 verbose를 활성화한다.

[root@block1 ~]# vi /etc/cinder/cinder.conf

[DEFAULT]
...
rpc_backend = rabbit
...
auth_strategy = keystone
...
my_ip = 10.0.0.41
...
enabled_backends = lvm

...
verbose = True

...


[database]
...
connection = mysql://cinder:CINDER_DBPASS@controller/cinder
...


[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS
...


[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = CINDER_PASS
...


[lvm]
...
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
...


[oslo_concurrency]
...
lock_path = /var/lib/cinder/tmp 

 

서비스 시작 및 부팅시 서비스 등록

[root@block1 ~]# systemctl enable openstack-cinder-volume.service target.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-cinder-volume.service to /usr/lib/systemd/system/openstack-cinder-volume.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/target.service to /usr/lib/systemd/system/target.service.
[root@block1 ~]# systemctl start openstack-cinder-volume.service target.service

 

 

 

 

서비스 확인을 위해 컨트롤로 노드로 이동

서비스 리스트로 확인하며 호스트당 1개씩 서비스 확인을 한다.

[root@controller ~]# cinder service-list
+------------------+------------+------+---------+-------+----------------------------+-----------------+
|      Binary      |    Host    | Zone |  Status | State |         Updated_at         | Disabled Reason |
+------------------+------------+------+---------+-------+----------------------------+-----------------+
| cinder-scheduler | controller | nova | enabled |   up  | 2016-03-05T20:10:20.000000 |        -        |
|  cinder-volume   | block1@lvm | nova | enabled |   up  | 2016-03-05T20:10:27.000000 |        -        |
+------------------+------------+------+---------+-------+----------------------------+-----------------+

 

 

 

 

 

+ Recent posts