From ad9dc7611279b4a8751d69c0187d3fcb764fdad8 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Fri, 18 May 2018 10:26:39 +0200 Subject: [PATCH] nova: make libvirt port configurable and check if the port is free Change-Id: I7dbb5a33ef78dc4ecd338ffbd59a29c0fe3be9c5 --- ansible/roles/nova/defaults/main.yml | 1 + ansible/roles/nova/tasks/precheck.yml | 14 ++++++++++++++ ansible/roles/nova/templates/libvirtd.conf.j2 | 1 + 3 files changed, 16 insertions(+) diff --git a/ansible/roles/nova/defaults/main.yml b/ansible/roles/nova/defaults/main.yml index 3bbe452ab2..2f22ce8326 100644 --- a/ansible/roles/nova/defaults/main.yml +++ b/ansible/roles/nova/defaults/main.yml @@ -242,6 +242,7 @@ openstack_nova_auth: "{{ openstack_auth }}" openstack_placement_auth: "{{ openstack_auth }}" +nova_libvirt_port: "16509" nova_ssh_port: "8022" #################### diff --git a/ansible/roles/nova/tasks/precheck.yml b/ansible/roles/nova/tasks/precheck.yml index 3b4f623361..8f0193d2fb 100644 --- a/ansible/roles/nova/tasks/precheck.yml +++ b/ansible/roles/nova/tasks/precheck.yml @@ -105,6 +105,20 @@ - nova_ssh.enabled | bool - inventory_hostname in groups[nova_ssh.group] +- name: Checking free port for Nova Libvirt + vars: + nova_libvirt: "{{ nova_services['nova-libvirt'] }}" + wait_for: + host: "{{ api_interface_address }}" + port: "{{ nova_libvirt_port }}" + connect_timeout: 1 + timeout: 1 + state: stopped + when: + - container_facts['nova_libvirt'] is not defined + - nova_libvirt.enabled | bool + - inventory_hostname in groups[nova_libvirt.group] + - name: Checking free port for Nova Placement API vars: placement_api: "{{ nova_services['placement-api'] }}" diff --git a/ansible/roles/nova/templates/libvirtd.conf.j2 b/ansible/roles/nova/templates/libvirtd.conf.j2 index a89b97fafb..237a2074ce 100644 --- a/ansible/roles/nova/templates/libvirtd.conf.j2 +++ b/ansible/roles/nova/templates/libvirtd.conf.j2 @@ -5,3 +5,4 @@ ca_file = "" log_level = 3 log_outputs = "3:file:/var/log/kolla/libvirt/libvirtd.log" listen_addr = "{{ api_interface_address }}" +tcp_port = "{{ nova_libvirt_port }}"