Rate This Document
Findability
Accuracy
Completeness
Readability

Installing, Configuring, and Verifying Cinder

Cinder is a block storage service that provides persistent storage for VM instances. It simplifies the creation and management of block storage devices.

Creating the Cinder Database

Perform the following operations on the controller node.

  1. Access the MySQL database as the root user.
    1
    mysql -u root -p
    
  2. Create the Cinder database and grant proper access to the Cinder database.
    1
    2
    3
    4
    CREATE DATABASE cinder;
    GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY '<PASSWORD>';
    GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY '<PASSWORD>';
    exit
    

    In this document, all passwords are represented as <PASSWORD>. Use the actual password during the operation. The PASSWORD here is the password for accessing the Cinder database.

  3. Log in to the OpenStack CLI as the admin user and create service credentials and the cinder user.
    1
    2
    source /etc/keystone/admin-openrc
    openstack user create --domain default --password-prompt cinder
    
  4. Add the admin role to the cinder user.
    1
    openstack role add --project service --user cinder admin
    
  5. Create cinderv2 and cinderv3 service entities.
    1
    2
    openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
    openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
    

    Two service entities need to be created for the Cinder service.

  6. Create API endpoints of the Block Storage service.
    1
    2
    3
    openstack endpoint create --region RegionOne volumev2 public http://controller:8776/v2/%\(project_id\)s
    openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(project_id\)s
    openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(project_id\)s
    

    1
    2
    3
    openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s
    openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s
    openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s
    

Installing and Configuring Cinder

Perform the following operations on the controller node.

  1. Install the software package.
    1
    yum -y install openstack-cinder
    
  2. Edit the /etc/cinder/cinder.conf file.
    1
    vim /etc/cinder/cinder.conf
    

    Perform the following operations:

    1. Configure database access and replace <PASSWORD> with the correct password.
      1
      2
      [database]
      connection = mysql+pymysql://cinder:<PASSWORD>@controller/cinder
      
    2. Configure RabbitMQ message queue access and replace PASSWORD with the correct password.
      1
      2
      [DEFAULT]
      transport_url = rabbit://openstack:<PASSWORD>@controller
      
    3. Configure Identity service access and replace <PASSWORD> with the password selected for the cinder user in the Identity service.

      DEFAULT section:

      1
      2
      [DEFAULT]
      auth_strategy = keystone
      
      keystone_authtoken section:
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      [keystone_authtoken]
      www_authenticate_uri = http://controller:5000
      auth_url = http://controller:5000
      memcached_servers = controller:11211
      auth_type = password
      project_domain_name = default
      user_domain_name = default
      project_name = service
      username = cinder
      password = <PASSWORD>
      
    4. Configure the my_ip option to use the management IP address of the controller node.
      1
      2
      [DEFAULT]
      my_ip = 172.168.201.11
      
    5. Configure the lock path.
      1
      2
      [oslo_concurrency]
      lock_path = /var/lib/cinder/tmp
      
  3. Populate the block storage database.
    1
    su -s /bin/sh -c "cinder-manage db sync" cinder
    

Configuring Block Storage for Compute Nodes

Perform the following operations on the controller node.

  1. Open the /etc/nova/nova.conf file in edit mode.
    1
    vim /etc/nova/nova.conf
    
  2. Modify the file as follows:
    1
    2
    [cinder]
    os_region_name = RegionOne
    

Completing Installation on the Controller Node

Perform the following operations on the controller node.

  1. Restart the Compute API service.
    1
    systemctl restart openstack-nova-api.service
    
  2. Enable the Block Storage service and configure it to start as the system boots.
    1
    2
    systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
    systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
    

  3. Verify the installation on the controller node. If the state is up, the controller node is running properly.
    1
    openstack volume service list
    

Integrating Ceph Block Storage

The current version does not support local storage. Ceph needs to be integrated to implement the storage function. For details, see Ceph Block Storage Deployment Guide (CentOS 7.6 & openEuler 20.03) and OpenStack and Ceph Integrated Deployment Guide.

Installing and Configuring the Storage Nodes

Perform the following operations on storage nodes.

  1. Install the software package.
    1
    yum -y install openstack-cinder  python2-keystone
    
  2. Edit the /etc/cinder/cinder.conf file.
    1
    vim /etc/cinder/cinder.conf
    

    Perform the following operations:

    1. Configure database access.
      1
      2
      [database]
      connection = mysql+pymysql://cinder:<PASSWORD>@controller/cinder
      

      <PASSWORD> indicates the password of the Block Storage database.

    2. Configure RabbitMQ message queue access.
      1
      2
      [DEFAULT]
      transport_url = rabbit://openstack:<PASSWORD>@controller
      

      <PASSWORD> indicates the password of the openstack user for RabbitMQ.

    3. Configure Identity service access.
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      [DEFAULT]
      auth_strategy = keystone
      [keystone_authtoken]
      www_authenticate_uri = http://controller:5000
      auth_url = http://controller:5000
      memcached_servers = controller:11211
      auth_type = password
      project_domain_name = default
      user_domain_name = default
      project_name = service
      username = cinder
      password = <PASSWORD>
      

      <PASSWORD> indicates the password of the cinder user for the Identity service.

    4. Set my_ip to the IP address of the management network port on the storage node.
      1
      2
      [DEFAULT]
      my_ip = 172.168.201.12
      
    5. Add the [lvm] configuration. Use the LVM driver, cinder-volumes volume group, iSCSI protocol, and the corresponding iSCSI service to configure the LVM backend.
      1
      2
      3
      4
      5
      [lvm]
      volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
      volume_group = cinder-volumes
      target_protocol = iscsi
      target_helper = lioadm
      
    6. Enable the LVM backend.
      1
      2
      [DEFAULT]
      enabled_backends = lvm
      
    7. Configure the location of the Image service API.
      1
      2
      [DEFAULT]
      glance_api_servers = http://controller:9292
      
    8. Configure the lock path.
      1
      2
      [oslo_concurrency]
      lock_path = /var/lib/cinder/tmp
      

Completing the Installation

Perform the following operation on storage nodes.

Enable the Block Storage volume service (including its dependencies) and configure it to start as the system boots.

1
2
systemctl enable openstack-cinder-volume.service 
systemctl start openstack-cinder-volume.service 

Verifying Cinder

Perform the following operations on the controller node.

  1. Log in to the OpenStack CLI as the admin user.
    1
    source /etc/keystone/admin-openrc
    
  2. List service components to verify that each process is successfully started.
    1
    openstack volume service list
    

Common Cinder Commands

Command

Description

openstack volume create --size 1 volume1

Creates a volume.

openstack volume list

Displays the volume list.

openstack volume delete VOLNAME-OR-ID

Deletes the selected volume.

openstack volume snapshot create --volume VOLNAME-OR-ID SNAPSHOT-VOLNAME

Creates a snapshot of a volume.

openstack volume snapshot list

Displays the snapshots of a volume.

nova volume-attach VM_ID VOLUME_ID /dev/vdb

Attaches a volume to a VM.

nova volume-detach VM_ID VOLUME_ID

Detaches a volume from a VM.