hostnqn file not created automatically
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
os-brick |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
os-brick does not automatically creates the hostnqn file even restart of nova_compute.
Code tries to run "nvme show-hostnqn" command and if hostnqn file does not exist it returns 'hostnqn is not available -- use nvme gen-hostnqn\n' with return code 254.
Return code 254 causes putils.
Because of raising the exception again, the create_hostnqn method does not continue to create a new hostnqn file.
Can we handle the error code 254 exception to create a new hostnqn file?
nova-compute log:
2023-09-14 11:35:47.153 534 WARNING os_brick.
Command: nvme show-hostnqn
Exit code: 254
Stdout: ''
Stderr: 'hostnqn is not available -- use nvme gen-hostnqn\n'
2023-09-14 11:35:47.159 534 WARNING os_brick.
Command: nvme show-hostnqn
Exit code: 254
Stdout: ''
Stderr: 'hostnqn is not available -- use nvme gen-hostnqn\n'
@os_brick.
def create_hostnqn() -> str:
"""Create the hostnqn file to speed up finding out the nqn.
By having the /etc/nvme/hostnqn not only do we make sure that that value is
always used on this system, but we are also able to just open the file to
get the nqn on each get_connector_
a call to nvme show-hostnqn command.
"""
host_nqn = ''
try:
# Try to get existing nqn generated from dmi or systemd
try:
# This is different from OSError's ENOENT, which is missing nvme
# command. This ENOENT is when nvme says there isn't an nqn.
except putils.
err_msg = e.stdout[
if show_hostnqn_
elif e.exit_code == errno.ENOENT:
else:
---- Here ----->raise
if not host_nqn:
-------
with open('/
except Exception as e:
return host_nqn
Versions:
os-brick==6.1.1
host: Ubuntu 20.04.6 LTS (kernel 5.4.0-153-generic)
Full logs attached
description: | updated |
description: | updated |
We are using kolla-ansible and kolla nova_compute container does not mount the "/etc/nvme/" directory from host to container. Actualy we also do not want to make some services host files dependent when using containers.
"nvme-cli" package is installed to container image by kolla and "nvme-cli" package creates the /etc/nvme paths for container image.
But the problem is, hostnqn and hostid files embedded to the nova_compute images and all containers which are spawned from this image uses the same hostnqn file which is not unique.
kolla side solution will be deleting the "/etc/nvme/hostnqn" and "/etc/kolla/hostid" files from image after docker build of the container image **but** os_brick should handle the situation of absence of these files.
I am sharing the mounts of nova_compute container:
"Mounts": [
"Type" : "bind",
"Source" : "/etc/timezone",
"Destination" : "/etc/timezone",
"Mode" : "ro",
"RW": false,
"Propagation" : "rprivate"
"Type" : "bind",
"Source" : "/etc/kolla/ nova-compute" ,
"Destination" : "/var/lib/ kolla/config_ files",
"Mode" : "ro",
"RW": false,
"Propagation" : "rprivate"
"Type" : "volume",
"Name" : "libvirtd",
"Source" : "/var/lib/ docker/ volumes/ libvirtd/ _data",
"Destination" : "/var/lib/libvirt",
"Driver" : "local",
"Mode" : "rw",
"RW": true,
"Propagation" : ""
"Type" : "volume",
"Name" : "nova_compute",
"Source" : "/var/lib/ docker/ volumes/ nova_compute/ _data",
"Destination" : "/var/lib/nova",
"Driver" : "local",
"Mode" : "rw",
"RW": true,
"Propagation" : ""
"Type" : "volume",
"Name" : "kolla_logs",
"Source" : "/var/lib/ docker/ volumes/ kolla_logs/ _data",
"Destination" : "/var/log/kolla",
"Driver" : "local",
"Mode" : "rw",
"RW": true,
"Propagation" : ""
"Type" : "bind",
"Source" : "/dev",
"Destination" : "/dev",
"Mode" : "rw",
"RW": true,
"Propagation" : "rprivate"
"Type" : "bind",
"Source" : "/etc/localtime",
"Destination" : "/etc/localtime",
"Mode" : "ro",
"RW": false,
"Propagation" : "rprivate"
"Type" : "bind",
"Source" : "/lib/modules",
"Destination" : "/lib/modules",
"Mode" : "ro",
"RW": false,
"Propagation" : "rprivate"
"Type" : "bind",
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
...