The NVMe-oF connector currently create the `/etc/nvme/hostnqn` file if
it doesn't exist, but it may still be missing the `/etc/nvme/hostid`
value.
Some distribution packages create the file on installation but others
may not.
It is recommended for the file to be present so that nvme doesn't
randomly generate it.
Randomly generating it means that the value will be different for the
same storage array and the same volume if we connect, disconnect, and
connect the volume again.
This patch ensures that the file will exist and will try to use the
system's UUID as reported by DMI or a randomly generated one.
BACKPORT NOTE: This patch also includes another patch fixing unittests Otherwise tests would fail
Fix unit tests when hostid file exists
After merging change I0b60f9078f23f8464d8234841645ed520e8ba655, we
noticed an issue with existing unit tests which started failing.
The reason is 'nvme_hostid' was an additional parameter returned
in the response while fetching connector properties from nvme
connector.
This is environment specific and won't occur in environments where
'/etc/nvme/hostid' file doesn't exist due to which these tests
passed in gate but failed in the local run when hostid file
was present.
This patch mocks the get_nvme_host_id method for tests so the
hostid is never returned irrespective of the environment.
Closes-Bug: #2032941
Change-Id: I8b1aaedfdb9bef6e34813e39dede9afe98371d2b
(cherry picked from commit 71627c56ac14bd3d31e78979d430eccee9a92d91)
Closes-Bug: #2016029
Change-Id: I0b60f9078f23f8464d8234841645ed520e8ba655
(cherry picked from commit 16c90d5fe97da04c7c42cbd3fe5505153ce95a91)
Reviewed: https:/ /review. opendev. org/c/openstack /os-brick/ +/905988 /opendev. org/openstack/ os-brick/ commit/ 5ab069ab2eebbf9 42ecf2577399d1d a924bac782
Committed: https:/
Submitter: "Zuul (22348)"
Branch: stable/2023.1
commit 5ab069ab2eebbf9 42ecf2577399d1d a924bac782
Author: whoami-rajat <email address hidden>
Date: Thu Aug 24 12:02:43 2023 +0000
NVMe-oF: Create /etc/nvme/hostid
The NVMe-oF connector currently create the `/etc/nvme/hostnqn` file if
it doesn't exist, but it may still be missing the `/etc/nvme/hostid`
value.
Some distribution packages create the file on installation but others
may not.
It is recommended for the file to be present so that nvme doesn't
randomly generate it.
Randomly generating it means that the value will be different for the
same storage array and the same volume if we connect, disconnect, and
connect the volume again.
This patch ensures that the file will exist and will try to use the
system's UUID as reported by DMI or a randomly generated one.
BACKPORT NOTE: This patch also includes another patch fixing unittests
Otherwise tests would fail
Fix unit tests when hostid file exists
After merging change I0b60f9078f23f8 464d8234841645e d520e8ba655, we /etc/nvme/ hostid' file doesn't exist due to which these tests
noticed an issue with existing unit tests which started failing.
The reason is 'nvme_hostid' was an additional parameter returned
in the response while fetching connector properties from nvme
connector.
This is environment specific and won't occur in environments where
'
passed in gate but failed in the local run when hostid file
was present.
This patch mocks the get_nvme_host_id method for tests so the
hostid is never returned irrespective of the environment.
Closes-Bug: #2032941 6e34813e39dede9 afe98371d2b d31e78979d430ec cee9a92d91)
Change-Id: I8b1aaedfdb9bef
(cherry picked from commit 71627c56ac14bd3
Closes-Bug: #2016029 464d8234841645e d520e8ba655 c7c42cbd3fe5505 153ce95a91)
Change-Id: I0b60f9078f23f8
(cherry picked from commit 16c90d5fe97da04