From 188435ca180f3c8e11891f4f765a64510a23b194 Mon Sep 17 00:00:00 2001 From: Jose Luis Franco Arza Date: Tue, 29 Aug 2017 17:29:28 +0200 Subject: [PATCH] Add validation task in docker services [Nova] Docker services are missing the pre-upgrade validation task in the upgrade_tasks section which verifies if the service is running before going on with the upgrade. Change-Id: I5327bd319012d99a6b805631bd96ca9f335d1b22 Partial-Bug: #1704389 --- docker/services/nova-api.yaml | 28 +++++++++++++++++++++++++++ docker/services/nova-compute.yaml | 10 ++++++++++ docker/services/nova-conductor.yaml | 10 ++++++++++ docker/services/nova-consoleauth.yaml | 10 ++++++++++ docker/services/nova-ironic.yaml | 10 ++++++++++ docker/services/nova-libvirt.yaml | 10 ++++++++++ docker/services/nova-metadata.yaml | 10 ++++++++++ docker/services/nova-placement.yaml | 15 ++++++++++++++ docker/services/nova-scheduler.yaml | 10 ++++++++++ docker/services/nova-vnc-proxy.yaml | 10 ++++++++++ 10 files changed, 123 insertions(+) diff --git a/docker/services/nova-api.yaml b/docker/services/nova-api.yaml index b68474bef5..4348ec0919 100644 --- a/docker/services/nova-api.yaml +++ b/docker/services/nova-api.yaml @@ -223,9 +223,37 @@ outputs: get_attr: [NovaApiBase, role_data, metadata_settings] host_prep_tasks: {get_attr: [NovaApiLogging, host_prep_tasks]} upgrade_tasks: + - name: Check if nova_api is deployed + command: systemctl is-enabled --quiet openstack-nova-api + tags: common + ignore_errors: True + register: nova_api_enabled + - name: Check for nova-api running under apache + tags: common + shell: httpd -t -D DUMP_VHOSTS | grep -q 'nova' + ignore_errors: True + register: httpd_enabled + - name: "PreUpgrade step0,validation: Check service openstack-nova-api is running" + command: systemctl is-active --quiet openstack-nova-api + tags: step0,validation + when: nova_api_enabled.rc == 0 and httpd_enabled.rc != 0 - name: Stop and disable nova_api service tags: step2 + when: nova_api_enabled.rc == 0 and httpd_enabled.rc != 0 service: name=openstack-nova-api state=stopped enabled=no + - name: Check if httpd service is running + command: systemctl is-active --quiet httpd + tags: common + ignore_errors: True + register: httpd_running + - name: "PreUpgrade step0,validation: Check if nova_wsgi is running" + tags: step0,validation + shell: systemctl status 'httpd' | grep -q 'nova' + when: httpd_enabled.rc == 0 and httpd_running.rc == 0 + - name: Stop nova_api service (running under httpd) + tags: step2 + when: httpd_enabled.rc == 0 and httpd_running.rc == 0 + service: name=httpd state=stopped - name: Remove openstack-nova-api package if operator requests it yum: name=openstack-nova-api state=removed tags: step2 diff --git a/docker/services/nova-compute.yaml b/docker/services/nova-compute.yaml index 883f438b8c..b2abd342b0 100644 --- a/docker/services/nova-compute.yaml +++ b/docker/services/nova-compute.yaml @@ -151,6 +151,11 @@ outputs: path: /etc/ceph state: directory upgrade_tasks: + - name: Check if nova_compute is deployed + command: systemctl is-enabled --quiet openstack-nova-compute + tags: common + ignore_errors: True + register: nova_compute_enabled - name: Set compute upgrade level to auto tags: step1 ini_file: @@ -158,8 +163,13 @@ outputs: template: "dest=/etc/nova/nova.conf section=upgrade_levels option=compute value=LEVEL" params: LEVEL: {get_param: UpgradeLevelNovaCompute} + - name: "PreUpgrade step0,validation: Check service openstack-nova-compute is running" + command: systemctl is-active --quiet openstack-nova-compute + tags: step0,validation + when: nova_compute_enabled.rc == 0 - name: Stop and disable nova-compute service tags: step2 + when: nova_compute_enabled.rc == 0 service: name=openstack-nova-compute state=stopped enabled=no - name: Remove openstack-nova-compute package if operator requests it yum: name=openstack-nova-compute state=removed diff --git a/docker/services/nova-conductor.yaml b/docker/services/nova-conductor.yaml index 3d2b0600e8..099bd03f48 100644 --- a/docker/services/nova-conductor.yaml +++ b/docker/services/nova-conductor.yaml @@ -127,6 +127,11 @@ outputs: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS host_prep_tasks: {get_attr: [NovaLogging, host_prep_tasks]} upgrade_tasks: + - name: Check if nova_conductor is deployed + command: systemctl is-enabled --quiet openstack-nova-conductor + tags: common + ignore_errors: True + register: nova_conductor_enabled - name: Set compute upgrade level to auto tags: step1 ini_file: @@ -134,8 +139,13 @@ outputs: template: "dest=/etc/nova/nova.conf section=upgrade_levels option=compute value=LEVEL" params: LEVEL: {get_param: UpgradeLevelNovaCompute} + - name: "PreUpgrade step0,validation: Check service openstack-nova-conductor is running" + command: systemctl is-active --quiet openstack-nova-conductor + tags: step0,validation + when: nova_conductor_enabled.rc == 0 - name: Stop and disable nova_conductor service tags: step2 + when: nova_conductor_enabled.rc == 0 service: name=openstack-nova-conductor state=stopped enabled=no - name: Remove openstack-nova-conductor package if operator requests it yum: name=openstack-nova-conductor state=removed diff --git a/docker/services/nova-consoleauth.yaml b/docker/services/nova-consoleauth.yaml index 4a2f6b6210..10253af060 100644 --- a/docker/services/nova-consoleauth.yaml +++ b/docker/services/nova-consoleauth.yaml @@ -122,8 +122,18 @@ outputs: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS host_prep_tasks: {get_attr: [NovaLogging, host_prep_tasks]} upgrade_tasks: + - name: Check if nova_consoleauth is deployed + command: systemctl is-active --quiet openstack-nova-consoleauth + tags: common + ignore_errors: True + register: nova_consoleauth_enabled + - name: "PreUpgrade step0,validation: Check service openstack-nova-consoleauth is running" + command: systemctl is-active --quiet openstack-nova-consoleauth + tags: step0,validation + when: nova_consoleauth_enabled.rc == 0 - name: Stop and disable nova_consoleauth service tags: step2 + when: nova_consoleauth_enabled.rc == 0 service: name=openstack-nova-consoleauth state=stopped enabled=no - name: Remove openstack-nova-console package if operator requests it yum: name=openstack-nova-console state=removed diff --git a/docker/services/nova-ironic.yaml b/docker/services/nova-ironic.yaml index 1bed40ec16..3faa75dd50 100644 --- a/docker/services/nova-ironic.yaml +++ b/docker/services/nova-ironic.yaml @@ -122,6 +122,16 @@ outputs: - /var/log/containers/nova - /var/lib/nova upgrade_tasks: + - name: Check if nova ironic is deployed + command: systemctl is-enabled --quiet openstack-nova-compute + tags: common + ignore_errors: True + register: nova_ironic_enabled + - name: "PreUpgrade step0,validation: Check service openstack-nova-compute is running" + command: systemctl is-active --quiet openstack-nova-compute + tags: step0,validation + when: nova_ironic_enabled.rc == 0 - name: Stop and disable nova-compute service tags: step2 + when: nova_ironic_enabled.rc == 0 service: name=openstack-nova-compute state=stopped enabled=no diff --git a/docker/services/nova-libvirt.yaml b/docker/services/nova-libvirt.yaml index df168945d9..a0f1ffb12b 100644 --- a/docker/services/nova-libvirt.yaml +++ b/docker/services/nova-libvirt.yaml @@ -298,6 +298,16 @@ outputs: metadata_settings: get_attr: [NovaLibvirtBase, role_data, metadata_settings] upgrade_tasks: + - name: Check if nova_libvirt is deployed + command: systemctl is-enabled --quiet libvirtd + tags: common + ignore_errors: True + register: nova_libvirt_enabled + - name: "PreUpgrade step0,validation: Check service libvirtd is running" + command: systemctl is-active --quiet libvirtd + tags: step0,validation + when: nova_libvirt_enabled.rc == 0 - name: Stop and disable libvirtd service tags: step2 + when: nova_libvirt_enabled.rc == 0 service: name=libvirtd state=stopped enabled=no diff --git a/docker/services/nova-metadata.yaml b/docker/services/nova-metadata.yaml index 93eb08f0bb..406974d551 100644 --- a/docker/services/nova-metadata.yaml +++ b/docker/services/nova-metadata.yaml @@ -118,6 +118,16 @@ outputs: get_attr: [NovaMetadataBase, role_data, metadata_settings] host_prep_tasks: {get_attr: [NovaLogging, host_prep_tasks]} upgrade_tasks: + - name: Check if nova_api_metadata is deployed + command: systemctl is-enabled --quiet openstack-nova-api + tags: common + ignore_errors: True + register: nova_metadata_enabled + - name: "PreUpgrade step0,validation: Check service openstack-nova-api is running" + command: systemctl is-active --quiet openstack-nova-api + tags: step0,validation + when: nova_metadata_enabled.rc == 0 - name: Stop and disable nova_api service tags: step2 + when: nova_metadata_enabled.rc == 0 service: name=openstack-nova-api state=stopped enabled=no diff --git a/docker/services/nova-placement.yaml b/docker/services/nova-placement.yaml index 84e58f567a..e8ef51ee94 100644 --- a/docker/services/nova-placement.yaml +++ b/docker/services/nova-placement.yaml @@ -139,8 +139,23 @@ outputs: get_attr: [NovaPlacementBase, role_data, metadata_settings] host_prep_tasks: {get_attr: [NovaPlacementLogging, host_prep_tasks]} upgrade_tasks: + - name: Check for nova placement running under apache + tags: common + shell: "httpd -t -D DUMP_VHOSTS | grep -q placement_wsgi" + ignore_errors: True + register: httpd_enabled + - name: Check if httpd is running + tags: common + command: systemctl is-active --quiet httpd + ignore_errors: True + register: httpd_running + - name: "PreUpgrade step0,validation: Check if placement_wsgi is running" + shell: systemctl status 'httpd' | grep -q placement_wsgi + tags: step0,validation + when: httpd_enabled.rc == 0 and httpd_running.rc == 0 - name: Stop and disable nova_placement service (running under httpd) tags: step2 + when: httpd_enabled.rc == 0 and httpd_running.rc == 0 service: name=httpd state=stopped enabled=no - name: Remove httpd package if operator requests it yum: name=httpd state=removed diff --git a/docker/services/nova-scheduler.yaml b/docker/services/nova-scheduler.yaml index 45ecc80fab..a1f77bc0b1 100644 --- a/docker/services/nova-scheduler.yaml +++ b/docker/services/nova-scheduler.yaml @@ -123,8 +123,18 @@ outputs: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS host_prep_tasks: {get_attr: [NovaLogging, host_prep_tasks]} upgrade_tasks: + - name: Check if nova_scheduler is deployed + command: systemctl is-enabled --quiet openstack-nova-scheduler + tags: common + ignore_errors: True + register: nova_scheduler_enabled + - name: "PreUpgrade step0,validation: Check service openstack-nova-scheduler is running" + command: systemctl is-active --quiet openstack-nova-scheduler + tags: step0,validation + when: nova_scheduler_enabled.rc == 0 - name: Stop and disable nova_scheduler service tags: step2 + when: nova_scheduler_enabled.rc == 0 service: name=openstack-nova-scheduler state=stopped enabled=no - name: Remove openstack-nova-scheduler package if operator requests it yum: name=openstack-nova-scheduler state=removed diff --git a/docker/services/nova-vnc-proxy.yaml b/docker/services/nova-vnc-proxy.yaml index b99e2fc18a..1d05c36b07 100644 --- a/docker/services/nova-vnc-proxy.yaml +++ b/docker/services/nova-vnc-proxy.yaml @@ -122,8 +122,18 @@ outputs: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS host_prep_tasks: {get_attr: [NovaLogging, host_prep_tasks]} upgrade_tasks: + - name: Check if nova vncproxy is deployed + command: systemctl is-enabled --quiet openstack-nova-novncproxy + tags: common + ignore_errors: True + register: nova_vncproxy_enabled + - name: "PreUpgrade step0,validation: Check service openstack-nova-novncproxy is running" + command: systemctl is-active --quiet openstack-nova-novncproxy + tags: step0,validation + when: nova_vncproxy_enabled.rc == 0 - name: Stop and disable nova_vnc_proxy service tags: step2 + when: nova_vncproxy_enabled.rc == 0 service: name=openstack-nova-novncproxy state=stopped enabled=no - name: Remove openstack-nova-novncproxy package if operator requests it yum: name=openstack-nova-novncproxy state=removed