Comment 4 for bug 2017575

Revision history for this message
Rajat Dhasmana (whoami-rajat) wrote : Re: wrong hostname passed to os_brick

Hi Rodrigo,

Nova passes a configured host value[1] which also defaults to socket.gethostname()[2].
You are correct that cinder doesn't pass any value for the host field[3] and os-brick uses socket.gethostname() again[4].
A similar case can be seen in the glance cinder store where we also pass socket.gethostname()[5]

One way to address this in cinder and glance_store is to add a config option for "host" field and operators can configure it in cinder.conf file. By default, the config option will use socket.gethostname() value.

[1] https://github.com/openstack/nova/blob/b9ac827491fff76eb6e4cd243d9be31304ea338d/nova/virt/libvirt/driver.py#L1799
[2] https://opendev.org/openstack/nova/src/commit/b9ac827491fff76eb6e4cd243d9be31304ea338d/nova/conf/netconf.py#L53
[3] https://github.com/openstack/cinder/blob/b75c29c7d8e0e6ac212b59f9ad8d140874e55251/cinder/volume/volume_utils.py#L1391-L1394
[4] https://github.com/openstack/os-brick/blob/b6f0f3c25ecda80861ff233ca8526d338319bd49/os_brick/initiator/connector.py#L224
[5] https://github.com/openstack/glance_store/blob/6741951591ca7d6144f6089678df8cee4f0a7030/glance_store/_drivers/cinder/store.py#L713