Commit Graph

9 Commits

Author SHA1 Message Date
Brian Rosmaita f165c6ff5e Stop cinderlib development
Remove files from master, as development will no longer occur there.
The stable branches continue to be supported while they are in
Maintained status.

Updated the README to indicate this change.

Depends-on: Ib186ac5830e5920e264d79be946995e63e960426
Depends-on: I081cd363117671eaab6a3193094d5872f9820354
Depends-on: If2b9a82cddb20543b176ee22765049db257c89b9
Depends-on: I1143e5e5ccf8103e386fe1ce614a554e7f152d9a
Change-Id: I4722b869033ad1bd357e36c4a258b6d3ea61f5d6
2024-01-05 16:03:46 +00:00
Brian Rosmaita e4dd75a3b4 Add local upper constraints support
The issue is that we want to install os-brick from source, but if we
do this using upper-constraints on the install, it will fail.  This
patch modifies the tox install command used by appropriate testenvs
so it will create and use a local constraints file with os-brick
removed.

The local u-c file is named 'local-upper-constraints.txt'.  The
constraints file used can be overridden via the
CINDERLIB_CONSTRAINTS_FILE environment variable.

Change-Id: I8cb4085dd465043a783c974886f56e49820871a1
2022-06-25 06:25:13 +00:00
Gorka Eguileor 4d784d23a9 Fix privsep issues inside virtual env
When a virtual environment is created with the "--system-site-packages"
option and privsep is installed on the system privsep will only use the
system packages and completely ignore the ones in the virtual
environment.

This results in errors such as the ones we see:

- In the Ussuri gate: ModuleNotFoundError: No module named
  'os_brick.privileged.rootwrap'

- In the Wallaby gate: ModuleNotFoundError: No module named
  'os_brick.privileged.nvmeof'

This happens because os-brick and cinder are starting privsep using the
"privsep-helper" mechanism, and privsep was not installed in the virtual
env because it was already present system wide, so the "privsep-helper"
that is executed is the one from "/usr/local/bin/privsep-helper".

This python script "privsep-helper" ignores the virtual environment and
forces usage of the system's python, for example in a Wallaby
installation this could be "#!/usr/bin/python3.6".

Since it ignores the virtual environment it won't use its packages and
anything that's not present on system wide will not be found, and if
found it may be executing different code.

This patch fixes this issue by replacing the helper used to start
privsep with our own command.

This command is the same as the one usually installed in /usr/local/bin
but using /usr/bin/env to select the python to use.

This new script has been included as data in the cinderlib namespace
instead of making it install as a system script (like the original
privsep command) because we don't want to polute the system wide
binaries directory just for a corner case.

We also need to preserve user site-packages for the running Python when
calling root from the virtual environment, since the packages installed
on the virtual environment with "--system-site-packages" would have
taken those into consideration during the installation and not the ones
present on the root user.

To help debug issues at the gate all functional tests are now running
with debug logs.

Change-Id: I0278b42785d14f92a521e6deff872dcba6505270
Related-Bug: #1958159
Closes-Bug: #1979534
2022-06-24 15:26:48 +02:00
Gorka Eguileor cf638c41f6 Add privsep support
Cinderlib does not support Cinder drivers that make use of the privsep
library.

Originally privsep had a limitation that would serialize all requests,
so slow operations would create a bottleneck, thus cinderlib decided not
to use privsep and call the commands directly.

Since privsep no longer serializes requests we stop going around privsep
and use it.

Cinderlib is a library that works when run in a virtual environment, so
we must maintain backward compatibiliy and still support it, which is
problematic, because with Cinder's rootwrap+privsep we require
/etc/cinder/rootwrap.conf and /etc/cinder/rootwrap.d to exist, but under
a virtual env these are installed in the virtualenv's etc
directory instead.  For example: .tox/py37/etc/cinder/rootwrap.conf

This configuration file is modified to point to the right filters
directory and add the virtual env's bin directory to exec_dirs.

We also take into account if we have installed cinder as editable in our
virtual environment, because in that case files are not installed, and
we will copy them from the source's directory into the virtual
environment so we can freely modify them.

Depends-On: https://review.opendev.org/737312
Closes-Bug: #1883720
Change-Id: I7963fbfbb0a683e3efcc5949f80b96e5daaa18f1
2021-06-18 15:12:24 +02:00
Gorka Eguileor 37c085fd6c Add DevStack plugin
This patch adds a DevStack plugin to cinderlib so it can be installed
directly by DevStack and used for CI jobs as well as development.

When installing it will also get the Cinder configuration and generate a
.py file with the right initialization of the different backends that
have been configured in /etc/cinder/cinder.conf by the DevStack Cinder
job and its plugins.

Change-Id: I12f6b0e1bc047f1915e4f7532ea59495477f9b4a
2019-03-20 18:34:16 +01:00
Gorka Eguileor cd5365db2f Add zuul jobs
This patch adds the following Zuul CI jobs:

- Python 2.7 unit tests
- Python 3.6 unit tests
- Functional tests with LVM
- Functional tests with Ceph
- Publis documentation
- Release notes

Change-Id: I2f3f34c1db4716b323c48908f51500898c2c6242
2019-02-26 16:21:34 +01:00
Gorka Eguileor 77f399fd96 Format as a Cinder-related OpenStack project
Since we are going to be importing the project into OpenStack we need it
to follow the same structure as the other projects under the Cinder
umbrella.
2019-02-19 16:28:03 +01:00
Gorka Eguileor 85776225cb Update cinderlib
Sync the cinderlib repository with patches proposed to the Cinder
repository:

- https://review.openstack.org/620669
- https://review.openstack.org/620670
- https://review.openstack.org/620671
2019-01-14 16:25:18 +01:00
Gorka Eguileor e93d054ae7 Prepare for cinder gate test
We want to be able to run cinderlib functional tests on Cinder gates, so
this patch adds a playbook and a tool to convert from Cinder's config
file to the YAML required by our functional tests.

The cinder-gate-run playbook uses cinderlib_ignore_errors variable to
define whether the playbook should fail on errors or should they just be
ignored.

The playbook stores the test run results on the common logs directory so
they are automatically saved by the Cinder gate jobs.
2018-09-05 19:54:26 +02:00