Ceph, Cinder

Cinder and Ceph – multi back-end

Here, I will explain the Cinder – multi back-end functionality using Ceph as storage back-end.

On Ceph node:

Create a new pool on ceph node using the below commands (more detail how to create a pool -please ref: http://docs.ceph.com/docs/master/rados/operations/placement-groups/

ceph osd pool create volumes1 256

Create a new user with the appropriate rights for cinder to be able to access Ceph’s storage using the following commands on a Ceph node:

ceph auth get-or-create client.volumes1 mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes1, allow rx pool=images'

A keyring file can be created with the following command on a Ceph node and copy the above keyring to cinder-volume nodes.

ceph auth get-or-create client.volumes1 > ceph.client.volumes1.keyring

On Cinder node:

The keyring file created above should be copied on the cinder nodes, in the  /etc/ceph/ directory:

Now, update the cinder configuration file   /etc/cinder/cinder.conf by adding the new back-end details. A new back-end  as “volumes1” will be added to the enabled_backends configuration flag:

enabled_backends = former-backend,volumes1
[former-backend]...

[volumes1]
volume_driver = cinder.volume.drivers.rbd.RBDDriver
volume_backend_name = volumes1
rbd_pool = volumes1
glance_api_version = 2
rbd_user = volumes1
rbd_secret_uuid = uuid_of_secret

If the scheduler_driver parameter is not set to FilterScheduler, it has to be updated:

scheduler_driver = cinder.scheduler.filter_scheduler.FilterScheduler

After updating the configuration file,  restart the cinder-volume service,  to load the updated configurations:

sudo service cinder-volume restart

Now, create a new volume-type to Cinder,  using the below command:

Use ‘admin’ credentials (OS_USERNAME, OS_TENANT_NAME and OS_PASSWORD):

cinder type-create volumes1
cinder type-key volumes1 set volume_backend_name=volumes1
cinder extra-specs-list

The above command will show all volume types list.

Now, we should be able to create new cinder volumes using  new volume type as “volumes1” using “volume1” as a back-end:

cinder create --volume-type volumes1 --display-name test-vol1 1
cinder list

Note:  Misplacing the settings can have dangerous side effects. All settings below the enabled_backends parameter are actually in some section (eg. [former-volume]) of the conf file rather than [DEFAULT]. Make sure to move the [former-volume] and [volume1] settings to the bottom of the file and so that all other settings are in the [DEFAULT] section.

 

Advertisements
Cinder, Openstack

Openstack micro version APIs usage with CURL

Openstack supports the micro version for its APIs. Here is quick tips to use the micro versioned API with CURL command.

First get a token from keystone:

swami@ubuntu:~/devstack$ openstack token issue
+------------+----------------------------------+
| Field      | Value                            |
+------------+----------------------------------+
| expires    | 2016-07-15T12:56:35Z             |
| id         | 49f5673ad7954f68a46702d52dede0df |
| project_id | 4e5f6ba3f2ba4e68bce144f1f9eb843a |
| user_id    | 68d155723d7342d3ad29047ca0ac378c |
+------------+----------------------------------+

Get the cinder CURL command from “cinder –debug list”

curl -g -i -X GET 
http://10.0.2.15:8776/v2/4e5f6ba3f2ba4e68bce144f1f9eb843a/volumes/detail  
-H "Accept: application/json" -H "X-Auth-Token:49f5673ad7954f68a46702d52dede0df"
HTTP/1.1 200 OK
X-Compute-Request-Id: req-ec992a49-b644-4b53-a9fa-5f3b36ea10c1
Content-Type: application/json
Content-Length: 15
X-Openstack-Request-Id: req-ec992a49-b644-4b53-a9fa-5f3b36ea10c1
Date: Fri, 15 Jul 2016 12:01:49 GMT
{"volumes": []}swami@ubuntu:~/devstack$

Now use the micro-versions using the hearders as below:

curl -g -i -X GET 
http://10.0.2.15:8776/v2/4e5f6ba3f2ba4e68bce144f1f9eb843a/volumes/detail  
-H "Accept: application/json" -H "X-Auth-Token:49f5673ad7954f68a46702d52dede0df"
-H "OpenStack-API-version: volume 3.0"
HTTP/1.1 200 OK
X-Compute-Request-Id: req-154b85db-35ed-4d2b-91eb-2751ba74d8d7
Content-Type: application/json
Content-Length: 1035
X-Openstack-Request-Id: req-154b85db-35ed-4d2b-91eb-2751ba74d8d7
Date: Fri, 15 Jul 2016 12:15:40 GMT
{"volumes": [{"migration_status": null, "attachments": [], "links": 
[{"href": "http://10.0.2.15:8776/v2/4e5f6ba3f2ba4e68bce144f1f9eb843a/
volumes/109a2cb0-2ad2-495f-8334-4593ab06a199", "rel": "self"}, {"href": "
http://10.0.2.15:8776/4e5f6ba3f2ba4e68bce144f1f9eb843a/volumes/109a2cb0-2ad2-495f-8334-4593ab06a199", "rel": "bookmark"}], "availability_zone": "nova", "os-vol-host-attr:host": "ubuntu@lvmdriver-1#lvmdriver-1", "encrypted": false, "updated_at": "2016-07-15T12:07:56.000000", "replication_status": "disabled", "snapshot_id": null, "id": "109a2cb0-2ad2-495f-8334-4593ab06a199", "size": 1, "user_id": "68d155723d7342d3ad29047ca0ac378c", "os-vol-tenant-attr:tenant_id": "4e5f6ba3f2ba4e68bce144f1f9eb843a", "os-vol-mig-status-attr:migstat": null, "metadata": {}, "status": "available", "description": null, "multiattach": false, "source_volid": null, "consistencygroup_id": null, "os-vol-mig-status-attr:name_id": null, "name": null, "bootable": "false", "created_at": "2016-07-15T12:07:51.000000", "volume_type": "lvmdriver-1"}]}swami
HTTP/1.1 200 OK
X-Compute-Request-Id: req-ec992a49-b644-4b53-a9fa-5f3b36ea10c1
Content-Type: application/json
Content-Length: 15
X-Openstack-Request-Id: req-ec992a49-b644-4b53-a9fa-5f3b36ea10c1
Date: Fri, 15 Jul 2016 12:01:49 GMT
{"volumes": []}swami@ubuntu:~/devstack$

If you use a micro version API, which is not supported, then cinder will give the min and max micro versions it supported as below . here I used version 3.7, which is not supported:

curl -g -i -X GET 
http://10.0.2.15:8776/v2/4e5f6ba3f2ba4e68bce144f1f9eb843a/volumes/detail  
-H "Accept: application/json" -H "X-Auth-Token:49f5673ad7954f68a46702d52dede0df"
-H "OpenStack-API-version: volume 3.7"
HTTP/1.1 406 Not Acceptable
Openstack-Api-Version: 3.7
Vary: OpenStack-API-Version
Content-Length: 121
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-2f89acb7-f7d9-44c1-be06-8854e18332df
X-Openstack-Request-Id: req-2f89acb7-f7d9-44c1-be06-8854e18332df
Date: Fri, 15 Jul 2016 12:26:56 GMT

{"computeFault": {"message": "Version 3.7 is not supported by the API. 
Minimum is 3.0 and maximum is 3.6.", "code": 406}}

Here we can use other component’s API micro versioned APIs in the hearders as below:

curl -g -i -X GET 
http://10.0.2.15:8776/v2/4e5f6ba3f2ba4e68bce144f1f9eb843a/volumes/detail  
-H "Accept: application/json" -H "X-Auth-Token:49f5673ad7954f68a46702d52dede0df"
-H "OpenStack-API-version: volume 3.6, compute 2.21 identity 3.0"
HTTP/1.1 200 OK
X-Compute-Request-Id: req-17ad037c-3230-47be-bf54-8e9267ca24e3
Content-Type: application/json
Content-Length: 1035
Openstack-Api-Version: volume 3.6
Vary: OpenStack-API-Version
X-Openstack-Request-Id: req-17ad037c-3230-47be-bf54-8e9267ca24e3
Date: Fri, 15 Jul 2016 12:33:42 GMT

{"volumes": [{"migration_status": null, "attachments": [], "links": [{"href": 
"http://10.0.2.15:8776/v3/4e5f6ba3f2ba4e68bce144f1f9eb843a/volumes/
109a2cb0-2ad2-495f-8334-4593ab06a199", "rel": "self"}, {"href": 
"http://10.0.2.15:8776/4e5f6ba3f2ba4e68bce144f1f9eb843a/volumes/
109a2cb0-2ad2-495f-8334-4593ab06a199", "rel": "bookmark"}], "availability_zone":
"nova", "os-vol-host-attr:host": "ubuntu@lvmdriver-1#lvmdriver-1", "encrypted": 
false, "updated_at": "2016-07-15T12:07:56.000000", "replication_status":
 "disabled", "snapshot_id": null, "id": "109a2cb0-2ad2-495f-8334-4593ab06a199", 
"size": 1, "user_id": "68d155723d7342d3ad29047ca0ac378c", "os-vol-tenant-attr:
tenant_id": "4e5f6ba3f2ba4e68bce144f1f9eb843a", "os-vol-mig-status-attr:migstat":
 null, "metadata": {}, "status": "available", "description": null, "multiattach":
 false, "source_volid": null, "consistencygroup_id": null, "os-vol-mig-status-attr:
name_id": null, "name": null, "bootable": "false", "created_at": 
"2016-07-15T12:07:51.000000", "volume_type": "lvmdriver-1"}]}

 

Cinder

Cinder backup service enabling

Here are the quick steps to enable the cinder backup services for ceph and swift storage backends.

For ceph storage as backup back-end:

To enable the Ceph backup driver, include the following option in the cinder.conf file:

backup_driver = cinder.backup.drivers.ceph
backup_ceph_conf=/etc/ceph/ceph.conf
backup_ceph_user = cinder
backup_ceph_chunk_size = 134217728
backup_ceph_pool = backups
backup_ceph_stripe_unit = 0
backup_ceph_stripe_count = 0

For SWIFT storage as backup back-end:

To enable the SWIFT backup driver, include the following option in the cinder.conf file:

backup_driver = cinder.backup.drivers.swift
backup_swift_url = http://localhost:8080/v1/AUTH_
backup_swift_container = volumebackups
backup_swift_object_size = 52428800
backup_swift_retry_attempts = 3
backup_swift_retry_backoff = 2
backup_compression_algorithm = zlib
backup_swift_auth = per_user
backup_swift_user = <None>
backup_swift_key = <None>