os-brick/releasenotes/notes
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
..
add-luks2-support-13563cfe83aba69c.yaml encryptors: Introduce support for LUKS2 2019-09-03 18:44:41 +00:00
add-vstorage-protocol-b536f4e21d764801.yaml Add missing release notes 2016-02-14 10:32:06 -06:00
add-windows-fibre-channel-030c095c149da321.yaml Add Windows Fibre Channel connector 2016-08-04 23:12:09 +03:00
add-windows-iscsi-15d6b1392695f978.yaml release note for windows iSCSI 2016-07-05 15:23:05 -07:00
add-windows-smbfs-d86edaa003130a31.yaml Add Windows SMBFS connector 2016-08-04 23:07:01 +03:00
add_custom_keyring_for_rbd_connection-eccbaae9ee5f3491.yaml RBD: consider a custom keyring in connection info 2017-03-28 15:51:44 +00:00
bug-1722432-2408dab55c903c5b.yaml Update supported transports for iscsi connector 2018-01-16 15:01:53 +08:00
bug-1823200-scaleio-upgrade-3e83b5c9dd148714.yaml Add release note for scaleio connector upgrade 2020-08-17 11:36:44 -04:00
bug-1823200-victoria-b414a1806cba3998.yaml Remove VxFlex OS credentials from connection_properties 2020-06-03 11:27:21 +00:00
bug-1862443-e87ef38b60f9b979.yaml prepend platform info to by-path string 2020-08-03 21:12:10 +08:00
bug-1865754-ceph-octopus-compatibility-0aa9b8bc1b028301.yaml New fix for rbd connector to work with ceph octopus 2020-09-08 12:09:49 -04:00
bug-1884052-798094496dccf23c.yaml rbd: Support 'rbd showmapped' output from ceph 13.2.0+ 2020-06-19 18:38:25 +01:00
bug-1915678-901a6bd24ecede72.yaml Avoid unhandled exceptions during connecting to iSCSI portals 2021-03-04 12:01:41 +09:00
bug-1924652-2323f905f62ef8ba.yaml multipath/iscsi: remove devices from multipath monitoring 2021-04-28 22:30:34 +09:00
default-timeout-26c838af8b7af9fc.yaml Add timeout default to execute command 2020-11-10 16:36:29 +01:00
delay-legacy-encryption-provider-name-deprecation-c0d07be3f0d92afd.yaml encryptors: Delay removal of legacy provider names 2017-05-16 08:27:12 +00:00
deprecate-plain-cryptsetup-encryptor-0a279abc0b0d718c.yaml encryptors: Deprecate the CryptsetupEncryptor 2019-08-22 18:23:08 -04:00
disconnect-multipath-cfg-changed-637abc5ecf44fb10.yaml iSCSI: Fix flushing after multipath cfg change 2021-03-26 11:07:45 +01:00
drop-py2-7dcde3ccd0e167b0.yaml Remove Python 2.7 support from testing and gates 2019-12-04 16:29:40 -05:00
fc-always-check-single-wwnn-1595689da0eb673b.yaml FC: Ignore some HBAs from map for single WWNN 2019-05-09 18:55:52 +02:00
fc-flush-single-path-22ed6cc7b56a6d9b.yaml FC: Fix not flushing on detach 2020-10-01 12:29:50 +02:00
fix-fc-scan-too-broad-3c576e1846b7f05f.yaml Fix FC scan too broad 2019-11-11 15:47:59 +01:00
fix-multipath-disconnect-819d01e6e981883e.yaml Fix multipath disconnect with path failure 2018-08-13 11:02:01 +02:00
fix-nvme-issues-8dfc15cb691389fe.yaml Don't log error trace when nvme is not used 2021-05-31 11:33:20 -04:00
improve-get_sysfs_wwn-df38ea88cdcdcc94.yaml Improve WWN detection 2020-06-01 17:35:48 +02:00
improve-iscsi-multipath-detection-f36f28a993f61936.yaml iSCSI detect multipath DM with no WWN 2020-06-01 18:43:49 +02:00
introduce-encryption-provider-constants-a7cd0ce58da2bae8.yaml encryptors: Introduce encryption provider constants 2017-01-10 12:11:35 +00:00
iscsi_manual_scan_support-d64a1c3c8e1986b4.yaml Add open-iscsi manual scan support 2017-06-16 16:09:35 +02:00
local-attach-in-rbd-connector-c06347fb164b084a.yaml Local attach feature in RBD connector 2016-07-26 18:37:14 +00:00
multipath-improvements-596c2c6eadfba6ea.yaml Add missing release notes 2016-02-14 10:32:06 -06:00
nvme-flush-f31ab337224e5d3d.yaml NVMe-oF: Flush on disconnect 2021-05-19 12:00:17 +02:00
nvme-hostnqn-c2611dc56729183b.yaml NVMe-oF: Return right nqn when missing hostnqn 2021-06-07 16:04:28 +02:00
nvme-rsd-support-d487afd77c534fa1.yaml Support RSD scenario of nvme connector 2018-12-24 13:51:20 +08:00
rbd-non-openstack-support-28ee093d7d3a700e.yaml RBD: Support non OpenStack usage 2020-07-30 14:07:49 +02:00
rbd-windows-support-ef6e8184842409dd.yaml rbd Windows support 2020-12-09 20:50:24 +02:00
rbd_check_valid_device-2f50c0639adb8e7c.yaml RBD: Fix check_valid_device 2020-07-30 14:07:49 +02:00
rbd_extend_volume-5bc6adc08f662c5b.yaml RBD: Implement volume extension 2020-07-31 11:16:29 +02:00
refactor_iscsi_connect-dfbb24305a954783.yaml Refactor iSCSI connect 2017-06-16 16:09:35 +02:00
refactor_iscsi_disconnect-557f4173bc1ae4ed.yaml Refactor iSCSI disconnect 2017-05-31 15:31:20 +02:00
remove-aoe-7a97315a73c7b24f.yaml Remove CORAID AOE connector 2020-08-25 16:41:54 -04:00
remove-disco-0809537ffb8c50eb.yaml Remove the ITRI DISCO connector 2020-08-07 14:19:14 -05:00
remove-drbd-21872230fcac1138.yaml Remove DRBD connector 2020-08-07 14:33:30 -05:00
remove-hgst-daa7f07c307974d0.yaml Remove the HGST connector 2020-08-07 14:25:41 -05:00
remove-hyperscale-468f1b61bf4dadf8.yaml Remove Veritas Hyperscale connector 2020-08-07 14:31:55 -05:00
remove-old-constants-20021f5b30bde890.yaml Fix a typographical error in a release notes entry. 2017-11-27 14:36:49 +02:00
remove-sheepdog-611257b28bc88934.yaml Remove Sheepdog connector 2019-12-19 07:44:16 -06:00
scaleio-extend-attached-ec44d3a72395882c.yaml Adding support to extend attached ScaleIO volumes 2018-03-19 09:05:30 -04:00
start-using-reno-23e8d5f1a30851a1.yaml Add reno for release notes management 2016-01-20 19:19:36 -06:00
update-nvmeof-connector-6260a658c15a9a6e.yaml NVMeOF connector driver connection information compatibility fix 2021-03-05 14:25:18 +00:00
ussuri-release-979d709dfa7df068.yaml Add release note for ussuri cycle release 2020-04-01 12:44:02 -04:00
veritas-hyperscale-connector-fe56cec68b1947cd.yaml os-brick connector for Veritas HyperScale 2017-04-11 17:45:34 +05:30
vmware-vmdk-connector-19e6999e6cae43cd.yaml Add connector for vmdk volumes 2016-08-09 17:23:30 +05:30