Skip to content

Home Lab

Notes from my learning sessions

Menu
Menu

Openstack Xena on Ubuntu 20.04 – Cinder

Posted on April 17, 2022April 17, 2022 by sandeep

[  Previous: Horizon  (8/9)  ]         [  9 /9: Cinder  ]          [  Next: Test Home Lab  ]

Installing Cinder Scheduler

Create Cinder service user account

openstack user create --domain default --project service --password password cinder

Associate admin role

openstack role add --project service --user cinder admin

Create Cinder service entry

openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3

Create end points

openstack endpoint create --region RegionOne volumev3 public http://10.0.3.1:8776/v3/%\(tenant_id\)s
openstack endpoint create --region RegionOne volumev3 internal http://10.0.3.1:8776/v3/%\(tenant_id\)s
openstack endpoint create --region RegionOne volumev3 admin http://10.0.3.1:8776/v3/%\(tenant_id\)s

Create DB and assign rights to db user account (from mysql prompt)

create database cinder; 
grant all privileges on cinder.* to cinder@'localhost' identified by 'password'; 
grant all privileges on cinder.* to cinder@'%' identified by 'password'; 
flush privileges;
exit

Install Cinder Service.
apt -y install cinder-api cinder-scheduler python3-cinderclient

Update cinder configuration in /etc/cinder/cinder.conf

Note : Easier to take a backup of existing file and create new on with following contents

[DEFAULT]
my_ip = 10.0.3.1
rootwrap_config = /etc/cinder/rootwrap.conf
api_paste_confg = /etc/cinder/api-paste.ini
state_path = /var/lib/cinder
auth_strategy = keystone
transport_url = rabbit://openstack:password@10.0.3.1
enable_v3_api = True

[database]
connection = mysql+pymysql://cinder:password@10.0.3.1/cinder

[keystone_authtoken]
www_authenticate_uri = http://10.0.3.1:5000
auth_url = http://10.0.3.1:5000
memcached_servers = 10.0.3.1:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = password

[oslo_concurrency]
lock_path = $state_path/tmp

If you had created a new config file then set access rights to the file

chmod 640 /etc/cinder/cinder.conf
chgrp cinder /etc/cinder/cinder.conf

Populate Cinder DB

su -s /bin/bash cinder -c "cinder-manage db sync"

Restart cinder scheduler service

systemctl restart cinder-scheduler
systemctl enable cinder-scheduler

Update the admin-rc file

echo "export OS_VOLUME_API_VERSION=3" >> /root/admin-rc

Source the admin-rc file

source /root/admin-rc

Verify cinder service

openstack volume service list
+------------------+------------+------+---------+-------+----------------------------+
| Binary           | Host       | Zone | Status  | State | Updated At                 |
+------------------+------------+------+---------+-------+----------------------------+
| cinder-scheduler | controller | nova | enabled | up    | 2022-04-14T06:44:38.000000 |
+------------------+------------+------+---------+-------+----------------------------+

Installing Cinder Volumes

Create LVM physical volume, in my case /dev/sda was used for installing OS and Openstack.  /dev/sdb was planned for cinder volumes.

pvcreate /dev/sdb1

Create the LVM volume group cinder-volumes

vgcreate cinder-volumes /dev/sdb1

Reconfigure LVM to scan only the devices that contain the cinder-volumes volume group. Edit the /etc/lvm/lvm.conf

In the devices section, add a filter that accepts the /dev/sdb device and rejects all other devices

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

Install packages required for cinder volume usage

apt -y install cinder-volume python3-mysqldb targetcli-fb python3-rtslib-fb

Udpate (add) the configuration in [DEFAULT] section of /etc/cinder/cinder.conf

[DEFAULT]
glance_api_servers = http://10.1.23.35:9292
enable_backends = lvm

Add the following section at the end of /etc/cinder/cinder.conf

[lvm]
target_helper = lioadm
target_protocol = iscsi
target_ip_address = 10.0.3.1
volume_group = cinder-volumes
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volumes_dir = $state_path/volumes

Restart Cinder volume service

service cinder-volume restart

Add cinder configuration to nova service – Add the following at the end of /etc/nova/nova.conf

[cinder]
os_region_name = RegionOne

Restart nova

systemctl restart nova-compute

Verify volume creation and deletion

root@controller:~# openstack volume create --size 10 disk01
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | nova                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2022-04-14T07:07:12.227528           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | dc9a94fc-67ed-44fa-b1f0-fee4bd9e1945 |
| migration_status    | None                                 |
| multiattach         | False                                |
| name                | disk01                               |
| properties          |                                      |
| replication_status  | None                                 |
| size                | 10                                   |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | __DEFAULT__                          |
| updated_at          | None                                 |
| user_id             | 94f35d2800094fe0b578f8123bbd55f4     |
+---------------------+--------------------------------------+
root@controller:~# openstack volume delete disk01
root@controller:~#

 

 

 

 

 

 

 

 

 

 

 

 

[  Previous: Horizon  (8/9)  ]         [  9 /9: Cinder  ]          [  Next: Test Home Lab  ]

Recent Posts

  • Ceph + KVM: 4. Orchestrating Ceph RBD backed VMs on KVM Hosts
  • Rabbit MQ Cluster + HAProxy + Keepalived
  • Install and configure MariaDB / Galera cluster
  • Ceph + KVM : 3. Installing KVM, cutsomized monitoring scripts
  • Ceph + KVM : 5. Service checks and CLI commands
  • Ceph + KVM : 2. Installation – Ceph Storage
  • Ceph + KVM : 1. Planning and preparing for Ceph Storage
  • Openstack Xena on Ubuntu 20.04 – Cinder
  • Preparing custom Debian 11 MATE image
  • Setup Ubuntu 20.04 repository mirror server

Archives

  • April 2025
  • March 2025
  • October 2024
  • September 2024
  • April 2022
  • March 2022
  • February 2022
  • December 2021
  • October 2021
  • September 2021
  • October 2020
  • February 2020
  • January 2020
  • December 2019
© 2025 Home Lab | Powered by Minimalist Blog WordPress Theme