Browse Source

Merge "Apply Swift rolling upgrade"

Zuul 5 months ago
parent
commit
f5429e42ff

+ 2
- 0
ansible/roles/swift/defaults/main.yml View File

@@ -70,3 +70,5 @@ openstack_swift_auth: "{{ openstack_auth }}"
70 70
 
71 71
 syslog_server: "{{ api_interface_address }}"
72 72
 syslog_swift_facility: "local0"
73
+
74
+swift_enable_rolling_upgrade: "yes"

+ 2
- 0
ansible/roles/swift/tasks/deploy.yml View File

@@ -4,5 +4,7 @@
4 4
 - include_tasks: config.yml
5 5
 
6 6
 - include_tasks: start.yml
7
+  vars:
8
+    run_start_swift_proxy_server: "yes"
7 9
 
8 10
 - include_tasks: check.yml

ansible/roles/swift/tasks/stop_and_start.yml → ansible/roles/swift/tasks/legacy_upgrade.yml View File

@@ -1,4 +1,6 @@
1 1
 ---
2
+- include_tasks: config.yml
3
+
2 4
 # NOTE(pbourke): because the images that are used to start Swift containers
3 5
 # were refactored for Mitaka, we need to completely remove the existing
4 6
 # containers or we get a conflict when attempting to start the new ones.
@@ -6,9 +8,7 @@
6 8
   become: true
7 9
   kolla_docker:
8 10
     name: "{{ item }}"
9
-    # TODO(pbourke): Swift recommend using a SIGHUP to gracefully stop the
10
-    # services. Update once kolla_docker supports this.
11
-    action: remove_container
11
+    action: "stop_container"
12 12
   with_items:
13 13
     - "swift_rsyncd"
14 14
     - "swift_account_server"
@@ -27,3 +27,5 @@
27 27
     - "swift_proxy_server"
28 28
 
29 29
 - include_tasks: start.yml
30
+  vars:
31
+    run_start_swift_proxy_server: "yes"

+ 2
- 0
ansible/roles/swift/tasks/reconfigure.yml View File

@@ -114,6 +114,8 @@
114 114
     - "{{ check_results.results }}"
115 115
 
116 116
 - include_tasks: start.yml
117
+  vars:
118
+    run_start_swift_proxy_server: "yes"
117 119
   when: remove_containers.changed
118 120
 
119 121
 - name: Restart containers

+ 63
- 0
ansible/roles/swift/tasks/rolling_upgrade.yml View File

@@ -0,0 +1,63 @@
1
+---
2
+- include_tasks: pull.yml
3
+
4
+# Upgrade swift storage nodes first
5
+- include_tasks: config.yml
6
+  when: inventory_hostname in groups['swift-account-server'] or
7
+        inventory_hostname in groups['swift-container-server'] or
8
+        inventory_hostname in groups['swift-object-server']
9
+
10
+# TODO(donghm): Below tasks should be run in serial nodes to
11
+# decrease downtime. Update once the module ansible strategy for
12
+# rolling upgrade will be finished.
13
+- name: Gracefully shutdown swift services in storage nodes
14
+  become: true
15
+  kolla_docker:
16
+    action: "stop_container"
17
+    name: "{{ item }}"
18
+  with_items:
19
+    - "swift_rsyncd"
20
+    - "swift_account_server"
21
+    - "swift_account_auditor"
22
+    - "swift_account_replicator"
23
+    - "swift_account_reaper"
24
+    - "swift_container_server"
25
+    - "swift_container_auditor"
26
+    - "swift_container_replicator"
27
+    - "swift_container_updater"
28
+    - "swift_object_server"
29
+    - "swift_object_auditor"
30
+    - "swift_object_replicator"
31
+    - "swift_object_updater"
32
+    - "swift_object_expirer"
33
+  when: inventory_hostname in groups['swift-account-server'] or
34
+        inventory_hostname in groups['swift-container-server'] or
35
+        inventory_hostname in groups['swift-object-server']
36
+
37
+- include_tasks: start.yml
38
+  vars:
39
+    run_start_swift_proxy_server: "no"
40
+
41
+# Upgrade swift proxy nodes
42
+- include_tasks: config.yml
43
+  when: inventory_hostname in groups['swift-proxy-server']
44
+
45
+- name: Gracefully shutdown swift proxy services in proxy nodes
46
+  become: true
47
+  kolla_docker:
48
+    action: "stop_container"
49
+    name: "swift_proxy_server"
50
+  when: inventory_hostname in groups['swift-proxy-server']
51
+
52
+- name: Start new swift proxy server container
53
+  become: true
54
+  kolla_docker:
55
+    action: "start_container"
56
+    common_options: "{{ docker_common_options }}"
57
+    image: "{{ swift_proxy_server_image_full }}"
58
+    name: "swift_proxy_server"
59
+    volumes:
60
+      - "{{ node_config_directory }}/swift/:/var/lib/kolla/swift/:ro"
61
+      - "{{ node_config_directory }}/swift-proxy-server/:{{ container_config_directory }}/:ro"
62
+      - "/etc/localtime:/etc/localtime:ro"
63
+  when: inventory_hostname in groups['swift-proxy-server']

+ 2
- 1
ansible/roles/swift/tasks/start.yml View File

@@ -246,4 +246,5 @@
246 246
       - "{{ node_config_directory }}/swift/:/var/lib/kolla/swift/:ro"
247 247
       - "{{ node_config_directory }}/swift-proxy-server/:{{ container_config_directory }}/:ro"
248 248
       - "/etc/localtime:/etc/localtime:ro"
249
-  when: inventory_hostname in groups['swift-proxy-server']
249
+  when: inventory_hostname in groups['swift-proxy-server'] and
250
+        run_start_swift_proxy_server | bool

+ 4
- 2
ansible/roles/swift/tasks/upgrade.yml View File

@@ -1,4 +1,6 @@
1 1
 ---
2
-- include_tasks: config.yml
2
+- include_tasks: rolling_upgrade.yml
3
+  when: swift_enable_rolling_upgrade | bool
3 4
 
4
-- include_tasks: stop_and_start.yml
5
+- include_tasks: legacy_upgrade.yml
6
+  when: not swift_enable_rolling_upgrade | bool

+ 7
- 0
etc/kolla/globals.yml View File

@@ -493,6 +493,13 @@ ironic_dnsmasq_dhcp_range:
493 493
 # filesystems' labels prepared for swift.
494 494
 #swift_devices_name: "KOLLA_SWIFT_DATA"
495 495
 
496
+# Configure swift upgrade option, due to currently kolla support
497
+# two upgrade ways for swift: legacy_upgrade and rolling_upgrade
498
+# The variable "swift_enable_rolling_upgrade: yes" is meaning rolling_upgrade
499
+# were enabled and opposite
500
+# Rolling upgrade were enable by default
501
+#swift_enable_rolling_upgrade: "yes"
502
+
496 503
 
497 504
 ################################################
498 505
 # Tempest - The OpenStack Integration Test Suite

+ 5
- 0
releasenotes/notes/implement-swift-rolling-upgrade-bb715b173263f844.yaml View File

@@ -0,0 +1,5 @@
1
+---
2
+features:
3
+  - |
4
+    Implement Swift rolling upgrade logic, enabled by default at
5
+    swift_enable_rolling_upgrade: "yes" in etc/kolla/globals.yml file.

Loading…
Cancel
Save