Merge "Add capability for using FQDN in nova compute"

This commit is contained in:
Zuul 2020-01-02 19:02:45 +00:00 committed by Gerrit Code Review
commit 033ea6449b
7 changed files with 43 additions and 6 deletions

View File

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

View File

@ -56,3 +56,10 @@ tee > /tmp/pod-shared/nova-hypervisor.conf << EOF
[DEFAULT] [DEFAULT]
my_ip = $hypervisor_address my_ip = $hypervisor_address
EOF 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 /etc/nova/nova.conf \
--config-file /tmp/pod-shared/nova-console.conf \ --config-file /tmp/pod-shared/nova-console.conf \
--config-file /tmp/pod-shared/nova-libvirt.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 - /etc/nova/nova.conf
- --service-queue-name - --service-queue-name
- compute - compute
{{- if .Values.pod.use_fqdn.compute }}
- --use-fqdn
{{- end }}
initialDelaySeconds: 80 initialDelaySeconds: 80
periodSeconds: 90 periodSeconds: 90
timeoutSeconds: 70 timeoutSeconds: 70
@ -212,6 +215,9 @@ spec:
- --service-queue-name - --service-queue-name
- compute - compute
- --liveness-probe - --liveness-probe
{{- if .Values.pod.use_fqdn.compute }}
- --use-fqdn
{{- end }}
initialDelaySeconds: 120 initialDelaySeconds: 120
periodSeconds: 90 periodSeconds: 90
timeoutSeconds: 70 timeoutSeconds: 70

View File

@ -2271,6 +2271,14 @@ pod:
nova_spiceproxy: nova_spiceproxy:
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
allowPrivilegeEscalation: false 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: affinity:
anti: anti:
type: type:

View File

@ -90,3 +90,4 @@ openstack service list
sleep 30 #NOTE(portdirect): Wait for ingress controller to update rules and restart Nginx sleep 30 #NOTE(portdirect): Wait for ingress controller to update rules and restart Nginx
openstack compute service list openstack compute service list
openstack network agent 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-queens-ubuntu_xenial
- openstack-helm-compute-kit-rocky-ubuntu_xenial - openstack-helm-compute-kit-rocky-ubuntu_xenial
- openstack-helm-compute-kit-rocky-ubuntu_bionic - 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-compute-kit-stein-ubuntu_bionic
- openstack-helm-horizon - openstack-helm-horizon
- openstack-helm-apparmor: - openstack-helm-apparmor: