Skip to content

Commit

Permalink
Set sensible directory defaults
Browse files Browse the repository at this point in the history
Instead of storing locks and volume private binds into the current
directory we will now store them under:

- /var/lib/ember-csi/locks
- /var/lib/ember-csi/vols

We also set the state_path to /var/lib/ember-csi to ensure a sensible
default.
  • Loading branch information
Akrog committed Jan 16, 2019
1 parent 8e9778c commit 5021ca5
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 19 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ LABEL maintainers="Gorka Eguileor <geguileo@redhat.com>" \
# We need to upgrade pyasn1 because the package for RDO is not new enough for
# pyasn1_modules, which is used by some of the Google's libraries
RUN yum -y install xfsprogs e2fsprogs btrfs-progs nmap-ncat python2-future && \
mkdir -p /var/lib/ember-csi/{vols,locks} && \
pip install --no-cache-dir --upgrade 'pyasn1<0.5.0,>=0.4.1' future && \
yum clean all && \
rm -rf /var/cache/yum && \
pip install --no-cache-dir --upgrade 'pyasn1<0.5.0,>=0.4.1' future
rm -rf /var/cache/yum

# Copy Ember-csi from directory directory
COPY . /csi
Expand Down
1 change: 1 addition & 0 deletions Dockerfile-master
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN yum -y install targetcli iscsi-initiator-utils device-mapper-multipath epel-
# Apply cinderlib patch
cd cinder && git fetch https://git.openstack.org/openstack/cinder refs/changes/69/620669/10 && git checkout FETCH_HEAD && cd .. && \
pip install --no-cache-dir cinder/ && \
mkdir -p /var/lib/ember-csi/{vols,locks} && \
rm -rf cinder && \
yum -y remove git python-devel gcc && \
yum clean all && \
Expand Down
1 change: 1 addition & 0 deletions Dockerfile-release
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ LABEL maintainers="Gorka Eguileor <geguileo@redhat.com>" \
# We need to upgrade pyasn1 because the package for RDO is not new enough for
# pyasn1_modules, which is used by some of the Google's libraries
RUN yum -y install xfsprogs e2fsprogs btrfs-progs python2-future && \
mkdir -p /var/lib/ember-csi/{vols,locks} && \
yum clean all && \
rm -rf /var/cache/yum && \
pip install --no-cache-dir --upgrade --process-dependency-links 'pyasn1<0.5.0,>=0.4.1' future ember-csi
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test-all: ## run tests on every Python version with tox
centos-bm-lvm:
X_CSI_PERSISTENCE_CONFIG='{"storage":"memory"}' \
X_CSI_BACKEND_CONFIG='{"target_protocol":"iscsi","iscsi_ip_address":"127.0.0.1","volume_backend_name":"lvm","volume_driver":"cinder.volume.drivers.lvm.LVMVolumeDriver","volume_group":"ember-volumes","target_helper":"lioadm"}' \
X_CSI_EMBER_CONFIG='{"project_id":"io.ember-csi","user_id":"io.ember-csi","root_helper":"sudo","disable_logs":false,"debug":true,"request_multipath":false}' \
X_CSI_EMBER_CONFIG='{"project_id":"io.ember-csi","user_id":"io.ember-csi","root_helper":"sudo","disable_logs":false,"debug":true,"request_multipath":false,"file_locks_path":"/tmp"}' \
travis-scripts/run-bm-sanity.sh

centos-lvm:
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,20 @@ For RBD we'll also need a specific package:

The CSI driver is configured via environmental variables, any value that doesn't have a default is a required value.

