blob: 01fa7bb99a475a7a6e84deaad1d215c418b9c2b4 [file] [log] [blame]
Hanna Arhipova71ecc272019-08-20 14:54:22 +03001import pytest
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +03002import sys
3import os
Hanna Arhipova71ecc272019-08-20 14:54:22 +03004
5from tcp_tests import logger
6from tcp_tests import settings
Hanna Arhipova71ecc272019-08-20 14:54:22 +03007
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +03008sys.path.append(os.getcwd())
9try:
10 from tcp_tests.fixtures import config_fixtures
11 from tcp_tests.managers import underlay_ssh_manager
12 from tcp_tests.managers import saltmanager as salt_manager
13except ImportError:
14 print("ImportError: Run the application from the tcp-qa directory or "
15 "set the PYTHONPATH environment variable to directory which contains"
16 " ./tcp_tests")
17 sys.exit(1)
Hanna Arhipova71ecc272019-08-20 14:54:22 +030018LOG = logger.logger
19
20
Hanna Arhipovad35a29b2019-09-04 13:24:06 +030021def has_only_similar(values_by_nodes):
22 """
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030023 :param values_by_nodes: dict
Hanna Arhipovad35a29b2019-09-04 13:24:06 +030024 :return: bool, True if all items in the dict have similar values
25 """
26 values = list(values_by_nodes.values())
27 return all(value == values[0] for value in values)
28
29
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030030def get_control_plane_targets():
31 config = config_fixtures.config()
32 underlay = underlay_ssh_manager.UnderlaySSHManager(config)
33 saltmanager = salt_manager.SaltManager(config, underlay)
Hanna Arhipovafbcea852019-10-03 13:24:53 +030034 targets = list()
Hanna Arhipova52bb17d2019-10-28 19:15:17 +020035 telemetry_exists = False
36 barbican_exists = False
Hanna Arhipovafbcea852019-10-03 13:24:53 +030037 try:
38 targets += saltmanager.run_state(
39 "I@keystone:server", 'test.ping')[0]['return'][0].keys()
40 targets += saltmanager.run_state(
41 "I@nginx:server and not I@salt:master",
42 "test.ping")[0]['return'][0].keys()
Hanna Arhipova4462dd02019-10-28 19:05:08 +020043 telemetry_exists = saltmanager.get_single_pillar(
44 "I@salt:master",
45 "_param:openstack_telemetry_hostname")
46 barbican_exists = saltmanager.get_single_pillar(
47 "I@salt:master",
48 "_param:barbican_enabled")
Hanna Arhipovafbcea852019-10-03 13:24:53 +030049 except BaseException as err:
50 LOG.warning("Can't retrieve data from Salt. \
51 Maybe cluster is not deployed completely.\
52 Err: {}".format(err))
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030053
Hanna Arhipova75f21bb2019-10-07 19:22:15 +030054 # check for Manila existence
55 # if saltmanager.get_single_pillar("I@salt:master",
56 # "_param:manila_service_protocol"):
57 # targets.append('share*')
58
59 # check for Tenant Telemetry existence
Hanna Arhipova4462dd02019-10-28 19:05:08 +020060 if telemetry_exists:
Hanna Arhipova75f21bb2019-10-07 19:22:15 +030061 targets.append('mdb*')
62
63 # check for Barbican existence
Hanna Arhipova4462dd02019-10-28 19:05:08 +020064 if barbican_exists:
Hanna Arhipova75f21bb2019-10-07 19:22:15 +030065 targets.append('kmn*')
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030066 return targets
67
68
Hanna Arhipova19429962019-10-17 15:16:49 +030069@pytest.fixture(scope='class')
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030070def switch_to_proposed_pipelines(reclass_actions, salt_actions):
Hanna Arhipova19429962019-10-17 15:16:49 +030071 reclass = reclass_actions
72 proposed_repo = "http://mirror.mirantis.com/update/proposed/"
73 repo_param = "parameters._param.linux_system_repo_update_url"
Hanna Arhipova7cfeb072019-10-11 15:04:10 +030074
Hanna Arhipova19429962019-10-17 15:16:49 +030075 proposed_pipeline_branch = "release/proposed/2019.2.0"
76 pipeline_branch_param = "parameters._param.jenkins_pipelines_branch"
77 infra_yml = "cluster/*/infra/init.yml"
78
79 LOG.info("Check reclass has release/proposed/2019.2.0 branches")
80 if reclass.get_key(pipeline_branch_param,
81 infra_yml) == proposed_pipeline_branch \
82 and reclass.get_key(repo_param, infra_yml) == proposed_repo:
83 return True
84
85 LOG.info("Switch to release/proposed/2019.2.0 branches")
86 reclass.add_key(pipeline_branch_param, proposed_pipeline_branch, infra_yml)
87
88 reclass.add_key(repo_param, proposed_repo, infra_yml)
89 reclass.add_key(repo_param, proposed_repo, "cluster/*/openstack/init.yml")
90 reclass.add_key(repo_param, proposed_repo, "cluster/*/stacklight/init.yml")
91 reclass.add_key(repo_param, proposed_repo, "cluster/*/ceph/init.yml")
Hanna Arhipova7cfeb072019-10-11 15:04:10 +030092
93 salt_actions.run_state("*", "saltutil.refresh_pillar")
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +030094 salt_actions.enforce_state("I@jenkins:client", "jenkins.client")
95
96
Hanna Arhipova19429962019-10-17 15:16:49 +030097@pytest.fixture(scope='class')
98def enable_openstack_update(reclass_actions, salt_actions):
99 param = "parameters._param.openstack_upgrade_enabled"
100 context_file = "cluster/*/infra/init.yml"
101
102 LOG.info("Enable openstack_upgrade_enabled in reclass")
103 reclass_actions.add_bool_key(param, "True", context_file)
104 salt_actions.run_state("*", "saltutil.refresh_pillar")
105 yield True
106 LOG.info("Disable openstack_upgrade_enabled in reclass")
107 reclass_actions.add_bool_key(param, "False", context_file)
108 salt_actions.run_state("*", "saltutil.refresh_pillar")
109
110
111@pytest.mark.usefixtures("switch_to_proposed_pipelines")
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300112class TestUpdateMcpCluster(object):
113 """
114 Following the steps in
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300115 https://docs.mirantis.com/mcp/master/mcp-operations-guide/update-upgrade/minor-update.html#minor-update
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300116 """
117
118 @pytest.mark.grab_versions
119 @pytest.mark.parametrize("_", [settings.ENV_NAME])
120 @pytest.mark.run_mcp_update
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300121 def test_update_drivetrain(self, salt_actions, drivetrain_actions,
Hanna Arhipova19429962019-10-17 15:16:49 +0300122 show_step, _):
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300123 """Updating DriveTrain component to release/proposed/2019.2.0 version
124
125 Scenario:
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300126 1. Add workaround for PROD-32751
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300127 2. Run job git-mirror-downstream-mk-pipelines
128 3. Run job git-mirror-downstream-pipeline-library
129 4. If jobs are passed then start 'Deploy - upgrade MCP Drivetrain'
130
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300131 Duration: ~70 min
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300132 """
133 salt = salt_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300134 dt = drivetrain_actions
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300135
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300136 # #################### Add workaround for PROD-32751 #################
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300137 show_step(1)
138
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300139 # FIXME: workaround for PROD-32751
140 salt.cmd_run("cfg01*", "cd /srv/salt/reclass; git add -u && \
141 git commit --allow-empty -m 'Cluster model update'")
142
143 # ################### Downstream mk-pipelines #########################
144 show_step(2)
145 job_name = 'git-mirror-downstream-mk-pipelines'
146 job_parameters = {
147 'BRANCHES': 'release/proposed/2019.2.0'
148 }
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300149 update_pipelines = dt.start_job_on_cid_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300150 job_name=job_name,
151 job_parameters=job_parameters)
152
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300153 assert update_pipelines == 'SUCCESS'
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300154
155 # ################### Downstream pipeline-library ####################
156 show_step(3)
157 job_name = 'git-mirror-downstream-pipeline-library'
158 job_parameters = {
159 'BRANCHES': 'release/proposed/2019.2.0'
160 }
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300161 update_pipeline_library = dt.start_job_on_cid_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300162 job_name=job_name,
163 job_parameters=job_parameters)
164
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300165 assert update_pipeline_library == 'SUCCESS'
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300166
167 # ################### Start 'Deploy - upgrade MCP Drivetrain' job #####
168 show_step(4)
169
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300170 job_name = 'upgrade-mcp-release'
171 job_parameters = {
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300172 'GIT_REFSPEC': 'release/proposed/2019.2.0',
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300173 'MK_PIPELINES_REFSPEC': 'release/proposed/2019.2.0',
174 'TARGET_MCP_VERSION': '2019.2.0'
175 }
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300176 update_drivetrain = dt.start_job_on_cid_jenkins(
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300177 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300178 job_parameters=job_parameters,
Hanna Arhipova19429962019-10-17 15:16:49 +0300179 build_timeout=90 * 60)
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300180
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300181 assert update_drivetrain == 'SUCCESS'
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300182
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300183 @pytest.mark.grab_versions
184 @pytest.mark.parametrize("_", [settings.ENV_NAME])
Hanna Arhipova71ecc272019-08-20 14:54:22 +0300185 @pytest.mark.run_mcp_update
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300186 def test_update_glusterfs(self, salt_actions, reclass_actions,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300187 drivetrain_actions, show_step, _):
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300188 """ Upgrade GlusterFS
189 Scenario:
190 1. In infra/init.yml in Reclass, add the glusterfs_version parameter
191 2. Start linux.system.repo state
192 3. Start "update-glusterfs" job
193 4. Check version for GlusterFS servers
194 5. Check version for GlusterFS clients
195
196 """
197 salt = salt_actions
198 reclass = reclass_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300199 dt = drivetrain_actions
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300200
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300201 # ############## Change reclass ######################################
202 show_step(1)
203 reclass.add_key(
204 "parameters._param.linux_system_repo_mcp_glusterfs_version_number",
205 "5",
206 "cluster/*/infra/init.yml"
207 )
208 # ################# Run linux.system state ###########################
209 show_step(2)
210 salt.enforce_state("*", "linux.system.repo")
211
212 # ############## Start deploy-upgrade-galera job #####################
213 show_step(3)
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300214 job_name = 'update-glusterfs'
215
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300216 update_glusterfs = dt.start_job_on_cid_jenkins(
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300217 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300218 build_timeout=40 * 60)
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300219
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300220 assert update_glusterfs == 'SUCCESS'
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300221
222 # ################ Check GlusterFS version for servers ##############
223 show_step(4)
224 gluster_server_versions_by_nodes = salt.cmd_run(
225 "I@glusterfs:server",
226 "glusterd --version|head -n1")[0]
227
Hanna Arhipova19429962019-10-17 15:16:49 +0300228 assert has_only_similar(gluster_server_versions_by_nodes), \
Hanna Arhipovacc3759b2019-08-28 16:01:11 +0300229 gluster_server_versions_by_nodes
230
231 # ################ Check GlusterFS version for clients ##############
232 show_step(5)
233 gluster_client_versions_by_nodes = salt.cmd_run(
234 "I@glusterfs:client",
235 "glusterfs --version|head -n1")[0]
236
237 assert has_only_similar(gluster_client_versions_by_nodes), \
238 gluster_client_versions_by_nodes
239
240 @pytest.mark.grab_versions
241 @pytest.mark.parametrize("_", [settings.ENV_NAME])
242 @pytest.mark.run_mcp_update
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300243 def test_update_galera(self, salt_actions, reclass_actions,
244 drivetrain_actions, show_step, _):
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300245 """ Upgrade Galera automatically
246
247 Scenario:
248 1. Include the Galera upgrade pipeline job to DriveTrain
249 2. Apply the jenkins.client state on the Jenkins nodes
250 3. set the openstack_upgrade_enabled parameter to true
251 4. Refresh pillars
252 5. Add repositories with new Galera packages
253 6. Start job from Jenkins
254 """
255 salt = salt_actions
256 reclass = reclass_actions
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300257 dt = drivetrain_actions
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300258 # ################### Enable pipeline #################################
259 show_step(1)
260 reclass.add_class(
261 "system.jenkins.client.job.deploy.update.upgrade_galera",
262 "cluster/*/cicd/control/leader.yml")
263 show_step(2)
264 salt.enforce_state("I@jenkins:client", "jenkins.client")
265
266 # ############### Enable automatic upgrade ############################
267 show_step(3)
268 reclass.add_bool_key("parameters._param.openstack_upgrade_enabled",
269 "True",
270 "cluster/*/infra/init.yml")
271
272 show_step(4)
Hanna Arhipova7cfeb072019-10-11 15:04:10 +0300273 salt.run_state("dbs*", "saltutil.refresh_pillar")
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300274
275 # ############# Add repositories with new Galera packages #######
276 show_step(5)
277 salt.enforce_state("dbs*", "linux.system.repo")
278 salt.enforce_state("cfg*", "salt.master")
279
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300280 # #################### Login Jenkins on cid01 node ###################
281 show_step(6)
282
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300283 job_name = 'deploy-upgrade-galera'
284 job_parameters = {
285 'INTERACTIVE': 'false'
286 }
287
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300288 update_galera = dt.start_job_on_cid_jenkins(
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300289 job_name=job_name,
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300290 job_parameters=job_parameters,
291 build_timeout=40 * 60)
Hanna Arhipova94a8abe2019-08-22 14:11:46 +0300292
Hanna Arhipova17b2c102019-09-06 16:44:17 +0300293 assert update_galera == 'SUCCESS'
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300294
295 @pytest.fixture
296 def disable_automatic_failover_neutron_for_test(self, salt_actions):
297 """
298 On each OpenStack controller node, modify the neutron.conf file
299 Restart the neutron-server service
300 """
Hanna Arhipova19429962019-10-17 15:16:49 +0300301
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300302 def comment_line(node, file_name, word):
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300303 """
304 Adds '#' before the specific line in specific file
305
306 :param node: string, salt target of node where the file locates
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300307 :param file_name: string, full path to the file
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300308 :param word: string, the begin of line which should be commented
309 :return: None
310 """
311 salt_actions.cmd_run(node,
312 "sed -i 's/^{word}/#{word}/' {file}".
313 format(word=word,
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300314 file=file_name))
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300315
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300316 def add_line(node, file_name, line):
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300317 """
318 Appends line to the end of file
319
320 :param node: string, salt target of node where the file locates
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300321 :param file_name: string, full path to the file
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300322 :param line: string, line that should be added
323 :return: None
324 """
325 salt_actions.cmd_run(node, "echo {line} >> {file}".format(
Hanna Arhipova19429962019-10-17 15:16:49 +0300326 line=line,
327 file=file_name))
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300328
329 neutron_conf = '/etc/neutron/neutron.conf'
330 neutron_server = "I@neutron:server"
331 # ######## Create backup for config file #######################
332 salt_actions.cmd_run(
333 neutron_server,
334 "cp -p {file} {file}.backup".format(file=neutron_conf))
335
336 # ## Change parameters in neutron.conf'
337 comment_line(neutron_server, neutron_conf,
Hanna Arhipova19429962019-10-17 15:16:49 +0300338 "allow_automatic_l3agent_failover", )
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300339 comment_line(neutron_server, neutron_conf,
340 "allow_automatic_dhcp_failover")
341 add_line(neutron_server, neutron_conf,
342 "allow_automatic_dhcp_failover = false")
343 add_line(neutron_server, neutron_conf,
344 "allow_automatic_l3agent_failover = false")
345
346 # ## Apply changed config to the neutron-server service
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300347 result = salt_actions.cmd_run(neutron_server,
348 "service neutron-server restart")
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300349 # TODO: add check that neutron-server is up and running
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300350 yield result
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300351 # ## Revert file changes
352 salt_actions.cmd_run(
353 neutron_server,
354 "cp -p {file}.backup {file}".format(file=neutron_conf))
355 salt_actions.cmd_run(neutron_server,
356 "service neutron-server restart")
357
358 @pytest.fixture
359 def disable_neutron_agents_for_test(self, salt_actions):
360 """
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300361 Disable the neutron services before the test and
362 enable it after test
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300363 """
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300364 result = salt_actions.cmd_run("I@neutron:server", """
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300365 service neutron-dhcp-agent stop && \
366 service neutron-l3-agent stop && \
367 service neutron-metadata-agent stop && \
368 service neutron-openvswitch-agent stop
369 """)
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300370 yield result
371 #
Hanna Arhipova1fcaf442019-09-06 15:30:45 +0300372 salt_actions.cmd_run("I@neutron:server", """
373 service neutron-dhcp-agent start && \
374 service neutron-l3-agent start && \
375 service neutron-metadata-agent start && \
376 service neutron-openvswitch-agent start
377 """)
378 # TODO: add check that all services are UP and running
379
380 @pytest.mark.grab_versions
381 @pytest.mark.parametrize("_", [settings.ENV_NAME])
382 @pytest.mark.run_mcp_update
383 def test_update_rabbit(self, salt_actions, reclass_actions,
384 drivetrain_actions, show_step, _,
385 disable_automatic_failover_neutron_for_test,
386 disable_neutron_agents_for_test):
387 """ Updates RabbitMQ
388 Scenario:
389 1. Include the RabbitMQ upgrade pipeline job to DriveTrain
390 2. Add repositories with new RabbitMQ packages
391 3. Start Deploy - upgrade RabbitMQ pipeline
392
393 Updating RabbitMq should be completed before the OpenStack updating
394 process starts
395 """
396 salt = salt_actions
397 reclass = reclass_actions
398 dt = drivetrain_actions
399
400 # ####### Include the RabbitMQ upgrade pipeline job to DriveTrain ####
401 show_step(1)
402 reclass.add_class(
403 "system.jenkins.client.job.deploy.update.upgrade_rabbitmq",
404 "cluster/*/cicd/control/leader.yml")
405 salt.enforce_state("I@jenkins:client", "jenkins.client")
406
407 reclass.add_bool_key("parameters._param.openstack_upgrade_enabled",
408 "True",
409 "cluster/*/infra/init.yml")
410 salt.run_state("I@rabbitmq:server", "saltutil.refresh_pillar")
411
412 # ########### Add repositories with new RabbitMQ packages ############
413 show_step(2)
414 salt.enforce_state("I@rabbitmq:server", "linux.system.repo")
415
416 # ########### Start Deploy - upgrade RabbitMQ pipeline ############
417 show_step(3)
418 job_parameters = {
419 'INTERACTIVE': 'false'
420 }
421
422 update_rabbit = dt.start_job_on_cid_jenkins(
423 job_name='deploy-upgrade-rabbitmq',
424 job_parameters=job_parameters,
425 build_timeout=40 * 60
426 )
427 assert update_rabbit == 'SUCCESS'
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300428
429 @pytest.mark.grab_versions
430 @pytest.mark.parametrize("_", [settings.ENV_NAME])
431 @pytest.mark.run_mcp_update
432 def test_update_ceph(self, salt_actions, drivetrain_actions, show_step, _):
433 """ Updates Ceph to the latest minor version
434
435 Scenario:
436 1. Add workaround for unhealth Ceph
437 2. Start ceph-upgrade job with default parameters
438 3. Check Ceph version for all nodes
439
440 https://docs.mirantis.com/mcp/master/mcp-operations-guide/update-upgrade/minor-update/ceph-update.html
441 """
442 salt = salt_actions
443 dt = drivetrain_actions
444
445 # ###################### Add workaround for unhealth Ceph ############
446 show_step(1)
447 salt.cmd_run("I@ceph:radosgw",
448 "ceph config set 'mon pg warn max object skew' 20")
449 # ###################### Start ceph-upgrade pipeline #################
450 show_step(2)
451 job_parameters = {}
452
453 update_ceph = dt.start_job_on_cid_jenkins(
454 job_name='ceph-update',
455 job_parameters=job_parameters)
456
457 assert update_ceph == 'SUCCESS'
458
459 # ########## Verify Ceph version #####################################
460 show_step(3)
461
462 ceph_version_by_nodes = salt.cmd_run(
Hanna Arhipova19429962019-10-17 15:16:49 +0300463 "I@ceph:* and not I@ceph:monitoring and not I@ceph:backup:server",
464 "ceph version")[0]
Hanna Arhipovad35a29b2019-09-04 13:24:06 +0300465
466 assert has_only_similar(ceph_version_by_nodes), ceph_version_by_nodes
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300467
Hanna Arhipovaac008562019-10-17 11:54:23 +0300468 @pytest.mark.grab_versions
469 @pytest.mark.parametrize("_", [settings.ENV_NAME])
470 @pytest.mark.run_mcp_update
471 def test_update_stacklight(self, _, drivetrain_actions):
472 """ Update packages for Stacklight
473 Scenario:
474 1. Start Deploy - upgrade Stacklight job
475 """
476 drivetrain = drivetrain_actions
477
478 job_parameters = {
479 "STAGE_UPGRADE_DOCKER_COMPONENTS": True,
480 "STAGE_UPGRADE_ES_KIBANA": True,
481 "STAGE_UPGRADE_SYSTEM_PART": True
482 }
483 upgrade_control_pipeline = drivetrain.start_job_on_cid_jenkins(
484 job_name="stacklight-upgrade",
485 job_parameters=job_parameters)
486
487 assert upgrade_control_pipeline == 'SUCCESS'
488
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300489
Hanna Arhipova19429962019-10-17 15:16:49 +0300490@pytest.mark.usefixtures("switch_to_proposed_pipelines",
491 "enable_openstack_update")
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300492class TestOpenstackUpdate(object):
493
494 @pytest.mark.grab_versions
495 @pytest.mark.run_mcp_update
496 def test__pre_update__enable_pipeline_job(self,
497 reclass_actions, salt_actions,
498 show_step):
499 """ Enable pipeline in the Drivetrain
500
501 Scenario:
502 1. Add deploy.update.* classes to the reclass
503 2. Start jenkins.client salt state
504
505 """
506 salt = salt_actions
507 reclass = reclass_actions
508 show_step(1)
509 reclass.add_class("system.jenkins.client.job.deploy.update.upgrade",
510 "cluster/*/cicd/control/leader.yml")
511
512 reclass.add_class(
513 "system.jenkins.client.job.deploy.update.upgrade_ovs_gateway",
514 "cluster/*/cicd/control/leader.yml")
515
516 reclass.add_class(
517 "system.jenkins.client.job.deploy.update.upgrade_compute",
518 "cluster/*/cicd/control/leader.yml")
519
520 show_step(2)
521 r, errors = salt.enforce_state("I@jenkins:client", "jenkins.client")
522 assert errors is None
523
524 @pytest.mark.grab_versions
525 @pytest.mark.parametrize('target', get_control_plane_targets())
526 @pytest.mark.run_mcp_update
Hanna Arhipova19429962019-10-17 15:16:49 +0300527 def test__update__control_plane(self, drivetrain_actions, target):
Hanna Arhipovaeb3a2112019-09-13 18:45:21 +0300528 """Start 'Deploy - upgrade control VMs' for specific node
529 """
530 job_parameters = {
531 "TARGET_SERVERS": target,
532 "INTERACTIVE": False}
533 upgrade_control_pipeline = drivetrain_actions.start_job_on_cid_jenkins(
534 job_name="deploy-upgrade-control",
535 job_parameters=job_parameters)
536
537 assert upgrade_control_pipeline == 'SUCCESS'
538
539 @pytest.mark.grab_versions
540 @pytest.mark.run_mcp_update
541 def test__update__data_plane(self, drivetrain_actions):
542 """Start 'Deploy - upgrade OVS gateway'
543 """
544 job_parameters = {
545 "INTERACTIVE": False}
546 upgrade_data_pipeline = drivetrain_actions.start_job_on_cid_jenkins(
547 job_name="deploy-upgrade-ovs-gateway",
548 job_parameters=job_parameters)
549
550 assert upgrade_data_pipeline == 'SUCCESS'
Hanna Arhipova19429962019-10-17 15:16:49 +0300551
552 @pytest.mark.grab_versions
553 @pytest.mark.run_mcp_update
554 def test__update__computes(self, drivetrain_actions):
555 """Start 'Deploy - upgrade computes'
556 """
557 job_parameters = {
558 "INTERACTIVE": False}
559 upgrade_compute_pipeline = drivetrain_actions.start_job_on_cid_jenkins(
560 job_name="deploy-upgrade-compute",
561 job_parameters=job_parameters)
562
563 assert upgrade_compute_pipeline == 'SUCCESS'