Volume discovery and local storage management lib
Go to file
Gorka Eguileor 37d57c4306 NVMe-oF: Return right nqn when missing hostnqn
This patch fixes a problem where we don't return the right nqn value
when the /etc/nvme/hostnqn file doesn't exist.

Currently get_connector_properties returns a new nqn value every time it
gets called if the hostnqn file is not present in the system.

The reason for this is that we are calling "nvme gen-hostnqn" and piping
it to tee, but for some reason tee is failing to write the file, so on
each call we'll generate a new nqn.

Even if we were successfully creating the hostnqn file, that could
create problems if we have already attached some volumes, since those
would have used the existing nqn.

This patch replaces the series of command executions (mkdir, nvme,
chmod) with a privsep method that then leverages the equivalent python
methods when possible and also tries to use the show-hostnqn nvme
subcommand first to get the existing nqn before defaulting to generating
a new one with gen-hostnqn.  This way we don't replace the current nqn
value that may be already being used by other nvme connections.

Subcommand show-hostnqn returns the host NQN configured for the system.
First looks for /etc/nvme/hostnqn, if it's not present (our case when we
call the new create_hostnqn method) tries to construct it from dmi
(/sys/firmware/dmi/entries) or from systemd's application-specific
machine IDs for the system [1].

It's important to differentiate between the ENOENT returned as OSError
and the same value returned by nvme [2] when show-hostnqn cannot return
anything.

[1]: ed9538622a/fabrics.c (L858-L875)
[2]: 5b8b065b1d/nvme.c (L5642-L5643)

Closes-Bug: #1928944
Change-Id: I252dd958767dcdd4f9a2767b362aaf675edb79c4
2021-06-07 16:04:28 +02:00
doc Merge "Dropping explicit unicode literal" 2021-03-12 23:36:22 +00:00
etc/os-brick/rootwrap.d Trivial rootwrap -> privsep replacement 2016-04-15 15:29:25 +00:00
os_brick NVMe-oF: Return right nqn when missing hostnqn 2021-06-07 16:04:28 +02:00
releasenotes NVMe-oF: Return right nqn when missing hostnqn 2021-06-07 16:04:28 +02:00
tools Introduce mypy 2021-05-21 16:58:22 -04:00
.coveragerc Fix coverage generation 2016-04-20 15:52:31 +00:00
.gitignore Add LIO barbican tests to .zuul.yaml 2018-10-01 10:19:36 -05:00
.gitreview OpenDev Migration Patch 2019-04-19 19:34:25 +00:00
.mailmap Created the Brick library from Cinder 2015-01-22 19:09:30 +00:00
.stestr.conf Add .stestr.conf configuration 2017-10-02 17:35:26 -05:00
.zuul.yaml Add Python3 xena unit tests 2021-03-08 09:18:13 +00:00
CONTRIBUTING.rst Ussuri contrib docs community goal 2020-03-05 09:11:33 -05:00
HACKING.rst Update hacking version 2019-01-18 21:30:00 -05:00
LICENSE Created the Brick library from Cinder 2015-01-22 19:09:30 +00:00
README.rst Replace git.openstack.org URLs with opendev.org URLs 2019-04-23 20:55:14 +08:00
bindep.txt bindep: remind people to sync the dependencies with devstack 2020-08-14 00:50:08 +02:00
lower-constraints.txt Introduce mypy 2021-05-21 16:58:22 -04:00
mypy-files.txt Introduce mypy 2021-05-21 16:58:22 -04:00
pylintrc Add pylint tox env 2016-04-04 18:02:19 -04:00
requirements.txt Update requirements for wallaby release 2021-03-04 21:03:58 -05:00
setup.cfg Introduce mypy 2021-05-21 16:58:22 -04:00
setup.py Cleanup py27 support 2020-04-05 17:43:12 +02:00
test-requirements.txt Introduce mypy 2021-05-21 16:58:22 -04:00
tox.ini Introduce mypy 2021-05-21 16:58:22 -04:00

README.rst

Team and repository tags

image

brick

Latest Version

Downloads

OpenStack Cinder brick library for managing local volume attaches

Features

  • Discovery of volumes being attached to a host for many transport protocols.
  • Removal of volumes from a host.

Hacking

Hacking on brick requires python-gdbm (for Debian derived distributions), Python 2.7 and Python 3.4. A recent tox is required, as is a recent virtualenv (13.1.0 or newer).

If "tox -e py34" fails with the error "db type could not be determined", remove the .testrepository/ directory and then run "tox -e py34".

For any other information, refer to the developer documents:

https://docs.openstack.org/os-brick/latest/

OR refer to the parent project, Cinder:

https://docs.openstack.org/cinder/latest/

Release notes for the project can be found at:

https://docs.openstack.org/releasenotes/os-brick