Add capability for using FQDN in nova compute

This patch set adds in a capability for the user to defaultly use a
FQDN for the nova compute hostname and the hypervisor hostname when
the host is not explicitly specified in the .Values.conf override.

Change-Id: I3243068dfe91ebb97b3885002296a0f454822ec5
Co-authored-by: Drew Walters <andrew.walters@att.com>
Signed-off-by: Tin Lam <tin@irrational.io>
This commit is contained in:
Tin Lam 2019-12-13 16:16:22 -06:00 committed by Tin Lam
parent 620286117b
commit bf434ffd67
7 changed files with 43 additions and 6 deletions

View File

@ -46,13 +46,22 @@ import oslo_messaging
tcp_established = "ESTABLISHED"
def _get_hostname(topic, use_fqdn):
if use_fqdn and topic == "compute":
return socket.getfqdn()
return socket.gethostname()
def check_service_status(transport):
"""Verify service status. Return success if service consumes message"""
try:
target = oslo_messaging.Target(topic=cfg.CONF.service_queue_name,
server=socket.gethostname(),
namespace='baseapi',
version="1.1")
service_queue_name = cfg.CONF.service_queue_name
use_fqdn = cfg.CONF.use_fqdn
target = oslo_messaging.Target(
topic=service_queue_name,
server=_get_hostname(service_queue_name, use_fqdn),
namespace='baseapi',
version="1.1")
client = oslo_messaging.RPCClient(transport, target,
timeout=60,
retry=2)
@ -191,6 +200,8 @@ def test_rpc_liveness():
required=False))
cfg.CONF.register_cli_opt(cfg.BoolOpt('check-all-pids', default=False,
required=False))
cfg.CONF.register_cli_opt(cfg.BoolOpt('use-fqdn', default=False,
required=False))
cfg.CONF(sys.argv[1:])

View File

@ -56,3 +56,10 @@ tee > /tmp/pod-shared/nova-hypervisor.conf << EOF
[DEFAULT]
my_ip = $hypervisor_address
EOF
{{- if and ( empty .Values.conf.nova.DEFAULT.host ) ( .Values.pod.use_fqdn.compute ) }}
tee > /tmp/pod-shared/nova-compute-fqdn.conf << EOF
[DEFAULT]
host = $(hostname --fqdn)
EOF
{{- end }}

View File

@ -22,4 +22,7 @@ exec nova-compute \
--config-file /etc/nova/nova.conf \
--config-file /tmp/pod-shared/nova-console.conf \
--config-file /tmp/pod-shared/nova-libvirt.conf \
--config-file /tmp/pod-shared/nova-hypervisor.conf
{{- if and ( empty .Values.conf.nova.DEFAULT.host ) ( .Values.pod.use_fqdn.compute ) }}
--config-file /tmp/pod-shared/nova-compute-fqdn.conf \
{{- end }}
--config-file /tmp/pod-shared/nova-hypervisor.conf

View File

@ -199,6 +199,9 @@ spec:
- /etc/nova/nova.conf
- --service-queue-name
- compute
{{- if .Values.pod.use_fqdn.compute }}
- --use-fqdn
{{- end }}
initialDelaySeconds: 80
periodSeconds: 90
timeoutSeconds: 70
@ -212,6 +215,9 @@ spec:
- --service-queue-name
- compute
- --liveness-probe
{{- if .Values.pod.use_fqdn.compute }}
- --use-fqdn
{{- end }}
initialDelaySeconds: 120
periodSeconds: 90
timeoutSeconds: 70

View File

@ -2271,6 +2271,14 @@ pod:
nova_spiceproxy:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
use_fqdn:
# NOTE: If the option "host" is not specified in nova.conf, the host name
# shown in the hypervisor host is defaulted to the short name of the host.
# Setting the option here to true will cause use $(hostname --fqdn) as the
# host name by default. If the short name is desired $(hostname --short),
# set the option to false. Specifying a host in the nova.conf via the conf:
# section will supersede the value of this option.
compute: true
affinity:
anti:
type:

View File

@ -90,3 +90,4 @@ openstack service list
sleep 30 #NOTE(portdirect): Wait for ingress controller to update rules and restart Nginx
openstack compute service list
openstack network agent list
openstack hypervisor list

View File

@ -37,7 +37,8 @@
- openstack-helm-compute-kit-queens-ubuntu_xenial
- openstack-helm-compute-kit-rocky-ubuntu_xenial
- openstack-helm-compute-kit-rocky-ubuntu_bionic
- openstack-helm-compute-kit-rocky-opensuse_15
- openstack-helm-compute-kit-rocky-opensuse_15:
voting: false
- openstack-helm-compute-kit-stein-ubuntu_bionic
- openstack-helm-horizon
- openstack-helm-apparmor: