openstack-k8s-operators/nova-operator

nova_metadata_host is exposed in wrong format

Closed this issue · 2 comments

#515 exposes nova_metadata_host as below:-

$ cat 05-nova-metadata.conf
[DEFAULT]
nova_metadata_host = http://nova-metadata-internal.openstack.svc:8775
metadata_proxy_shared_secret = 1234567842

And with this neutron-ovn-metadata-agent fails to start with error:-
2023-09-18 08:00:04.449 2 CRITICAL neutron [-] Unhandled error: oslo_config.cfg.ConfigFileValueError: Value for option nova_metadata_host from LocationInfo(location=<Locations.user: (4, True)>, detail='/etc/neutron.conf.d/05-nova-metadata.conf') is not valid: http://nova-metadata-internal.openstack.svc:8775 is not a valid host address
2023-09-18 08:00:04.449 2 ERROR neutron Traceback (most recent call last):
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/types.py", line 843, in call
2023-09-18 08:00:04.449 2 ERROR neutron value = self.ip_address(value)
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/types.py", line 728, in call
2023-09-18 08:00:04.449 2 ERROR neutron self.version_checker(value)
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/types.py", line 748, in _check_both_versions
2023-09-18 08:00:04.449 2 ERROR neutron raise ValueError("%s is not IPv4 or IPv6 address" % address)
2023-09-18 08:00:04.449 2 ERROR neutron ValueError: http://nova-metadata-internal.openstack.svc:8775 is not IPv4 or IPv6 address
2023-09-18 08:00:04.449 2 ERROR neutron
2023-09-18 08:00:04.449 2 ERROR neutron During handling of the above exception, another exception occurred:
2023-09-18 08:00:04.449 2 ERROR neutron
2023-09-18 08:00:04.449 2 ERROR neutron Traceback (most recent call last):
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/types.py", line 846, in call
2023-09-18 08:00:04.449 2 ERROR neutron value = self.hostname(value)
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/types.py", line 799, in call
2023-09-18 08:00:04.449 2 ERROR neutron raise ValueError("%s is an invalid hostname" % value)
2023-09-18 08:00:04.449 2 ERROR neutron ValueError: http://nova-metadata-internal.openstack.svc:8775 is an invalid hostname
2023-09-18 08:00:04.449 2 ERROR neutron
2023-09-18 08:00:04.449 2 ERROR neutron During handling of the above exception, another exception occurred:
2023-09-18 08:00:04.449 2 ERROR neutron
2023-09-18 08:00:04.449 2 ERROR neutron Traceback (most recent call last):
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/cfg.py", line 2716, in _do_get
2023-09-18 08:00:04.449 2 ERROR neutron return (convert(val), alt_loc)
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/cfg.py", line 2685, in convert
2023-09-18 08:00:04.449 2 ERROR neutron return self._convert_value(
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/cfg.py", line 2813, in _convert_value
2023-09-18 08:00:04.449 2 ERROR neutron return opt.type(value)
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/types.py", line 848, in call
2023-09-18 08:00:04.449 2 ERROR neutron raise ValueError(
2023-09-18 08:00:04.449 2 ERROR neutron ValueError: http://nova-metadata-internal.openstack.svc:8775 is not a valid host address
2023-09-18 08:00:04.449 2 ERROR neutron
2023-09-18 08:00:04.449 2 ERROR neutron During handling of the above exception, another exception occurred:
2023-09-18 08:00:04.449 2 ERROR neutron
2023-09-18 08:00:04.449 2 ERROR neutron Traceback (most recent call last):
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/bin/neutron-ovn-metadata-agent", line 10, in
2023-09-18 08:00:04.449 2 ERROR neutron sys.exit(main())
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/neutron/cmd/eventlet/agents/ovn_metadata.py", line 24, in main
2023-09-18 08:00:04.449 2 ERROR neutron metadata_agent.main()
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/neutron/agent/ovn/metadata_agent.py", line 39, in main
2023-09-18 08:00:04.449 2 ERROR neutron utils.log_opt_values(LOG)
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/neutron/common/utils.py", line 145, in log_opt_values
2023-09-18 08:00:04.449 2 ERROR neutron cfg.CONF.log_opt_values(log, logging.DEBUG)
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/cfg.py", line 2603, in log_opt_values
2023-09-18 08:00:04.449 2 ERROR neutron _sanitize(opt, getattr(self, opt_name)))
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/cfg.py", line 2219, in getattr
2023-09-18 08:00:04.449 2 ERROR neutron return self._get(name)
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/cfg.py", line 2653, in _get
2023-09-18 08:00:04.449 2 ERROR neutron value, loc = self._do_get(name, group, namespace)
2023-09-18 08:00:04.449 2 ERROR neutron File "/usr/lib/python3.9/site-packages/oslo_config/cfg.py", line 2732, in _do_get
2023-09-18 08:00:04.449 2 ERROR neutron raise ConfigFileValueError(message)
2023-09-18 08:00:04.449 2 ERROR neutron oslo_config.cfg.ConfigFileValueError: Value for option nova_metadata_host from LocationInfo(location=<Locations.user: (4, True)>, detail='/etc/neutron.conf.d/05-nova-metadata.conf') is not valid: http://nova-metadata-internal.openstack.svc:8775 is not a valid host address

It should be fixed to be in below format:-
$ cat 05-nova-metadata.conf
[DEFAULT]
nova_metadata_host = nova-metadata-internal.openstack.svc
nova_metadata_port = 8775
nova_metadata_protocol = http
metadata_proxy_shared_secret = 1234567842

I'm on it.

Fix proposed