masakari: support host monitor

Change-Id: I3f43df7766c57622ab8d01a759fbeeef0a0c2b93
Implements: blueprint masakari-hostmonitor
Co-Authored-By: Radosław Piliszek <radoslaw.piliszek@gmail.com>
This commit is contained in:
Mark Goddard 2020-07-29 10:30:52 +00:00 committed by Radosław Piliszek
parent 9f578c85e0
commit db517a44e4
14 changed files with 105 additions and 12 deletions

View File

@ -1228,3 +1228,10 @@ octavia_public_endpoint: "{{ public_protocol }}://{{ octavia_external_fqdn | put
# file: "/full/qualified/path/to/mapping/json/file/to/mappingId3"
keystone_identity_providers: []
keystone_identity_mappings: []
####################
# Corosync options
####################
# this is UDP port
hacluster_corosync_port: 5405

View File

@ -735,7 +735,10 @@ control
[masakari-engine:children]
control
[masakari-monitors:children]
[masakari-hostmonitor:children]
control
[masakari-instancemonitor:children]
compute
[ovn-controller:children]

View File

@ -753,7 +753,10 @@ control
[masakari-engine:children]
control
[masakari-monitors:children]
[masakari-hostmonitor:children]
control
[masakari-instancemonitor:children]
compute
[ovn-controller:children]

View File

@ -85,13 +85,6 @@ hacluster_pacemaker_extra_volumes: "{{ hacluster_extra_volumes }}"
hacluster_pacemaker_remote_extra_volumes: "{{ hacluster_extra_volumes }}"
####################
# Corosync options
####################
# this is UDP port
hacluster_corosync_port: 5405
####################
# Pacemaker options
####################

View File

@ -29,12 +29,20 @@ masakari_services:
dimensions: "{{ masakari_engine_dimensions }}"
masakari-instancemonitor:
container_name: masakari_instancemonitor
group: masakari-monitors
group: masakari-instancemonitor
enabled: true
image: "{{ masakari_monitors_image_full }}"
volumes: "{{ masakari_instancemonitor_default_volumes + masakari_instancemonitor_extra_volumes }}"
privileged: True
dimensions: "{{ masakari_instancemonitor_dimensions }}"
masakari-hostmonitor:
container_name: masakari_hostmonitor
group: masakari-hostmonitor
enabled: true
ipc_mode: host
image: "{{ masakari_monitors_image_full }}"
volumes: "{{ masakari_hostmonitor_default_volumes + masakari_hostmonitor_extra_volumes }}"
dimensions: "{{ masakari_hostmonitor_dimensions }}"
####################
@ -67,11 +75,13 @@ masakari_engine_dimensions: "{{ default_container_dimensions }}"
# NOTE(mgoddard): Allow masakari_monitors_dimensions for backwards
# compatibility.
masakari_instancemonitor_dimensions: "{{ masakari_monitors_dimensions | default(default_container_dimensions) }}"
masakari_hostmonitor_dimensions: "{{ default_container_dimensions }}"
masakari_extra_volumes: "{{ default_extra_volumes }}"
masakari_api_extra_volumes: "{{ masakari_extra_volumes }}"
masakari_engine_extra_volumes: "{{ masakari_extra_volumes }}"
masakari_instancemonitor_extra_volumes: "{{ masakari_extra_volumes }}"
masakari_hostmonitor_extra_volumes: "{{ masakari_extra_volumes }}"
masakari_api_default_volumes:
- "{{ node_config_directory }}/masakari-api/:{{ container_config_directory }}/:ro"
@ -92,6 +102,12 @@ masakari_instancemonitor_default_volumes:
- "{{ '/etc/timezone:/etc/timezone:ro' if ansible_os_family == 'Debian' else '' }}"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/masakari-monitors/masakarimonitors:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/masakarimonitors' if masakari_dev_mode | bool else '' }}"
masakari_hostmonitor_default_volumes:
- "{{ node_config_directory }}/masakari-hostmonitor/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "{{ '/etc/timezone:/etc/timezone:ro' if kolla_base_distro in ['debian', 'ubuntu'] else '' }}"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/masakari-monitors/masakarimonitors:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/masakarimonitors' if masakari_dev_mode | bool else '' }}"
####################

View File

@ -46,3 +46,19 @@
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"
- name: Restart masakari-hostmonitor container
vars:
service_name: "masakari-hostmonitor"
service: "{{ masakari_services[service_name] }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
ipc_mode: "{{ service.ipc_mode }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"

View File

@ -6,6 +6,7 @@
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
ipc_mode: "{{ item.value.ipc_mode | default(omit) }}"
privileged: "{{ item.value.privileged | default(False) }}"
volumes: "{{ item.value.volumes | reject('equalto', '') | list }}"
dimensions: "{{ item.value.dimensions }}"

View File

@ -104,6 +104,7 @@
- service.enabled | bool
with_items:
- masakari-instancemonitor
- masakari-hostmonitor
notify:
- Restart {{ service_name }} container

View File

@ -0,0 +1,18 @@
{
"command": "masakari-hostmonitor --config-file /etc/masakari-monitors/masakari-monitors.conf",
"config_files": [
{
"source": "{{ container_config_directory }}/masakari-monitors.conf",
"dest": "/etc/masakari-monitors/masakari-monitors.conf",
"owner": "masakari",
"perm": "0600"
}
],
"permissions": [
{
"path": "/var/log/kolla/masakari",
"owner": "masakari:masakari",
"recurse": true
}
]
}

View File

@ -13,5 +13,25 @@ password = {{ masakari_keystone_password }}
cafile = {{ openstack_cacert }}
api_interface = internal
{% if service_name == 'masakari-instancemonitor' %}
[libvirt]
connection_uri = "qemu+tcp://{{ migration_interface_address | put_address_in_context('url') }}/system"
{% endif %}
{% if service_name == 'masakari-hostmonitor' %}
[host]
{#
NOTE(yoctozepto): ``restrict_to_remotes`` is due to being unable to monitor
both types at once and Kolla has remotes on dedicated computes so it is
a better default choice.
This limitation may be lifted in the near future (Xena+).
#}
restrict_to_remotes = True
{% if inventory_hostname in groups['hacluster'] %}
pacemaker_node_type = cluster
corosync_multicast_interfaces = {{ api_interface }}
corosync_multicast_ports = {{ hacluster_corosync_port }}
{% elif inventory_hostname in groups['hacluster-remote'] %}
pacemaker_node_type = remote
{% endif %}
{% endif %}

View File

@ -1158,7 +1158,8 @@
hosts:
- masakari-api
- masakari-engine
- masakari-monitors
- masakari-hostmonitor
- masakari-instancemonitor
- '&enable_masakari_True'
serial: '{{ kolla_serial|default("0") }}'
roles:

View File

@ -803,3 +803,10 @@
#octavia_amp_boot_network_list:
#octavia_amp_secgroup_list:
#octavia_amp_flavor_id:
####################
# Corosync options
####################
# this is UDP port
#hacluster_corosync_port: 5405

View File

@ -0,0 +1,4 @@
---
features:
- |
Adds support for Masakari host monitor.

View File

@ -802,7 +802,10 @@ control
[masakari-engine:children]
control
[masakari-monitors:children]
[masakari-hostmonitor:children]
control
[masakari-instancemonitor:children]
compute
[ovn-controller:children]