Skip to content

Docker volume driver to make OpenStack Block Storage volumes (aka Cinder volumes) available as Docker volumes.

License

Notifications You must be signed in to change notification settings

akerouanton/cinder-volume-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cinder-volume-driver

This Docker volume driver makes OpenStack Block Storage volumes (aka Cinder volumes) available as Docker volumes.

It was written to circumvent a big issue found in rexray/cinder: it uses the device name of volume attachments returned by OpenStack API whereas this field is guessed by OpenStack and thus shall not be trusted. From a higher-level, this means Block Storage volumes could be mixed up when attached/mounted by rexray, leading to the wrong containers writing to the wrong volumes. This has been a source of service disruption, data loss, etc... for one of my client.

Since rexray/cinder uses libstorage which is meant to potentially run on another server than the one which got volume attached/mounted, the above issue can't be easily fixed. Also, the code of libstorage and rexray is a bit complex and thus hard to debug.

Moreover, this plugin adds new features not found in rexray/cinder like:

  • The ability to specify the uid/gid and filemode to apply to volumes' root folder after formatting them ;
  • The ability to specify the ID of a snapshot to use to create a volume ;
  • And others volume options (see below).

How to install?

You can install this plugin with:

$ docker plugin install --alias cinder akerouanton/cinder:v0.1 <env-vars>

Supported env vars

Here's the list of env vars supported by this plugin:

Name Default Value Description
OS_AUTH_URL See [1].
OS_USERNAME See [1].
OS_USERID See [1].
OS_PASSWORD See [1].
OS_PASSCODE See [1].
OS_TENANT_ID See [1].
OS_TENANT_NAME See [1].
OS_DOMAIN_ID See [1].
OS_DOMAIN_NAME See [1].
OS_APPLICATION_CREDENTIAL_ID See [1].
OS_APPLICATION_CREDENTIAL_NAME See [1].
OS_APPLICATION_CREDENTIAL_SECRET See [1].
OS_PROJECT_ID See [1].
OS_PROJECT_NAME See [1].
OS_REGION_NAME Name of the OpenStack region where Compute & Block Storage resources are located.
DEFAULT_SIZE 20 Default volume size in GB.
VOLUME_PREFIX Name prefix of volumes managed by this plugin.
LOG_LEVEL debug Log level (either: trace, debug, info, warn, error, fatal, panic).
DEBUG Enable /pprof/trace endpoint when the value is not empty.

[1] https://docs.openstack.org/python-openstackclient/pike/cli/man/openstack.html#environment-variables

Supported volume options

Here's the list of options you can pass when creating a volume :

Name Default Value Description
size The value of DEFAULT_SIZE env var The size of the underlying Block Storage volume.
availability_zone N/A AZ where the underlying Block Storage volume should be created.
consistency_group N/A See https://docs.openstack.org/cinder/latest/admin/blockstorage-consistency-groups.html
description N/A Description of the underlying Block Storage volume.
source_snapshot N/A ID of the Block Storage snaphost used to create the volume.
source_backup N/A ID of the Block Storage backup used to create the volume.
volume_type N/A Block storage volume type.
uid 0 Default UID set on the volume root dir after formatting the volume.
gid 0 Default GID set on the volume root dir after formatting the volume.
mode 0750 Default file mode set on the volume root dir after formatting the volume.

For instance, if you want to define the size of a volume and the source snapshot the volume should be created from, with Docker CLI:

$ docker volume create -d cinder -o size=40 -o source_snapshot=<snapshot-uuid> test

And with docker-compose:

services:
  # ...

volumes:
  test:
    name: test
    driver: cinder
    driver_opts:
      size: 40
      source_snapshot: "<snapshot-uuid>"

How to work on this?

You can create a new devel plugin release with make plugin and you can install it with make install (you have to set env vars in .env file first).

To release a new version you have to use: PLUGIN_VERSION=vX.Y make release.

About

Docker volume driver to make OpenStack Block Storage volumes (aka Cinder volumes) available as Docker volumes.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published