Update legacy neutron L3HA tool support

This tool is still useful in some environments. In this
patch we ensure that if it is enabled, the openrc file
will be deployed on the host. We also remove the TODO
for it's removal.

Change-Id: I427765d0ff219b38bc3c86384e3807321db59dec
This commit is contained in:
Jesse Pretorius 2018-11-07 12:16:18 +00:00
parent f730c52ff0
commit bd728b82b7
2 changed files with 35 additions and 37 deletions

View File

@ -385,7 +385,10 @@ neutron_local_ip: 127.0.0.1
### ###
# Set this option to "true" to enable legacy neutron L3HA tool support # Set this option to "true" to enable legacy neutron L3HA tool support
# TODO(cloudnull): Remove this in the Ocata cycle # This tool is useful to ensure any non-HA neutron entities
# are re-scheduled if the agent managing them goes down.
# It is also useful if the built-in HA capabilities cannot
# be used in the environment for whatever reason.
neutron_legacy_ha_tool_enabled: false neutron_legacy_ha_tool_enabled: false
# L3HA configuration options # L3HA configuration options

View File

@ -13,45 +13,40 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# This should be revised in Kilo - name: Implement the legacy neutron L3HA tool scripts
# kilo_revision: true
- name: "Drop AT&T neutron ha tool"
template:
src: "neutron-ha-tool.py.j2"
dest: "/opt/neutron-ha-tool.py"
owner: "root"
group: "root"
mode: "0755"
tags:
- neutron-install
when: when:
- neutron_legacy_ha_tool_enabled | bool - neutron_legacy_ha_tool_enabled | bool
block:
- name: Implement the neutron HA tool script
template:
src: "neutron-ha-tool.py.j2"
dest: "/opt/neutron-ha-tool.py"
owner: "root"
group: "root"
mode: "0755"
- name: Convert the hostname to an int - name: Convert the hostname to an int
name2int: name2int:
name: "{{ inventory_hostname }}" name: "{{ inventory_hostname }}"
register: hashed_name register: hashed_name
when:
- neutron_legacy_ha_tool_enabled | bool
# These are used in the Neutron HA Cron job script, and processed in the template. # These are used in the Neutron HA Cron job script, and processed in the template.
- name: Creating Job Facts - name: Creating Job Facts
set_fact: set_fact:
do_job: ". /root/openrc && /opt/neutron-ha-tool.py {% if keystone_service_internaluri_insecure | bool %}--insecure {% endif %}--l3-agent-migrate" do_job: ". /root/openrc && /opt/neutron-ha-tool.py {% if keystone_service_internaluri_insecure | bool %}--insecure {% endif %}--l3-agent-migrate"
sleep_time: "{{ hashed_name.int_value }}" sleep_time: "{{ hashed_name.int_value }}"
when:
- neutron_legacy_ha_tool_enabled | bool
- name: "Drop Neutron HA job script" - name: Implement openrc/clouds.yaml
template: include_role:
src: "neutron_ha_tool.sh.j2" name: "openstack_openrc"
dest: "/opt/neutron-ha-tool.sh"
owner: "root" - name: Implement the Neutron HA job script
group: "root" template:
mode: "0755" src: "neutron_ha_tool.sh.j2"
when: dest: "/opt/neutron-ha-tool.sh"
- neutron_legacy_ha_tool_enabled | bool owner: "root"
group: "root"
mode: "0755"
- name: Create Neutron HA - name: Create Neutron HA
cron: cron:
@ -65,7 +60,7 @@
user: root user: root
cron_file: "neutron-ha-tool" cron_file: "neutron-ha-tool"
- name: "Remove AT&T neutron ha tool when disabled" - name: Remove AT&T neutron ha tool when disabled
file: file:
path: "{{ item }}" path: "{{ item }}"
state: "absent" state: "absent"
@ -73,4 +68,4 @@
- "/opt/neutron-ha-tool.py" - "/opt/neutron-ha-tool.py"
- "/opt/neutron-ha-tool.sh" - "/opt/neutron-ha-tool.sh"
when: when:
- not neutron_legacy_ha_tool_enabled | bool - not neutron_legacy_ha_tool_enabled | bool