| Name | Role | Description | Default | Example |
| -------------------------- | ---------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CSI_ENDPOINT` | all | IP and port to bind the service | [::]:50051 | 192.168.1.22:50050 |
| `CSI_MODE` | all | Role the service should perform: controller, node, all | all | controller |
| `X_CSI_SPEC_VERSION` | all | CSI Spec version to run. Supported v0.2 and v1.0 | v0.2.0 | 0.2.0
| `X_CSI_STORAGE_NW_IP` | node | IP address in the Node used to connect to the storage | IP resolved from Node's fqdn | 192.168.1.22 |
| `X_CSI_NODE_ID` | node | ID used by this node to identify itself to the controller | Node's fqdn | csi_test_node |
| `X_CSI_PERSISTENCE_CONFIG` | all | Configuration of the `cinderlib` metadata persistence plugin. | {"storage": "crd", "namespace": "default"} | {"storage": "db", "connection": "mysql+pymysql://root:stackdb@192.168.1.1/cinder?charset=utf8"} |
| `X_CSI_EMBER_CONFIG` | all | Global `cinderlib` configuration | {'project_id': 'io.ember-csi', 'user_id': 'io.ember-csi', 'root_helper': 'sudo', 'request_multipath': true, 'plugin_name': 'io.ember-csi'} | {"project_id":"k8s project","user_id":"csi driver","root_helper":"sudo",'plugin_name': 'io.ember-csi.external-ceph'} |
| `X_CSI_BACKEND_CONFIG` | controller | Driver configuration | | {"volume_backend_name": "rbd", "volume_driver": "cinder.volume.drivers.rbd.RBDDriver", "rbd_user": "cinder", "rbd_pool": "volumes", "rbd_ceph_conf": "/etc/ceph/ceph.conf", "rbd_keyring_conf": "/etc/ceph/ceph.client.cinder.keyring"} |
| `X_CSI_DEFAULT_MOUNT_FS` | node | Default mount filesystem when missing in publish calls | ext4 | btrfs |
| `X_CSI_SYSTEM_FILES` | all | All required storage driver-specific files archived in tar, tar.gz or tar.bz2 format| | /path/to/etc-ceph.tar.gz |
| `X_CSI_DEBUG_MODE` | all | Debug mode (rpdb, pdb) to use. Disabled by default. | | rpdb |
| `X_CSI_ABORT_DUPLICATES` | all | If we want to abort or queue (default) duplicated requests. | false | true |
| Name | Role | Description | Default | Example |
| -------------------------- | ---------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CSI_ENDPOINT` | all | IP and port to bind the service | [::]:50051 | 192.168.1.22:50050 |
| `CSI_MODE` | all | Role the service should perform: controller, node, all | all | controller |
| `X_CSI_SPEC_VERSION` | all | CSI Spec version to run. Supported v0.2 and v1.0 | v0.2.0 | 0.2.0
| `X_CSI_STORAGE_NW_IP` | node | IP address in the Node used to connect to the storage | IP resolved from Node's fqdn | 192.168.1.22 |
| `X_CSI_NODE_ID` | node | ID used by this node to identify itself to the controller | Node's fqdn | csi_test_node |
| `X_CSI_PERSISTENCE_CONFIG` | all | Configuration of the `cinderlib` metadata persistence plugin. | {"storage": "crd", "namespace": "default"} | {"storage": "db", "connection": "mysql+pymysql://root:stackdb@192.168.1.1/cinder?charset=utf8"} |
| `X_CSI_EMBER_CONFIG` | all | Global `cinderlib` configuration | {'project_id': 'io.ember-csi', 'user_id': 'io.ember-csi', 'root_helper': 'sudo', 'request_multipath': true, 'plugin_name': 'io.ember-csi', 'file_locks_path': '/var/lib/ember-csi/locks'} | {"project_id":"k8s project","user_id":"csi driver","root_helper":"sudo",'plugin_name': 'io.ember-csi.external-ceph'} |
| `X_CSI_BACKEND_CONFIG` | controller | Driver configuration | | {"volume_backend_name": "rbd", "volume_driver": "cinder.volume.drivers.rbd.RBDDriver", "rbd_user": "cinder", "rbd_pool": "volumes", "rbd_ceph_conf": "/etc/ceph/ceph.conf", "rbd_keyring_conf": "/etc/ceph/ceph.client.cinder.keyring"} |
| `X_CSI_DEFAULT_MOUNT_FS` | node | Default mount filesystem when missing in publish calls | ext4 | btrfs |
| `X_CSI_SYSTEM_FILES` | all | All required storage driver-specific files archived in tar, tar.gz or tar.bz2 format| | /path/to/etc-ceph.tar.gz |
| `X_CSI_DEBUG_MODE` | all | Debug mode (rpdb, pdb) to use. Disabled by default. | | rpdb |
| `X_CSI_ABORT_DUPLICATES` | all | If we want to abort or queue (default) duplicated requests. | false | true |

The only role that has been tested at the moment is the default one, where Controller and Node servicer are executed in the same service (`CSI_MODE=all`), and other modes are expected to have issues at the moment.

Expand Down
2 changes: 1 addition & 1 deletion ember_csi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def _get_mountinfo(self):
return self._get_split_file('/proc/self/mountinfo')

def _vol_private_location(self, volume_id):
private_bind = os.path.join(os.getcwd(), volume_id)
private_bind = os.path.join(defaults.VOL_BINDS_DIR, volume_id)
return private_bind

def _get_mount(self, private_bind):
Expand Down
6 changes: 5 additions & 1 deletion ember_csi/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
MODE = 'all'
PERSISTENCE_CFG = {'storage': 'crd', 'namespace': 'default'}
ROOT_HELPER = 'sudo'
STATE_PATH = '/var/lib/ember-csi'
VOL_BINDS_DIR = STATE_PATH + '/vols'
LOCKS_DIR = STATE_PATH + '/locks'
EMBER_CFG = {'project_id': NAME, 'user_id': NAME, 'plugin_name': NAME,
'root_helper': ROOT_HELPER, 'request_multipath': True}
'root_helper': ROOT_HELPER, 'request_multipath': True,
'file_locks_path': LOCKS_DIR, 'state_path': STATE_PATH}

LOG_LEVELS = ('amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,'
'suds=WARN,oslo.messaging=WARN,oslo_messaging=WARN,iso8601=WARN,'
Expand Down

0 comments on commit 5021ca5

Please sign in to comment.