From fcc225159a52feb85cc47274287a4f60b1fb7a6f Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 23 May 2018 16:54:00 -0700 Subject: [PATCH] undercloud: add missing services for upgrade cleanup Add cleanup tasks for Ironic, Keystone Mistral and Zaqar, so when upgrading an undercloud to be containerized, an operator can also cleanup these services rpms. Depends-On: I2af99d8bad58f12bd895b473ecb84e4f2091f738 Change-Id: I7e257cece9fa3bdd9f2d1be08ccdf5c681213149 --- docker/services/ironic-api.yaml | 11 +++++++++++ docker/services/ironic-conductor.yaml | 11 +++++++++++ docker/services/ironic-inspector.yaml | 11 +++++++++++ docker/services/keystone.yaml | 11 +++++++++++ docker/services/mistral-api.yaml | 11 +++++++++++ docker/services/mistral-engine.yaml | 11 +++++++++++ docker/services/mistral-event-engine.yaml | 11 +++++++++++ docker/services/mistral-executor.yaml | 11 +++++++++++ docker/services/zaqar.yaml | 24 +++++++++++++++++------ 9 files changed, 106 insertions(+), 6 deletions(-) diff --git a/docker/services/ironic-api.yaml b/docker/services/ironic-api.yaml index a19b81130e..7eda030575 100644 --- a/docker/services/ironic-api.yaml +++ b/docker/services/ironic-api.yaml @@ -36,6 +36,10 @@ parameters: default: {} description: Parameters specific to the role type: json + UpgradeRemoveUnusedPackages: + default: false + description: Remove package if the service is being disabled during upgrade + type: boolean resources: @@ -199,6 +203,13 @@ outputs: - ironic_httpd_enabled|bool - httpd_running|bool service: name=httpd state=stopped enabled=no + - name: Set fact for removal of openstack-ironic-api package + set_fact: + remove_ironic_api_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove openstack-ironic-api package if operator requests it + yum: name=openstack-ironic-api state=removed + ignore_errors: True + when: remove_ironic_api_package|bool fast_forward_upgrade_tasks: - block: - name: Check if ironic_api is deployed diff --git a/docker/services/ironic-conductor.yaml b/docker/services/ironic-conductor.yaml index 6fedce093a..ea82b6070f 100644 --- a/docker/services/ironic-conductor.yaml +++ b/docker/services/ironic-conductor.yaml @@ -41,6 +41,10 @@ parameters: description: Whether to configure Swift temporary URLs for use with the "direct" and "ansible" deploy interfaces. type: boolean + UpgradeRemoveUnusedPackages: + default: false + description: Remove package if the service is being disabled during upgrade + type: boolean conditions: configure_swift_temp_url: {equals: [{get_param: IronicConfigureSwiftTempUrlKey}, true]} @@ -232,6 +236,13 @@ outputs: - name: Stop and disable ironic_conductor service when: ironic_conductor_enabled|bool service: name=openstack-ironic-conductor state=stopped enabled=no + - name: Set fact for removal of openstack-ironic-conductor package + set_fact: + remove_ironic_conductor_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove openstack-ironic-conductor package if operator requests it + yum: name=openstack-ironic-conductor state=removed + ignore_errors: True + when: remove_ironic_conductor_package|bool fast_forward_upgrade_tasks: - block: - name: Check if ironic_conductor is deployed diff --git a/docker/services/ironic-inspector.yaml b/docker/services/ironic-inspector.yaml index 476b471ad9..9df60fd1a7 100644 --- a/docker/services/ironic-inspector.yaml +++ b/docker/services/ironic-inspector.yaml @@ -40,6 +40,10 @@ parameters: default: [] description: IPA image URLs, the format should be ["http://path/to/kernel", "http://path/to/ramdisk"] type: json + UpgradeRemoveUnusedPackages: + default: false + description: Remove package if the service is being disabled during upgrade + type: boolean resources: @@ -245,3 +249,10 @@ outputs: - name: Stop and disable ironic_inspector dnsmasq service service: name=openstack-ironic-inspector-dnsmasq state=stopped enabled=no when: ironic_inspector_enabled|bool + - name: Set fact for removal of openstack-ironic-inspector package + set_fact: + remove_ironic_inspector_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove openstack-ironic-inspector package if operator requests it + yum: name=openstack-ironic-inspector state=removed + ignore_errors: True + when: remove_ironic_inspector_package|bool diff --git a/docker/services/keystone.yaml b/docker/services/keystone.yaml index 02c705eeb5..02c57b85be 100644 --- a/docker/services/keystone.yaml +++ b/docker/services/keystone.yaml @@ -54,6 +54,10 @@ parameters: EnableInternalTLS: type: boolean default: false + UpgradeRemoveUnusedPackages: + default: false + description: Remove package if the service is being disabled during upgrade + type: boolean resources: @@ -255,6 +259,13 @@ outputs: file: path: /var/spool/cron/keystone state: absent + - name: Set fact for removal of openstack-keystone package + set_fact: + remove_keystone_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove openstack-keystone package if operator requests it + yum: name=openstack-keystone state=removed + ignore_errors: True + when: remove_keystone_package|bool metadata_settings: get_attr: [KeystoneBase, role_data, metadata_settings] fast_forward_upgrade_tasks: diff --git a/docker/services/mistral-api.yaml b/docker/services/mistral-api.yaml index 730b2b6ff3..5a4045c1c4 100644 --- a/docker/services/mistral-api.yaml +++ b/docker/services/mistral-api.yaml @@ -36,6 +36,10 @@ parameters: default: {} description: Parameters specific to the role type: json + UpgradeRemoveUnusedPackages: + default: false + description: Remove package if the service is being disabled during upgrade + type: boolean resources: @@ -207,3 +211,10 @@ outputs: when: - mistral_httpd_enabled|bool - httpd_running|bool + - name: Set fact for removal of openstack-mistral-api package + set_fact: + remove_mistral_api_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove openstack-mistral-api package if operator requests it + yum: name=openstack-mistral-api state=removed + ignore_errors: True + when: remove_mistral_api_package|bool diff --git a/docker/services/mistral-engine.yaml b/docker/services/mistral-engine.yaml index 58ea7f34a6..c97739470f 100644 --- a/docker/services/mistral-engine.yaml +++ b/docker/services/mistral-engine.yaml @@ -36,6 +36,10 @@ parameters: default: {} description: Parameters specific to the role type: json + UpgradeRemoveUnusedPackages: + default: false + description: Remove package if the service is being disabled during upgrade + type: boolean resources: @@ -140,3 +144,10 @@ outputs: - name: Stop and disable mistral_engine service when: mistral_engine_enabled|bool service: name=openstack-mistral-engine state=stopped enabled=no + - name: Set fact for removal of openstack-mistral-engine package + set_fact: + remove_mistral_engine_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove openstack-mistral-engine package if operator requests it + yum: name=openstack-mistral-engine state=removed + ignore_errors: True + when: remove_mistral_engine_package|bool diff --git a/docker/services/mistral-event-engine.yaml b/docker/services/mistral-event-engine.yaml index 89b88d201f..4a797c852e 100644 --- a/docker/services/mistral-event-engine.yaml +++ b/docker/services/mistral-event-engine.yaml @@ -36,6 +36,10 @@ parameters: default: {} description: Parameters specific to the role type: json + UpgradeRemoveUnusedPackages: + default: false + description: Remove package if the service is being disabled during upgrade + type: boolean resources: @@ -140,3 +144,10 @@ outputs: - name: Stop and disable mistral_event_engine service when: mistral_event_engine_enabled|bool service: name=openstack-mistral-event-engine state=stopped enabled=no + - name: Set fact for removal of openstack-mistral-event-engine package + set_fact: + remove_mistral_event_engine_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove openstack-mistral-event-engine package if operator requests it + yum: name=openstack-mistral-event-engine state=removed + ignore_errors: True + when: remove_mistral_event_engine_package|bool diff --git a/docker/services/mistral-executor.yaml b/docker/services/mistral-executor.yaml index 07f2d8ab47..7955b200b7 100644 --- a/docker/services/mistral-executor.yaml +++ b/docker/services/mistral-executor.yaml @@ -36,6 +36,10 @@ parameters: default: {} description: Parameters specific to the role type: json + UpgradeRemoveUnusedPackages: + default: false + description: Remove package if the service is being disabled during upgrade + type: boolean resources: @@ -148,3 +152,10 @@ outputs: - name: Stop and disable mistral_executor service when: mistral_executor_enabled|bool service: name=openstack-mistral-executor state=stopped enabled=no + - name: Set fact for removal of openstack-mistral-executor package + set_fact: + remove_mistral_executor_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove openstack-mistral-executor package if operator requests it + yum: name=openstack-mistral-executor state=removed + ignore_errors: True + when: remove_mistral_executor_package|bool diff --git a/docker/services/zaqar.yaml b/docker/services/zaqar.yaml index 2856ea9a1f..a5645b474d 100644 --- a/docker/services/zaqar.yaml +++ b/docker/services/zaqar.yaml @@ -43,6 +43,10 @@ parameters: EnableInternalTLS: type: boolean default: false + UpgradeRemoveUnusedPackages: + default: false + description: Remove package if the service is being disabled during upgrade + type: boolean conditions: zaqar_management_store_sqlalchemy: {equals : [{get_param: ZaqarManagementStore}, 'sqlalchemy']} @@ -218,11 +222,19 @@ outputs: when: - zaqar_httpd_enabled|bool - httpd_running|bool - - name: Stop and disable zaqar service - when: - - step|int == 2 - - zaqar_httpd_enabled|bool - - httpd_running|bool - service: name=httpd state=stopped enabled=no + - when: step|int == 2 + block: + - name: Stop and disable zaqar service + when: + - zaqar_httpd_enabled|bool + - httpd_running|bool + service: name=httpd state=stopped enabled=no + - name: Set fact for removal of openstack-zaqar package + set_fact: + remove_zaqar_package: {get_param: UpgradeRemoveUnusedPackages} + - name: Remove openstack-zaqar package if operator requests it + yum: name=openstack-zaqar state=removed + ignore_errors: True + when: remove_zaqar_package|bool metadata_settings: get_attr: [ZaqarBase, role_data, metadata_settings]