From 498b7da7e1c67b3902ecf1fba58506ea57c0f6e0 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Wed, 27 Jun 2018 20:05:20 -0500 Subject: [PATCH] Update HAP check for nova console The nova console types all have different ports and pathing that needs to be checked via the loadbalancer when running in production. This change updates our current check to use the proper pathing based on the console type being used. Without this change the logs will become full from 404 errors which is simply a loadbalancer healthcheck. To support this change, the variable `nova_consoles` was created which is a hash of consoles and provides an easy way to refernece the proper port and pathing without complex case-statements. Change-Id: If3285caea3f9974e030069eef5a5becc654e7a27 Signed-off-by: Kevin Carter --- inventory/group_vars/haproxy/haproxy.yml | 4 ++-- inventory/group_vars/nova_all.yml | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/inventory/group_vars/haproxy/haproxy.yml b/inventory/group_vars/haproxy/haproxy.yml index cc353ad319..6227d9e9cd 100644 --- a/inventory/group_vars/haproxy/haproxy.yml +++ b/inventory/group_vars/haproxy/haproxy.yml @@ -203,9 +203,9 @@ haproxy_default_services: haproxy_timeout_server: 60m haproxy_balance_alg: source haproxy_backend_options: - - "httpchk HEAD / HTTP/1.0\\r\\nUser-agent:\\ osa-haproxy-healthcheck" + - "httpchk HEAD {{ hostvars[(groups['nova_console'] | default(['localhost']))[0] | default('localhost')]['nova_console_path'] | default('/spice_auto.html') }} HTTP/1.0\\r\\nUser-agent:\\ osa-haproxy-healthcheck" haproxy_backend_httpcheck_options: - - "expect status 404" + - "expect status 200" haproxy_service_enabled: "{{ groups['nova_console'] is defined and groups['nova_console'] | length > 0 }}" - service: haproxy_service_name: cinder_api diff --git a/inventory/group_vars/nova_all.yml b/inventory/group_vars/nova_all.yml index d0082871fc..3011c82338 100644 --- a/inventory/group_vars/nova_all.yml +++ b/inventory/group_vars/nova_all.yml @@ -24,7 +24,19 @@ nova_console_type: spice nova_novncproxy_port: 6080 nova_spice_html5proxy_base_port: 6082 nova_serialconsoleproxy_port: 6083 -nova_console_port: "{% if nova_console_type == 'spice' %}{{ nova_spice_html5proxy_base_port }}{% elif nova_console_type == 'novnc' %}{{ nova_novncproxy_port }}{% else %}{{ nova_serialconsoleproxy_port }} {% endif %}" +nova_consoles: + spice: + port: "{{ nova_spice_html5proxy_base_port }}" + path: "/spice_auto.html" + novnc: + port: "{{ nova_novncproxy_port }}" + path: "/vnc_auto.html" + serial: + port: "{{ nova_serialconsoleproxy_port }}" + path: "/" + +nova_console_port: "{{ nova_consoles[nova_console_type]['port'] }}" +nova_console_path: "{{ nova_consoles[nova_console_type]['path'] }}" # These are here rather than in nova_all because # both the os_ceilometer and os_nova roles require them