Jiri Broulik | bb447ac | 2017-05-04 15:36:22 +0200 | [diff] [blame] | 1 | /** |
| 2 | * Update packages on given nodes |
| 3 | * |
| 4 | * Expected parameters: |
| 5 | * SALT_MASTER_CREDENTIALS Credentials to the Salt API. |
| 6 | * SALT_MASTER_URL Full Salt API address [http://10.10.10.1:8000]. |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 7 | * STAGE_TEST_UPGRADE Run test upgrade stage (bool) |
| 8 | * STAGE_REAL_UPGRADE Run real upgrade stage (bool) |
| 9 | * STAGE_ROLLBACK_UPGRADE Run rollback upgrade stage (bool) |
Jiri Broulik | bb447ac | 2017-05-04 15:36:22 +0200 | [diff] [blame] | 10 | * |
| 11 | **/ |
| 12 | |
| 13 | def common = new com.mirantis.mk.Common() |
| 14 | def salt = new com.mirantis.mk.Salt() |
| 15 | |
| 16 | |
| 17 | def saltMaster |
| 18 | |
| 19 | timestamps { |
| 20 | node() { |
| 21 | |
| 22 | stage('Connect to Salt API') { |
| 23 | saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS) |
| 24 | } |
| 25 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 26 | if (STAGE_TEST_UPGRADE.toBoolean() == true) { |
| 27 | stage('Test upgrade') { |
| 28 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 29 | |
Jiri Broulik | 80d9675 | 2017-05-22 19:42:01 +0200 | [diff] [blame] | 30 | try { |
| 31 | salt.enforceState(saltMaster, 'I@salt:master', 'reclass') |
| 32 | } catch (Exception e) { |
Jiri Broulik | 3467432 | 2017-05-25 19:10:57 +0200 | [diff] [blame] | 33 | common.warningMsg("Some parts of Reclass state failed. The most probable reasons were uncommited changes. We should continue to run") |
Jiri Broulik | 80d9675 | 2017-05-22 19:42:01 +0200 | [diff] [blame] | 34 | } |
| 35 | |
Jiri Broulik | 3467432 | 2017-05-25 19:10:57 +0200 | [diff] [blame] | 36 | try { |
| 37 | salt.runSaltProcessStep(saltMaster, '*', 'saltutil.refresh_pillar', [], null, true) |
| 38 | } catch (Exception e) { |
| 39 | common.warningMsg("No response from some minions. We should continue to run") |
| 40 | } |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 41 | |
Jiri Broulik | 3467432 | 2017-05-25 19:10:57 +0200 | [diff] [blame] | 42 | try { |
| 43 | salt.runSaltProcessStep(saltMaster, '*', 'saltutil.sync_all', [], null, true) |
| 44 | } catch (Exception e) { |
| 45 | common.warningMsg("No response from some minions. We should continue to run") |
| 46 | } |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 47 | |
| 48 | def _pillar = salt.getGrain(saltMaster, 'I@salt:master', 'domain') |
| 49 | def domain = _pillar['return'][0].values()[0].values()[0] |
| 50 | print(_pillar) |
| 51 | print(domain) |
| 52 | |
| 53 | // read backupninja variable |
| 54 | _pillar = salt.getPillar(saltMaster, 'I@backupninja:client', '_param:backupninja_backup_host') |
| 55 | def backupninja_backup_host = _pillar['return'][0].values()[0] |
| 56 | print(_pillar) |
| 57 | print(backupninja_backup_host) |
| 58 | |
| 59 | _pillar = salt.getGrain(saltMaster, 'I@salt:control', 'id') |
| 60 | def kvm01 = _pillar['return'][0].values()[0].values()[0] |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 61 | print(_pillar) |
| 62 | print(kvm01) |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 63 | |
| 64 | _pillar = salt.getPillar(saltMaster, "${kvm01}", 'salt:control:cluster:internal:node:upg01:provider') |
| 65 | def upgNodeProvider = _pillar['return'][0].values()[0] |
| 66 | print(_pillar) |
| 67 | print(upgNodeProvider) |
Jiri Broulik | bb447ac | 2017-05-04 15:36:22 +0200 | [diff] [blame] | 68 | |
Jiri Broulik | 6fc9d3f | 2017-05-12 07:11:29 +0200 | [diff] [blame] | 69 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 70 | salt.runSaltProcessStep(saltMaster, "${upgNodeProvider}", 'virt.destroy', ["upg01.${domain}"], null, true) |
| 71 | salt.runSaltProcessStep(saltMaster, "${upgNodeProvider}", 'virt.undefine', ["upg01.${domain}"], null, true) |
Jiri Broulik | 6fc9d3f | 2017-05-12 07:11:29 +0200 | [diff] [blame] | 72 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 73 | |
| 74 | try { |
Jiri Broulik | d6bc138 | 2017-05-17 18:46:27 +0200 | [diff] [blame] | 75 | salt.cmdRun(saltMaster, 'I@salt:master', "salt-key -d upg01.${domain} -y") |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 76 | } catch (Exception e) { |
Jiri Broulik | d6bc138 | 2017-05-17 18:46:27 +0200 | [diff] [blame] | 77 | common.warningMsg("upg01.${domain} does not match any accepted, unaccepted or rejected keys. The key did not exist yet or was already removed. We should continue to run") |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 78 | } |
Jiri Broulik | 6fc9d3f | 2017-05-12 07:11:29 +0200 | [diff] [blame] | 79 | |
| 80 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 81 | // salt 'kvm02*' state.sls salt.control |
| 82 | salt.enforceState(saltMaster, "${upgNodeProvider}", 'salt.control') |
Jiri Broulik | bb447ac | 2017-05-04 15:36:22 +0200 | [diff] [blame] | 83 | |
Jiri Broulik | 8dabbfd | 2017-07-25 10:49:45 +0200 | [diff] [blame] | 84 | // wait until upg node is registered in salt-key |
| 85 | salt.minionPresent(saltMaster, 'I@salt:master', 'upg01') |
Jiri Broulik | bb447ac | 2017-05-04 15:36:22 +0200 | [diff] [blame] | 86 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 87 | // salt '*' saltutil.refresh_pillar |
| 88 | salt.runSaltProcessStep(saltMaster, 'upg*', 'saltutil.refresh_pillar', [], null, true) |
| 89 | // salt '*' saltutil.sync_all |
| 90 | salt.runSaltProcessStep(saltMaster, 'upg*', 'saltutil.sync_all', [], null, true) |
Jiri Broulik | bb447ac | 2017-05-04 15:36:22 +0200 | [diff] [blame] | 91 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 92 | // salt "upg*" state.sls linux,openssh,salt.minion,ntp,rsyslog |
| 93 | try { |
| 94 | salt.enforceState(saltMaster, 'upg*', ['linux', 'openssh', 'salt.minion', 'ntp', 'rsyslog']) |
| 95 | } catch (Exception e) { |
| 96 | common.warningMsg('Received no response because salt-minion was restarted. We should continue to run') |
| 97 | } |
| 98 | salt.enforceState(saltMaster, 'upg*', ['linux', 'openssh', 'salt.minion', 'ntp', 'rsyslog']) |
Jiri Broulik | bb447ac | 2017-05-04 15:36:22 +0200 | [diff] [blame] | 99 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 100 | // salt "upg*" state.sls rabbitmq |
| 101 | salt.enforceState(saltMaster, 'upg*', ['rabbitmq', 'memcached']) |
| 102 | try { |
| 103 | salt.enforceState(saltMaster, 'I@backupninja:client', ['openssh.client', 'salt.minion']) |
| 104 | } catch (Exception e) { |
| 105 | common.warningMsg('salt-minion was restarted. We should continue to run') |
| 106 | } |
| 107 | try { |
| 108 | salt.enforceState(saltMaster, 'I@backupninja:server', ['salt.minion']) |
| 109 | } catch (Exception e) { |
| 110 | common.warningMsg('salt-minion was restarted. We should continue to run') |
| 111 | } |
| 112 | // salt '*' state.apply salt.minion.grains |
| 113 | //salt.enforceState(saltMaster, '*', 'salt.minion.grains') |
| 114 | // salt -C 'I@backupninja:server' state.sls backupninja |
| 115 | salt.enforceState(saltMaster, 'I@backupninja:server', 'backupninja') |
| 116 | // salt -C 'I@backupninja:client' state.sls backupninja |
| 117 | salt.enforceState(saltMaster, 'I@backupninja:client', 'backupninja') |
| 118 | salt.runSaltProcessStep(saltMaster, 'I@backupninja:client', 'ssh.rm_known_host', ["root", "${backupninja_backup_host}"], null, true) |
Jiri Broulik | 90c6c7f | 2017-06-12 13:05:46 +0200 | [diff] [blame] | 119 | try { |
| 120 | salt.cmdRun(saltMaster, 'I@backupninja:client', "arp -d ${backupninja_backup_host}") |
| 121 | } catch (Exception e) { |
Jiri Broulik | 29cffe3 | 2017-06-12 14:15:19 +0200 | [diff] [blame] | 122 | common.warningMsg('The ARP entry does not exist. We should continue to run.') |
Jiri Broulik | 90c6c7f | 2017-06-12 13:05:46 +0200 | [diff] [blame] | 123 | } |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 124 | salt.runSaltProcessStep(saltMaster, 'I@backupninja:client', 'ssh.set_known_host', ["root", "${backupninja_backup_host}"], null, true) |
| 125 | salt.cmdRun(saltMaster, 'I@backupninja:client', 'backupninja -n --run /etc/backup.d/101.mysql') |
Jiri Broulik | 2be7f67 | 2017-05-25 11:07:06 +0200 | [diff] [blame] | 126 | salt.cmdRun(saltMaster, 'I@backupninja:client', 'backupninja -n --run /etc/backup.d/200.backup.rsync > /tmp/backupninjalog') |
Jiri Broulik | 6fc9d3f | 2017-05-12 07:11:29 +0200 | [diff] [blame] | 127 | |
Jiri Broulik | 00d0109 | 2017-06-01 19:38:15 +0200 | [diff] [blame] | 128 | salt.enforceState(saltMaster, 'I@xtrabackup:server', 'xtrabackup') |
| 129 | salt.enforceState(saltMaster, 'I@xtrabackup:client', 'openssh.client') |
| 130 | salt.cmdRun(saltMaster, 'I@xtrabackup:client', "su root -c 'salt-call state.sls xtrabackup'") |
| 131 | salt.cmdRun(saltMaster, 'I@xtrabackup:client', "su root -c '/usr/local/bin/innobackupex-runner.sh'") |
Jiri Broulik | 6fc9d3f | 2017-05-12 07:11:29 +0200 | [diff] [blame] | 132 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 133 | def databases = salt.cmdRun(saltMaster, 'I@mysql:client','salt-call mysql.db_list | grep upgrade | awk \'/-/ {print \$2}\'') |
| 134 | if(databases && databases != ""){ |
| 135 | def databasesList = databases['return'][0].values()[0].trim().tokenize("\n") |
Jiri Broulik | 00d0109 | 2017-06-01 19:38:15 +0200 | [diff] [blame] | 136 | for( i = 0; i < databasesList.size(); i++){ |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 137 | if(databasesList[i].toLowerCase().contains('upgrade')){ |
| 138 | salt.runSaltProcessStep(saltMaster, 'I@mysql:client', 'mysql.db_remove', ["${databasesList[i]}"], null, true) |
| 139 | common.warningMsg("removing database ${databasesList[i]}") |
| 140 | salt.runSaltProcessStep(saltMaster, 'I@mysql:client', 'file.remove', ["/root/mysql/flags/${databasesList[i]}-installed"], null, true) |
| 141 | } |
| 142 | } |
Jiri Broulik | 5a13a65 | 2017-05-18 14:33:32 +0200 | [diff] [blame] | 143 | salt.enforceState(saltMaster, 'I@mysql:client', 'mysql.client') |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 144 | }else{ |
| 145 | common.errorMsg("No _upgrade databases were returned") |
| 146 | } |
Jiri Broulik | bb447ac | 2017-05-04 15:36:22 +0200 | [diff] [blame] | 147 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 148 | try { |
| 149 | salt.enforceState(saltMaster, 'upg*', 'keystone.server') |
Jiri Broulik | 29cffe3 | 2017-06-12 14:15:19 +0200 | [diff] [blame] | 150 | salt.runSaltProcessStep(saltMaster, 'upg*', 'service.restart', ['apache2'], null, true) |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 151 | } catch (Exception e) { |
Jiri Broulik | 08229c8 | 2017-05-22 23:35:32 +0200 | [diff] [blame] | 152 | common.warningMsg('Restarting Apache2') |
Jiri Broulik | 5a13a65 | 2017-05-18 14:33:32 +0200 | [diff] [blame] | 153 | salt.runSaltProcessStep(saltMaster, 'upg*', 'service.restart', ['apache2'], null, true) |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 154 | } |
Jiri Broulik | 69de13a | 2017-05-18 13:53:58 +0200 | [diff] [blame] | 155 | try { |
| 156 | salt.enforceState(saltMaster, 'upg*', 'keystone.client') |
| 157 | } catch (Exception e) { |
| 158 | common.warningMsg('running keystone.client state again') |
| 159 | salt.enforceState(saltMaster, 'upg*', 'keystone.client') |
| 160 | } |
Jiri Broulik | 5f83c29 | 2017-05-18 12:09:07 +0200 | [diff] [blame] | 161 | try { |
| 162 | salt.enforceState(saltMaster, 'upg*', 'glance') |
| 163 | } catch (Exception e) { |
| 164 | common.warningMsg('running glance state again') |
| 165 | salt.enforceState(saltMaster, 'upg*', 'glance') |
| 166 | } |
| 167 | salt.enforceState(saltMaster, 'upg*', 'keystone.server') |
| 168 | try { |
| 169 | salt.enforceState(saltMaster, 'upg*', 'nova') |
| 170 | } catch (Exception e) { |
| 171 | common.warningMsg('running nova state again') |
| 172 | salt.enforceState(saltMaster, 'upg*', 'nova') |
| 173 | } |
Jiri Broulik | 80d9675 | 2017-05-22 19:42:01 +0200 | [diff] [blame] | 174 | // run nova state again as sometimes nova does not enforce itself for some reason |
| 175 | try { |
| 176 | salt.enforceState(saltMaster, 'upg*', 'nova') |
| 177 | } catch (Exception e) { |
| 178 | common.warningMsg('running nova state again') |
| 179 | salt.enforceState(saltMaster, 'upg*', 'nova') |
| 180 | } |
Jiri Broulik | bda0a21 | 2017-05-18 12:54:51 +0200 | [diff] [blame] | 181 | try { |
| 182 | salt.enforceState(saltMaster, 'upg*', 'cinder') |
| 183 | } catch (Exception e) { |
| 184 | common.warningMsg('running cinder state again') |
| 185 | salt.enforceState(saltMaster, 'upg*', 'cinder') |
| 186 | } |
Jiri Broulik | 5f83c29 | 2017-05-18 12:09:07 +0200 | [diff] [blame] | 187 | try { |
| 188 | salt.enforceState(saltMaster, 'upg*', 'neutron') |
| 189 | } catch (Exception e) { |
| 190 | common.warningMsg('running neutron state again') |
| 191 | salt.enforceState(saltMaster, 'upg*', 'neutron') |
| 192 | } |
Jiri Broulik | bda0a21 | 2017-05-18 12:54:51 +0200 | [diff] [blame] | 193 | try { |
| 194 | salt.enforceState(saltMaster, 'upg*', 'heat') |
| 195 | } catch (Exception e) { |
| 196 | common.warningMsg('running heat state again') |
| 197 | salt.enforceState(saltMaster, 'upg*', 'heat') |
| 198 | } |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 199 | salt.cmdRun(saltMaster, 'upg01*', '. /root/keystonercv3; openstack service list; openstack image list; openstack flavor list; openstack compute service list; openstack server list; openstack network list; openstack volume list; openstack orchestration service list') |
Jiri Broulik | bb447ac | 2017-05-04 15:36:22 +0200 | [diff] [blame] | 200 | |
Jiri Broulik | 08229c8 | 2017-05-22 23:35:32 +0200 | [diff] [blame] | 201 | if (STAGE_TEST_UPGRADE.toBoolean() == true && STAGE_REAL_UPGRADE.toBoolean() == true) { |
| 202 | stage('Ask for manual confirmation') { |
| 203 | input message: "Do you want to continue with upgrade?" |
| 204 | } |
| 205 | } |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 206 | } |
Jiri Broulik | bb447ac | 2017-05-04 15:36:22 +0200 | [diff] [blame] | 207 | } |
| 208 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 209 | if (STAGE_REAL_UPGRADE.toBoolean() == true) { |
| 210 | stage('Real upgrade') { |
| 211 | // # actual upgrade |
| 212 | |
Jiri Broulik | e2f1e4a | 2017-05-17 23:59:52 +0200 | [diff] [blame] | 213 | _pillar = salt.getGrain(saltMaster, 'I@salt:master', 'domain') |
| 214 | domain = _pillar['return'][0].values()[0].values()[0] |
| 215 | print(_pillar) |
| 216 | print(domain) |
| 217 | |
| 218 | _pillar = salt.getGrain(saltMaster, 'I@salt:control', 'id') |
| 219 | kvm01 = _pillar['return'][0].values()[0].values()[0] |
Jiri Broulik | e2f1e4a | 2017-05-17 23:59:52 +0200 | [diff] [blame] | 220 | print(_pillar) |
| 221 | print(kvm01) |
Jiri Broulik | 80d9675 | 2017-05-22 19:42:01 +0200 | [diff] [blame] | 222 | |
| 223 | def errorOccured = false |
Jiri Broulik | e2f1e4a | 2017-05-17 23:59:52 +0200 | [diff] [blame] | 224 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 225 | _pillar = salt.getPillar(saltMaster, "${kvm01}", 'salt:control:cluster:internal:node:ctl01:provider') |
| 226 | def ctl01NodeProvider = _pillar['return'][0].values()[0] |
| 227 | |
| 228 | _pillar = salt.getPillar(saltMaster, "${kvm01}", 'salt:control:cluster:internal:node:ctl02:provider') |
| 229 | def ctl02NodeProvider = _pillar['return'][0].values()[0] |
| 230 | |
| 231 | _pillar = salt.getPillar(saltMaster, "${kvm01}", 'salt:control:cluster:internal:node:ctl03:provider') |
| 232 | def ctl03NodeProvider = _pillar['return'][0].values()[0] |
| 233 | |
| 234 | _pillar = salt.getPillar(saltMaster, "${kvm01}", 'salt:control:cluster:internal:node:prx01:provider') |
| 235 | def prx01NodeProvider = _pillar['return'][0].values()[0] |
| 236 | |
| 237 | _pillar = salt.getPillar(saltMaster, "${kvm01}", 'salt:control:cluster:internal:node:prx02:provider') |
| 238 | def prx02NodeProvider = _pillar['return'][0].values()[0] |
| 239 | |
| 240 | |
| 241 | salt.runSaltProcessStep(saltMaster, "${prx01NodeProvider}", 'virt.destroy', ["prx01.${domain}"], null, true) |
| 242 | salt.runSaltProcessStep(saltMaster, "${prx02NodeProvider}", 'virt.destroy', ["prx02.${domain}"], null, true) |
| 243 | salt.runSaltProcessStep(saltMaster, "${ctl01NodeProvider}", 'virt.destroy', ["ctl01.${domain}"], null, true) |
| 244 | salt.runSaltProcessStep(saltMaster, "${ctl02NodeProvider}", 'virt.destroy', ["ctl02.${domain}"], null, true) |
| 245 | salt.runSaltProcessStep(saltMaster, "${ctl03NodeProvider}", 'virt.destroy', ["ctl03.${domain}"], null, true) |
| 246 | |
| 247 | |
| 248 | try { |
| 249 | salt.cmdRun(saltMaster, "${prx01NodeProvider}", "[ ! -f /root/prx01.${domain}.qcow2.bak ] && cp /var/lib/libvirt/images/prx01.${domain}/system.qcow2 ./prx01.${domain}.qcow2.bak") |
| 250 | } catch (Exception e) { |
| 251 | common.warningMsg('File already exists') |
| 252 | } |
| 253 | try { |
| 254 | salt.cmdRun(saltMaster, "${prx02NodeProvider}", "[ ! -f /root/prx02.${domain}.qcow2.bak ] && cp /var/lib/libvirt/images/prx02.${domain}/system.qcow2 ./prx02.${domain}.qcow2.bak") |
| 255 | } catch (Exception e) { |
| 256 | common.warningMsg('File already exists') |
| 257 | } |
| 258 | try { |
| 259 | salt.cmdRun(saltMaster, "${ctl01NodeProvider}", "[ ! -f /root/ctl01.${domain}.qcow2.bak ] && cp /var/lib/libvirt/images/ctl01.${domain}/system.qcow2 ./ctl01.${domain}.qcow2.bak") |
| 260 | } catch (Exception e) { |
| 261 | common.warningMsg('File already exists') |
| 262 | } |
| 263 | try { |
| 264 | salt.cmdRun(saltMaster, "${ctl02NodeProvider}", "[ ! -f /root/ctl02.${domain}.qcow2.bak ] && cp /var/lib/libvirt/images/ctl02.${domain}/system.qcow2 ./ctl02.${domain}.qcow2.bak") |
| 265 | } catch (Exception e) { |
| 266 | common.warningMsg('File already exists') |
| 267 | } |
| 268 | try { |
| 269 | salt.cmdRun(saltMaster, "${ctl03NodeProvider}", "[ ! -f /root/ctl03.${domain}.qcow2.bak ] && cp /var/lib/libvirt/images/ctl03.${domain}/system.qcow2 ./ctl03.${domain}.qcow2.bak") |
| 270 | } catch (Exception e) { |
| 271 | common.warningMsg('File already exists') |
| 272 | } |
| 273 | |
| 274 | |
| 275 | salt.runSaltProcessStep(saltMaster, "${prx01NodeProvider}", 'virt.undefine', ["prx01.${domain}"], null, true) |
| 276 | salt.runSaltProcessStep(saltMaster, "${prx02NodeProvider}", 'virt.undefine', ["prx02.${domain}"], null, true) |
| 277 | salt.runSaltProcessStep(saltMaster, "${ctl01NodeProvider}", 'virt.undefine', ["ctl01.${domain}"], null, true) |
| 278 | salt.runSaltProcessStep(saltMaster, "${ctl02NodeProvider}", 'virt.undefine', ["ctl02.${domain}"], null, true) |
| 279 | salt.runSaltProcessStep(saltMaster, "${ctl03NodeProvider}", 'virt.undefine', ["ctl03.${domain}"], null, true) |
| 280 | |
Jiri Broulik | 00d0109 | 2017-06-01 19:38:15 +0200 | [diff] [blame] | 281 | salt.cmdRun(saltMaster, 'I@xtrabackup:client', "su root -c '/usr/local/bin/innobackupex-runner.sh'") |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 282 | |
| 283 | try { |
| 284 | salt.cmdRun(saltMaster, 'I@salt:master', "salt-key -d ctl01.${domain},ctl02.${domain},ctl03.${domain},prx01.${domain},prx02.${domain} -y") |
| 285 | } catch (Exception e) { |
| 286 | common.warningMsg('does not match any accepted, unaccepted or rejected keys. They were probably already removed. We should continue to run') |
| 287 | } |
| 288 | |
| 289 | // salt 'kvm*' state.sls salt.control |
| 290 | salt.enforceState(saltMaster, 'I@salt:control', 'salt.control') |
| 291 | |
Jiri Broulik | 8dabbfd | 2017-07-25 10:49:45 +0200 | [diff] [blame] | 292 | // wait until ctl and prx nodes are registered in salt-key |
| 293 | salt.minionPresent(saltMaster, 'I@salt:master', 'ctl01') |
| 294 | salt.minionPresent(saltMaster, 'I@salt:master', 'ctl02') |
| 295 | salt.minionPresent(saltMaster, 'I@salt:master', 'ctl03') |
| 296 | salt.minionPresent(saltMaster, 'I@salt:master', 'prx01') |
| 297 | salt.minionPresent(saltMaster, 'I@salt:master', 'prx02') |
| 298 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 299 | |
| 300 | // salt '*' saltutil.refresh_pillar |
| 301 | salt.runSaltProcessStep(saltMaster, '*', 'saltutil.refresh_pillar', [], null, true) |
| 302 | // salt '*' saltutil.sync_all |
| 303 | salt.runSaltProcessStep(saltMaster, '*', 'saltutil.sync_all', [], null, true) |
| 304 | |
| 305 | try { |
| 306 | salt.enforceState(saltMaster, 'ctl* or prx* or ctl*', ['linux', 'openssh', 'salt.minion', 'ntp', 'rsyslog']) |
| 307 | } catch (Exception e) { |
| 308 | common.warningMsg('Received no response because salt-minion was restarted. We should continue to run') |
| 309 | } |
| 310 | salt.enforceState(saltMaster, 'ctl* or prx* or ctl*', ['linux', 'openssh', 'salt.minion', 'ntp', 'rsyslog']) |
| 311 | |
| 312 | // salt 'ctl*' state.sls keepalived |
| 313 | // salt 'ctl*' state.sls haproxy |
| 314 | salt.enforceState(saltMaster, 'ctl*', ['keepalived', 'haproxy']) |
| 315 | // salt 'ctl*' service.restart rsyslog |
| 316 | salt.runSaltProcessStep(saltMaster, 'ctl*', 'service.restart', ['rsyslog'], null, true) |
| 317 | // salt "ctl*" state.sls memcached |
| 318 | // salt "ctl*" state.sls keystone.server |
| 319 | try { |
Jiri Broulik | 69de13a | 2017-05-18 13:53:58 +0200 | [diff] [blame] | 320 | try { |
| 321 | salt.enforceState(saltMaster, 'ctl*', ['memcached', 'keystone.server']) |
Jiri Broulik | 29cffe3 | 2017-06-12 14:15:19 +0200 | [diff] [blame] | 322 | salt.runSaltProcessStep(saltMaster, 'ctl*', 'service.restart', ['apache2'], null, true) |
Jiri Broulik | 69de13a | 2017-05-18 13:53:58 +0200 | [diff] [blame] | 323 | } catch (Exception e) { |
Jiri Broulik | 80d9675 | 2017-05-22 19:42:01 +0200 | [diff] [blame] | 324 | common.warningMsg('Restarting Apache2 and enforcing keystone.server state again') |
Jiri Broulik | 5a13a65 | 2017-05-18 14:33:32 +0200 | [diff] [blame] | 325 | salt.runSaltProcessStep(saltMaster, 'ctl*', 'service.restart', ['apache2'], null, true) |
Jiri Broulik | 69de13a | 2017-05-18 13:53:58 +0200 | [diff] [blame] | 326 | salt.enforceState(saltMaster, 'ctl*', 'keystone.server') |
| 327 | } |
| 328 | // salt 'ctl01*' state.sls keystone.client |
| 329 | try { |
| 330 | salt.enforceState(saltMaster, 'I@keystone:client and ctl*', 'keystone.client') |
| 331 | } catch (Exception e) { |
| 332 | common.warningMsg('running keystone.client state again') |
| 333 | salt.enforceState(saltMaster, 'I@keystone:client and ctl*', 'keystone.client') |
| 334 | } |
| 335 | try { |
| 336 | salt.enforceState(saltMaster, 'ctl*', 'glance') |
| 337 | } catch (Exception e) { |
| 338 | common.warningMsg('running glance state again') |
| 339 | salt.enforceState(saltMaster, 'ctl*', 'glance') |
| 340 | } // salt 'ctl*' state.sls glusterfs.client |
| 341 | salt.enforceState(saltMaster, 'ctl*', 'glusterfs.client') |
| 342 | // salt 'ctl*' state.sls keystone.server |
| 343 | salt.enforceState(saltMaster, 'ctl*', 'keystone.server') |
| 344 | // salt 'ctl*' state.sls nova |
| 345 | try { |
| 346 | salt.enforceState(saltMaster, 'ctl*', 'nova') |
| 347 | } catch (Exception e) { |
| 348 | common.warningMsg('running nova state again') |
| 349 | salt.enforceState(saltMaster, 'ctl*', 'nova') |
| 350 | } |
| 351 | // salt 'ctl*' state.sls cinder |
| 352 | try { |
| 353 | salt.enforceState(saltMaster, 'ctl*', 'cinder') |
| 354 | } catch (Exception e) { |
| 355 | common.warningMsg('running cinder state again') |
| 356 | salt.enforceState(saltMaster, 'ctl*', 'cinder') |
| 357 | } |
| 358 | try { |
| 359 | salt.enforceState(saltMaster, 'ctl*', 'neutron') |
| 360 | } catch (Exception e) { |
| 361 | common.warningMsg('running neutron state again') |
| 362 | salt.enforceState(saltMaster, 'ctl*', 'neutron') |
| 363 | } |
| 364 | // salt 'ctl*' state.sls heat |
| 365 | try { |
| 366 | salt.enforceState(saltMaster, 'ctl*', 'heat') |
| 367 | } catch (Exception e) { |
| 368 | common.warningMsg('running heat state again') |
| 369 | salt.enforceState(saltMaster, 'ctl*', 'heat') |
| 370 | } |
| 371 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 372 | } catch (Exception e) { |
Jiri Broulik | 80d9675 | 2017-05-22 19:42:01 +0200 | [diff] [blame] | 373 | errorOccured = true |
Jiri Broulik | 69de13a | 2017-05-18 13:53:58 +0200 | [diff] [blame] | 374 | common.warningMsg('Some states that require syncdb failed. Restoring production databases') |
Jiri Broulik | 00d0109 | 2017-06-01 19:38:15 +0200 | [diff] [blame] | 375 | |
| 376 | // database restore section |
| 377 | try { |
| 378 | salt.runSaltProcessStep(saltMaster, 'I@galera:slave', 'service.stop', ['mysql'], null, true) |
| 379 | } catch (Exception er) { |
| 380 | common.warningMsg('Mysql service already stopped') |
Jiri Broulik | 69de13a | 2017-05-18 13:53:58 +0200 | [diff] [blame] | 381 | } |
Jiri Broulik | 00d0109 | 2017-06-01 19:38:15 +0200 | [diff] [blame] | 382 | try { |
| 383 | salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'service.stop', ['mysql'], null, true) |
| 384 | } catch (Exception er) { |
| 385 | common.warningMsg('Mysql service already stopped') |
| 386 | } |
| 387 | try { |
| 388 | salt.cmdRun(saltMaster, 'I@galera:slave', "rm /var/lib/mysql/ib_logfile*") |
| 389 | } catch (Exception er) { |
| 390 | common.warningMsg('Files are not present') |
| 391 | } |
| 392 | try { |
| 393 | salt.cmdRun(saltMaster, 'I@galera:master', "mkdir /root/mysql/mysql.bak") |
| 394 | } catch (Exception er) { |
| 395 | common.warningMsg('Directory already exists') |
| 396 | } |
| 397 | try { |
| 398 | salt.cmdRun(saltMaster, 'I@galera:master', "rm -rf /root/mysql/mysql.bak/*") |
| 399 | } catch (Exception er) { |
| 400 | common.warningMsg('Directory already empty') |
| 401 | } |
| 402 | try { |
| 403 | salt.cmdRun(saltMaster, 'I@galera:master', "mv /var/lib/mysql/* /root/mysql/mysql.bak") |
| 404 | } catch (Exception er) { |
| 405 | common.warningMsg('Files were already moved') |
| 406 | } |
| 407 | try { |
| 408 | salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'file.remove', ["/var/lib/mysql/.galera_bootstrap"], null, true) |
| 409 | } catch (Exception er) { |
| 410 | common.warningMsg('File is not present') |
| 411 | } |
| 412 | salt.cmdRun(saltMaster, 'I@galera:master', "sed -i '/gcomm/c\\wsrep_cluster_address=\"gcomm://\"' /etc/mysql/my.cnf") |
| 413 | _pillar = salt.getPillar(saltMaster, "I@galera:master", 'xtrabackup:client:backup_dir') |
| 414 | backup_dir = _pillar['return'][0].values()[0] |
| 415 | if(backup_dir == null || backup_dir.isEmpty()) { backup_dir='/var/backups/mysql/xtrabackup' } |
| 416 | print(backup_dir) |
| 417 | salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'file.remove', ["${backup_dir}/dbrestored"], null, true) |
| 418 | salt.cmdRun(saltMaster, 'I@xtrabackup:client', "su root -c 'salt-call state.sls xtrabackup'") |
| 419 | salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'service.start', ['mysql'], null, true) |
Jiri Broulik | 8dabbfd | 2017-07-25 10:49:45 +0200 | [diff] [blame] | 420 | |
| 421 | // wait until mysql service on galera master is up |
| 422 | salt.commandStatus(saltMaster, 'I@galera:master', 'service mysql status', 'running') |
| 423 | |
Jiri Broulik | 00d0109 | 2017-06-01 19:38:15 +0200 | [diff] [blame] | 424 | salt.runSaltProcessStep(saltMaster, 'I@galera:slave', 'service.start', ['mysql'], null, true) |
| 425 | // |
| 426 | |
Jiri Broulik | 5a13a65 | 2017-05-18 14:33:32 +0200 | [diff] [blame] | 427 | common.errorMsg("Stage Real control upgrade failed") |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 428 | } |
Jiri Broulik | 80d9675 | 2017-05-22 19:42:01 +0200 | [diff] [blame] | 429 | if(!errorOccured){ |
Jiri Broulik | 52a6b83 | 2017-06-16 13:05:08 +0200 | [diff] [blame] | 430 | |
| 431 | ceph = null |
| 432 | |
| 433 | try { |
| 434 | ceph = salt.cmdRun(saltMaster, 'ctl*', "salt-call grains.item roles | grep ceph.client") |
| 435 | |
| 436 | } catch (Exception er) { |
| 437 | common.infoMsg("Ceph is not used") |
| 438 | } |
| 439 | |
| 440 | if(ceph != null) { |
| 441 | try { |
| 442 | salt.enforceState(saltMaster, 'ctl*', 'ceph.client') |
| 443 | } catch (Exception er) { |
| 444 | common.warningMsg("Ceph client state on controllers failed. Please fix it manually") |
| 445 | } |
| 446 | } |
| 447 | |
Jiri Broulik | 80d9675 | 2017-05-22 19:42:01 +0200 | [diff] [blame] | 448 | // salt 'cmp*' cmd.run 'service nova-compute restart' |
| 449 | salt.runSaltProcessStep(saltMaster, 'cmp*', 'service.restart', ['nova-compute'], null, true) |
Jiri Broulik | f20c767 | 2017-06-19 21:20:52 +0200 | [diff] [blame] | 450 | salt.runSaltProcessStep(saltMaster, 'ctl*', 'service.restart', ['nova-conductor'], null, true) |
| 451 | salt.runSaltProcessStep(saltMaster, 'ctl*', 'service.restart', ['nova-scheduler'], null, true) |
| 452 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 453 | |
Jiri Broulik | 00d0109 | 2017-06-01 19:38:15 +0200 | [diff] [blame] | 454 | // salt 'prx*' state.sls linux,openssh,salt.minion,ntp,rsyslog |
Jiri Broulik | 80d9675 | 2017-05-22 19:42:01 +0200 | [diff] [blame] | 455 | // salt 'ctl*' state.sls keepalived |
| 456 | // salt 'prx*' state.sls keepalived |
| 457 | salt.enforceState(saltMaster, 'prx*', 'keepalived') |
| 458 | // salt 'prx*' state.sls horizon |
| 459 | salt.enforceState(saltMaster, 'prx*', 'horizon') |
| 460 | // salt 'prx*' state.sls nginx |
| 461 | salt.enforceState(saltMaster, 'prx*', 'nginx') |
Tatyana Leontovich | 09616cd | 2017-07-10 14:19:46 +0300 | [diff] [blame] | 462 | // salt "prx*" state.sls memcached |
| 463 | salt.enforceState(saltMaster, 'prx*', 'memcached') |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 464 | |
Jiri Broulik | 4df0c1f | 2017-06-23 11:29:29 +0200 | [diff] [blame] | 465 | try { |
| 466 | salt.enforceHighstate(saltMaster, 'ctl*') |
| 467 | } catch (Exception er) { |
| 468 | common.errorMsg("Highstate was executed on controller nodes but something failed. Please check it and fix it accordingly.") |
| 469 | } |
| 470 | |
| 471 | try { |
| 472 | salt.enforceHighstate(saltMaster, 'prx*') |
| 473 | } catch (Exception er) { |
| 474 | common.errorMsg("Highstate was executed on proxy nodes but something failed. Please check it and fix it accordingly.") |
| 475 | } |
| 476 | |
Jiri Broulik | 80d9675 | 2017-05-22 19:42:01 +0200 | [diff] [blame] | 477 | salt.cmdRun(saltMaster, 'ctl01*', '. /root/keystonercv3; openstack service list; openstack image list; openstack flavor list; openstack compute service list; openstack server list; openstack network list; openstack volume list; openstack orchestration service list') |
| 478 | } |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 479 | } |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 480 | |
Jiri Broulik | 08229c8 | 2017-05-22 23:35:32 +0200 | [diff] [blame] | 481 | if (STAGE_REAL_UPGRADE.toBoolean() == true && STAGE_ROLLBACK_UPGRADE.toBoolean() == true) { |
| 482 | stage('Ask for manual confirmation') { |
| 483 | input message: "Please verify if the control upgrade was successful. If it did not succeed, in the worst scenario, you can click YES to continue with control-upgrade-rollback. Do you want to continue with the rollback?" |
| 484 | } |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 485 | } |
| 486 | } |
| 487 | |
| 488 | if (STAGE_ROLLBACK_UPGRADE.toBoolean() == true) { |
| 489 | stage('Rollback upgrade') { |
| 490 | |
Jiri Broulik | 08229c8 | 2017-05-22 23:35:32 +0200 | [diff] [blame] | 491 | stage('Ask for manual confirmation') { |
| 492 | input message: "Do you really want to continue with the rollback?" |
| 493 | } |
| 494 | |
Jiri Broulik | e2f1e4a | 2017-05-17 23:59:52 +0200 | [diff] [blame] | 495 | _pillar = salt.getGrain(saltMaster, 'I@salt:master', 'domain') |
| 496 | domain = _pillar['return'][0].values()[0].values()[0] |
| 497 | print(_pillar) |
| 498 | print(domain) |
| 499 | |
Jiri Broulik | d98364e | 2017-05-18 15:30:04 +0200 | [diff] [blame] | 500 | _pillar = salt.getGrain(saltMaster, 'I@salt:control', 'id') |
| 501 | kvm01 = _pillar['return'][0].values()[0].values()[0] |
Jiri Broulik | d98364e | 2017-05-18 15:30:04 +0200 | [diff] [blame] | 502 | print(_pillar) |
| 503 | print(kvm01) |
Jiri Broulik | d98364e | 2017-05-18 15:30:04 +0200 | [diff] [blame] | 504 | |
| 505 | _pillar = salt.getPillar(saltMaster, "${kvm01}", 'salt:control:cluster:internal:node:ctl01:provider') |
| 506 | def ctl01NodeProvider = _pillar['return'][0].values()[0] |
| 507 | |
| 508 | _pillar = salt.getPillar(saltMaster, "${kvm01}", 'salt:control:cluster:internal:node:ctl02:provider') |
| 509 | def ctl02NodeProvider = _pillar['return'][0].values()[0] |
| 510 | |
| 511 | _pillar = salt.getPillar(saltMaster, "${kvm01}", 'salt:control:cluster:internal:node:ctl03:provider') |
| 512 | def ctl03NodeProvider = _pillar['return'][0].values()[0] |
| 513 | |
| 514 | _pillar = salt.getPillar(saltMaster, "${kvm01}", 'salt:control:cluster:internal:node:prx01:provider') |
| 515 | def prx01NodeProvider = _pillar['return'][0].values()[0] |
| 516 | |
| 517 | _pillar = salt.getPillar(saltMaster, "${kvm01}", 'salt:control:cluster:internal:node:prx02:provider') |
| 518 | def prx02NodeProvider = _pillar['return'][0].values()[0] |
| 519 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 520 | salt.runSaltProcessStep(saltMaster, "${prx01NodeProvider}", 'virt.destroy', ["prx01.${domain}"], null, true) |
| 521 | salt.runSaltProcessStep(saltMaster, "${prx02NodeProvider}", 'virt.destroy', ["prx02.${domain}"], null, true) |
| 522 | salt.runSaltProcessStep(saltMaster, "${ctl01NodeProvider}", 'virt.destroy', ["ctl01.${domain}"], null, true) |
| 523 | salt.runSaltProcessStep(saltMaster, "${ctl02NodeProvider}", 'virt.destroy', ["ctl02.${domain}"], null, true) |
| 524 | salt.runSaltProcessStep(saltMaster, "${ctl03NodeProvider}", 'virt.destroy', ["ctl03.${domain}"], null, true) |
| 525 | |
| 526 | salt.runSaltProcessStep(saltMaster, "${prx01NodeProvider}", 'file.copy', ["/root/prx01.${domain}.qcow2.bak", "/var/lib/libvirt/images/prx01.${domain}/system.qcow2"], null, true) |
| 527 | salt.runSaltProcessStep(saltMaster, "${prx02NodeProvider}", 'file.copy', ["/root/prx02.${domain}.qcow2.bak", "/var/lib/libvirt/images/prx02.${domain}/system.qcow2"], null, true) |
| 528 | salt.runSaltProcessStep(saltMaster, "${ctl01NodeProvider}", 'file.copy', ["/root/ctl01.${domain}.qcow2.bak", "/var/lib/libvirt/images/ctl01.${domain}/system.qcow2"], null, true) |
| 529 | salt.runSaltProcessStep(saltMaster, "${ctl02NodeProvider}", 'file.copy', ["/root/ctl02.${domain}.qcow2.bak", "/var/lib/libvirt/images/ctl02.${domain}/system.qcow2"], null, true) |
| 530 | salt.runSaltProcessStep(saltMaster, "${ctl03NodeProvider}", 'file.copy', ["/root/ctl03.${domain}.qcow2.bak", "/var/lib/libvirt/images/ctl03.${domain}/system.qcow2"], null, true) |
| 531 | |
| 532 | try { |
| 533 | salt.cmdRun(saltMaster, 'I@salt:master', "salt-key -d ctl01.${domain},ctl02.${domain},ctl03.${domain},prx01.${domain},prx02.${domain} -y") |
| 534 | } catch (Exception e) { |
| 535 | common.warningMsg('does not match any accepted, unaccepted or rejected keys. They were probably already removed. We should continue to run') |
| 536 | } |
| 537 | |
Jiri Broulik | 00d0109 | 2017-06-01 19:38:15 +0200 | [diff] [blame] | 538 | // database restore section |
| 539 | try { |
| 540 | salt.runSaltProcessStep(saltMaster, 'I@galera:slave', 'service.stop', ['mysql'], null, true) |
| 541 | } catch (Exception e) { |
| 542 | common.warningMsg('Mysql service already stopped') |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 543 | } |
Jiri Broulik | 00d0109 | 2017-06-01 19:38:15 +0200 | [diff] [blame] | 544 | try { |
| 545 | salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'service.stop', ['mysql'], null, true) |
| 546 | } catch (Exception e) { |
| 547 | common.warningMsg('Mysql service already stopped') |
| 548 | } |
| 549 | try { |
| 550 | salt.cmdRun(saltMaster, 'I@galera:slave', "rm /var/lib/mysql/ib_logfile*") |
| 551 | } catch (Exception e) { |
| 552 | common.warningMsg('Files are not present') |
| 553 | } |
| 554 | try { |
| 555 | salt.cmdRun(saltMaster, 'I@galera:master', "rm -rf /var/lib/mysql/*") |
| 556 | } catch (Exception e) { |
| 557 | common.warningMsg('Directory already empty') |
| 558 | } |
| 559 | try { |
| 560 | salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'file.remove', ["/var/lib/mysql/.galera_bootstrap"], null, true) |
| 561 | } catch (Exception e) { |
| 562 | common.warningMsg('File is not present') |
| 563 | } |
| 564 | salt.cmdRun(saltMaster, 'I@galera:master', "sed -i '/gcomm/c\\wsrep_cluster_address=\"gcomm://\"' /etc/mysql/my.cnf") |
| 565 | _pillar = salt.getPillar(saltMaster, "I@galera:master", 'xtrabackup:client:backup_dir') |
| 566 | backup_dir = _pillar['return'][0].values()[0] |
| 567 | if(backup_dir == null || backup_dir.isEmpty()) { backup_dir='/var/backups/mysql/xtrabackup' } |
| 568 | print(backup_dir) |
| 569 | salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'file.remove', ["${backup_dir}/dbrestored"], null, true) |
| 570 | salt.cmdRun(saltMaster, 'I@xtrabackup:client', "su root -c 'salt-call state.sls xtrabackup'") |
| 571 | salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'service.start', ['mysql'], null, true) |
Jiri Broulik | 8dabbfd | 2017-07-25 10:49:45 +0200 | [diff] [blame] | 572 | |
| 573 | // wait until mysql service on galera master is up |
| 574 | salt.commandStatus(saltMaster, 'I@galera:master', 'service mysql status', 'running') |
| 575 | |
Jiri Broulik | 00d0109 | 2017-06-01 19:38:15 +0200 | [diff] [blame] | 576 | salt.runSaltProcessStep(saltMaster, 'I@galera:slave', 'service.start', ['mysql'], null, true) |
| 577 | // |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 578 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 579 | salt.runSaltProcessStep(saltMaster, "${prx01NodeProvider}", 'virt.start', ["prx01.${domain}"], null, true) |
| 580 | salt.runSaltProcessStep(saltMaster, "${prx02NodeProvider}", 'virt.start', ["prx02.${domain}"], null, true) |
| 581 | salt.runSaltProcessStep(saltMaster, "${ctl01NodeProvider}", 'virt.start', ["ctl01.${domain}"], null, true) |
| 582 | salt.runSaltProcessStep(saltMaster, "${ctl02NodeProvider}", 'virt.start', ["ctl02.${domain}"], null, true) |
| 583 | salt.runSaltProcessStep(saltMaster, "${ctl03NodeProvider}", 'virt.start', ["ctl03.${domain}"], null, true) |
| 584 | |
| 585 | // salt 'cmp*' cmd.run 'service nova-compute restart' |
| 586 | salt.runSaltProcessStep(saltMaster, 'cmp*', 'service.restart', ['nova-compute'], null, true) |
| 587 | |
Jiri Broulik | 8dabbfd | 2017-07-25 10:49:45 +0200 | [diff] [blame] | 588 | // wait until ctl and prx nodes are registered in salt-key |
| 589 | salt.minionPresent(saltMaster, 'I@salt:master', 'ctl01') |
| 590 | salt.minionPresent(saltMaster, 'I@salt:master', 'ctl02') |
| 591 | salt.minionPresent(saltMaster, 'I@salt:master', 'ctl03') |
| 592 | salt.minionPresent(saltMaster, 'I@salt:master', 'prx01') |
| 593 | salt.minionPresent(saltMaster, 'I@salt:master', 'prx02') |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 594 | |
Jiri Broulik | f20c767 | 2017-06-19 21:20:52 +0200 | [diff] [blame] | 595 | salt.runSaltProcessStep(saltMaster, 'ctl*', 'service.restart', ['nova-conductor'], null, true) |
| 596 | salt.runSaltProcessStep(saltMaster, 'ctl*', 'service.restart', ['nova-scheduler'], null, true) |
| 597 | |
Jiri Broulik | 3792c96 | 2017-05-17 18:26:36 +0200 | [diff] [blame] | 598 | salt.cmdRun(saltMaster, 'ctl01*', '. /root/keystonerc; nova service-list; glance image-list; nova flavor-list; nova hypervisor-list; nova list; neutron net-list; cinder list; heat service-list') |
| 599 | } |
Jiri Broulik | 6fc9d3f | 2017-05-12 07:11:29 +0200 | [diff] [blame] | 600 | } |
Jiri Broulik | bb447ac | 2017-05-04 15:36:22 +0200 | [diff] [blame] | 601 | } |
| 602 | } |