37d57c4306
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]: |
||
---|---|---|
doc | ||
etc/os-brick/rootwrap.d | ||
os_brick | ||
releasenotes | ||
tools | ||
.coveragerc | ||
.gitignore | ||
.gitreview | ||
.mailmap | ||
.stestr.conf | ||
.zuul.yaml | ||
CONTRIBUTING.rst | ||
HACKING.rst | ||
LICENSE | ||
README.rst | ||
bindep.txt | ||
lower-constraints.txt | ||
mypy-files.txt | ||
pylintrc | ||
requirements.txt | ||
setup.cfg | ||
setup.py | ||
test-requirements.txt | ||
tox.ini |
README.rst
Team and repository tags
brick
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:
- OR refer to the parent project, Cinder:
- Release notes for the project can be found at:
- License: Apache License, Version 2.0
- Source: https://opendev.org/openstack/os-brick
- Bugs: https://bugs.launchpad.net/os-brick