From e09375a4ed5aac1f68055489c54c1b1a60f45534 Mon Sep 17 00:00:00 2001 From: Paul Bourke Date: Fri, 5 Feb 2016 17:53:28 +0000 Subject: [PATCH] Upgrade task for Swift Based on the Nova upgrade patch and recommendations from Swift PTL John Dickinson at https://swiftstack.com/blog/2013/12/20/upgrade-openstack-swift-no-downtime/ Notes: As part of this upgrade I have chosen to *not* migrate any data from the old style swift_data container. This is because it was never intended to be used in production; this fact is made clear in the docs. In regards to testing, as of this patch we do not yet have an upgrade task for the common containers (rsyslog and kolla-toolbox), so attempting to upgrade swift will result in it failing to find the kolla-toolbox. This will be true of any other upgrade until upgrade for common is added. It can be worked around by deploying another role such as keystone which will drag in the common role and start up kolla-toolbox, after which Swift can be successfully upgraded. Change-Id: I138556932e9bddcd595d94a3dcb69603268880ff Partially-Implements: blueprint upgrade-kolla Implements: blueprint upgrade-swift --- ansible/roles/swift/tasks/start.yml | 24 ++++++++--------- ansible/roles/swift/tasks/stop_and_start.yml | 28 ++++++++++++++++++++ ansible/roles/swift/tasks/upgrade.yml | 4 +++ 3 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 ansible/roles/swift/tasks/stop_and_start.yml diff --git a/ansible/roles/swift/tasks/start.yml b/ansible/roles/swift/tasks/start.yml index a1abdcae55..215aef0239 100644 --- a/ansible/roles/swift/tasks/start.yml +++ b/ansible/roles/swift/tasks/start.yml @@ -43,18 +43,6 @@ - "heka_socket:/var/lib/kolla/heka/" when: inventory_hostname not in groups['swift-proxy-server'] -- name: Starting swift-proxy-server container - kolla_docker: - action: "start_container" - common_options: "{{ docker_common_options }}" - image: "{{ swift_proxy_server_image_full }}" - name: "swift_proxy_server" - volumes: - - "{{ node_config_directory }}/swift/:/var/lib/kolla/swift/:ro" - - "{{ node_config_directory }}/swift-proxy-server/:{{ container_config_directory }}/:ro" - - "heka_socket:/var/lib/kolla/heka/" - when: inventory_hostname in groups['swift-proxy-server'] - - name: Starting swift-account-server container kolla_docker: action: "start_container" @@ -223,3 +211,15 @@ - "{{ swift_devices_mount_point }}:{{ swift_devices_mount_point }}" - "heka_socket:/var/lib/kolla/heka/" when: inventory_hostname in groups['swift-object-server'] + +- name: Starting swift-proxy-server container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + image: "{{ swift_proxy_server_image_full }}" + name: "swift_proxy_server" + volumes: + - "{{ node_config_directory }}/swift/:/var/lib/kolla/swift/:ro" + - "{{ node_config_directory }}/swift-proxy-server/:{{ container_config_directory }}/:ro" + - "heka_socket:/var/lib/kolla/heka/" + when: inventory_hostname in groups['swift-proxy-server'] diff --git a/ansible/roles/swift/tasks/stop_and_start.yml b/ansible/roles/swift/tasks/stop_and_start.yml new file mode 100644 index 0000000000..fca139f573 --- /dev/null +++ b/ansible/roles/swift/tasks/stop_and_start.yml @@ -0,0 +1,28 @@ +--- +# NOTE(pbourke): because the images that are used to start Swift containers +# were refactored for Mitaka, we need to completely remove the existing +# containers or we get a conflict when attempting to start the new ones. +- name: "Cleaning out old Swift containers" + kolla_docker: + name: "{{ item }}" + # TODO(pbourke): Swift recommend using a SIGHUP to gracefully stop the + # services. Update once kolla_docker supports this. + action: remove_container + with_items: + - "swift_rsyncd" + - "swift_account_server" + - "swift_account_auditor" + - "swift_account_replicator" + - "swift_account_reaper" + - "swift_container_server" + - "swift_container_auditor" + - "swift_container_replicator" + - "swift_container_updater" + - "swift_object_server" + - "swift_object_auditor" + - "swift_object_replicator" + - "swift_object_updater" + - "swift_object_expirer" + - "swift_proxy_server" + +- include: start.yml diff --git a/ansible/roles/swift/tasks/upgrade.yml b/ansible/roles/swift/tasks/upgrade.yml index ed97d539c0..d5206331e9 100644 --- a/ansible/roles/swift/tasks/upgrade.yml +++ b/ansible/roles/swift/tasks/upgrade.yml @@ -1 +1,5 @@ --- +- include: config.yml + +- include: stop_and_start.yml + serial: "30%"