Skip to content

Home Lab

Notes from my learning sessions

Menu
Menu

Openstack – Train : Cinder – Block storage service

Posted on October 11, 2020July 3, 2022 by sandeep

<<< Horizon                                                             Configure networks, router, flavour and launch instance >>>

Create database for cinder services

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

Create service credentials

. admin-openrc
openstack user create --domain default --password-prompt cinder

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

Create the cinderv2 and cinderv3 service entities

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

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

Create service endpoints

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

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

Install the packages

apt install -y cinder-api cinder-scheduler

Update or update configurations in respective sections as shown below in /etc/cinder/cinder.conf

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

[DEFAULT]
transport_url = rabbit://openstack:password@controller
auth_strategy = keystone
my_ip = 10.99.1.3

Add the following sections in /etc/cinder/cinder.conf

[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 = homelab
username = cinder
password = password

[oslo_concurrency]

lock_path = /var/lib/cinder/tmp

Populate the database

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

Update cinder section in /etc/nova/nova.conf

[cinder]
os_region_name = RegionOne

Restart impacted services

service nova-api restart
service cinder-scheduler restart service apache2 restart

Create Cinder Volumes

Install required supporting packages

apt install -y lvm2 thin-provisioning-tools

I had planned to use /dev/sdb for Cinder storage – Create the LVM physical volume /dev/sdb

pvcreate /dev/sdb

Note the above command failed as a partition was already created.  I had used the following command to clear it and then proceed with pvcreate.

# wipefs -a /dev/sdb
/dev/sdb: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/sdb: 8 bytes were erased at offset 0x2800cacfe00 (gpt): 45 46 49 20 50 41 52 54
/dev/sdb: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
/dev/sdb: calling ioctl to re-read partition table: Success

# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created.

Create the LVM volume group cinder-volumes

vgcreate cinder-volumes /dev/sdb

Edit the /etc/lvm/lvm.conf file, in the devices section, add a filter that accepts the /dev/sdb device and rejects all other devices

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

Install cinder-volume package

apt install -y cinder-volume

Update Glance API server configuration in the [DEFAULT] section of /etc/cinder/cinder.conf

[DEFAULT]
glance_api_servers = http://controller:9292

Add the following section to /etc/cinder/cinder.conf

[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
target_protocol = iscsi
target_helper = tgtadm

Restart services as listed below

service tgt restart
service cinder-volume restart

<<< Horizon                                                                  Configure networks, router, flavour and launch instance >>>

Recent Posts

  • Openstack Xena on Ubuntu 20.04 – Cinder
  • Preparing custom Debian 11 MATE image
  • Setup Ubuntu 20.04 repository mirror server
  • Preparing custom Debian 11 server cloud image
  • Complile Linux Kernel (on Debian 11)
  • Openstack Xena – Test Home Lab
  • Openstack Xena on Ubuntu 20.04 – Horizon
  • Openstack Xena on Ubuntu 20.04 -Home Lab
  • Openstack Xena on Ubuntu 20.04 – Neutron
  • Openstack Xena on Ubuntu 20.04 – Nova

Archives

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