Browse Source

Cinder volume update_host support for upgrade-db

This commit adds cinder-manage volume update_host
for graph-based upgrade-db.

Change-Id: Ibe937391ab95a085167ddda6d04c2999bb650ad0
Closes-Bug: 1641070
changes/06/400006/1
Dmitry Nikishov 2 years ago
parent
commit
08fa42d4ad

+ 7
- 0
deployment/puppet/octane_tasks/files/fetch_puppet_resource_param.sh View File

@@ -0,0 +1,7 @@
1
+#!/bin/bash
2
+
3
+PUPPET_TYPE=$1
4
+RESOURCE_NAME=$2
5
+RESOURCE_PARAM=$3
6
+
7
+echo `puppet resource ${PUPPET_TYPE} ${RESOURCE_NAME} | grep ${RESOURCE_PARAM} | awk '{print $3}' | tr -d "',"`

+ 11
- 0
deployment/puppet/octane_tasks/files/store_current_host.sh View File

@@ -0,0 +1,11 @@
1
+#!/bin/bash
2
+
3
+STORE_PATH=$1
4
+SCRIPT=`readlink -f $0`
5
+DIR=`dirname ${SCRIPT}`
6
+
7
+
8
+CINDER_HOST=`bash ${DIR}/fetch_puppet_resource_param.sh cinder_config DEFAULT/host value`
9
+CINDER_BACKEND=`bash ${DIR}/fetch_puppet_resource_param.sh cinder_config DEFAULT/volume_backend_name value`
10
+
11
+echo "export CURRENT_HOST=\"${CINDER_HOST}#${CINDER_BACKEND}\"" > ${STORE_PATH}

+ 16
- 0
deployment/puppet/octane_tasks/files/store_new_host.sh View File

@@ -0,0 +1,16 @@
1
+#!/bin/bash
2
+
3
+STORE_PATH=$1
4
+SCRIPT=`readlink -f $0`
5
+DIR=`dirname ${SCRIPT}`
6
+
7
+
8
+CINDER_HOST=`bash ${DIR}/fetch_puppet_resource_param.sh cinder_config DEFAULT/host value`
9
+
10
+if [[ -z ${CINDER_HOST} ]]; then
11
+  CINDER_HOST=`bash ${DIR}/fetch_puppet_resource_param.sh cinder_config RBD-backend/backend_host value`
12
+fi
13
+
14
+CINDER_BACKEND=`bash ${DIR}/fetch_puppet_resource_param.sh cinder_config RBD-backend/volume_backend_name value`
15
+
16
+echo "export NEW_HOST=\"${CINDER_HOST}#${CINDER_BACKEND}\"" > ${STORE_PATH}

+ 21
- 0
deployment/puppet/octane_tasks/graphs/orig/upgrade-db.yaml View File

@@ -82,3 +82,24 @@
82 82
   parameters:
83 83
     cmd: rm /etc/hiera/override/common.yaml || true
84 84
     timeout: 60
85
+
86
+- id: store_cinder_current_host
87
+  type: shell
88
+  version: 2.1.0
89
+  groups: [primary-controller]
90
+  requires: [mysqldump_upload_to_master]
91
+  required_for: []
92
+  parameters:
93
+    cmd: bash /etc/fuel/octane/puppet/octane_tasks/files/store_current_host.sh /tmp/cinder_current_host
94
+    timeout: 60
95
+
96
+- id: cinder_current_host_upload_to_master
97
+  type: sync
98
+  version: 2.1.0
99
+  groups: [primary-controller]
100
+  requires: [store_cinder_current_host]
101
+  required_for: []
102
+  parameters:
103
+    src: /tmp/cinder_current_host
104
+    dst: rsync://{MASTER_IP}:/octane_data/
105
+    timeout: 180

+ 37
- 0
deployment/puppet/octane_tasks/graphs/seed/upgrade-db.yaml View File

@@ -114,3 +114,40 @@
114 114
   parameters:
115 115
     cmd: rm /etc/hiera/override/common.yaml || true
116 116
     timeout: 60
117
+
118
+- id: cinder_current_host_download_from_master
119
+  type: sync
120
+  version: 2.0.0
121
+  groups: [primary-controller]
122
+  requires: []
123
+  required_for: []
124
+  condition:
125
+    yaql_exp: "$.upgrade.relation_info.orig_cluster_version =~ '7\\.0'"
126
+  parameters:
127
+    src: rsync://{MASTER_IP}:/octane_data/cinder_current_host
128
+    dst: /tmp
129
+    timeout: 180
130
+
131
+- id: store_cinder_new_host
132
+  type: shell
133
+  version: 2.1.0
134
+  groups: [primary-controller]
135
+  requires: []
136
+  required_for: []
137
+  condition:
138
+    yaql_exp: "$.upgrade.relation_info.orig_cluster_version =~ '7\\.0'"
139
+  parameters:
140
+    cmd: bash /etc/fuel/octane/puppet/octane_tasks/files/store_new_host.sh /tmp/cinder_new_host
141
+    timeout: 60
142
+
143
+- id: cinder_update_host
144
+  type: shell
145
+  version: 2.1.0
146
+  groups: [primary-controller]
147
+  requires: [db_sync, cinder_current_host_download_from_master, store_cinder_new_host]
148
+  required_for: []
149
+  condition:
150
+    yaql_exp: "$.upgrade.relation_info.orig_cluster_version =~ '7\\.0'"
151
+  parameters:
152
+    cmd: 'source /tmp/cinder_current_host; source /tmp/cinder_new_host; cinder-manage volume update_host --currenthost ${CURRENT_HOST} --newhost ${NEW_HOST}'
153
+    timeout: 60

Loading…
Cancel
Save