Browse Source

Set forcefully upgrade_levels after deploy-changes

Appropriate upgrade_levels have to be set after each deploy-changes for
controller and compute nodes because they are cleared. It have to be
solved using advanced configuration feature.

Change-Id: Idbe13e58d2ae0787620211ba0300150ed4e82f39
Partial-Bug: #1624341
changes/48/374248/1
Ilya Kharin 2 years ago
parent
commit
14be38cd7f

+ 3
- 1
octane/commands/upgrade_node.py View File

@@ -92,7 +92,9 @@ def upgrade_node(env_id, node_ids, isolated=False, provision=True, roles=None,
92 92
     else:
93 93
         env_util.deploy_changes(env, nodes)
94 94
     call_handlers('postdeploy')
95
-    env_util.set_upgrade_levels_for_controllers(env)
95
+    # TODO(akscram): The upgrade_levels parameters have to be handled by the
96
+    # advanced configuration feature for OpenStack services (openstack-config).
97
+    env_util.set_upgrade_levels(env)
96 98
 
97 99
 
98 100
 def copy_patches_folder_to_nailgun():

+ 0
- 6
octane/handlers/upgrade/compute.py View File

@@ -55,12 +55,6 @@ class ComputeUpgrade(upgrade.UpgradeHandler):
55 55
                 ["nova", "service-enable", call_host, "nova-compute"],
56 56
                 controller, False)
57 57
 
58
-        seed_version = self.env.data["fuel_version"]
59
-        openstack_release = nova.get_upgrade_levels(seed_version)
60
-        node_util.add_compute_upgrade_levels(self.node, openstack_release)
61
-
62
-        ssh.call(["service", "nova-compute", "restart"], node=self.node)
63
-
64 58
     def evacuate_host(self):
65 59
         controller = env_util.get_one_controller(self.env)
66 60
 

+ 5
- 4
octane/tests/test_env.py View File

@@ -350,19 +350,20 @@ def test_util_env(mocker, api, modified, nodes):
350 350
     env.get_default_facts.assert_called_once_with('deployment', nodes=nodes)
351 351
 
352 352
 
353
-def test_set_upgrade_levels_for_controllers(mocker):
353
+def test_set_upgrade_levels(mocker):
354 354
     env = mock.Mock(data={"fuel_version": "9.1"})
355 355
     node = mock.Mock()
356 356
 
357 357
     mock_get_levels = mocker.patch("octane.util.nova.get_upgrade_levels")
358 358
     mock_get_levels.return_value = "liberty"
359
-    mock_get_conts = mocker.patch("octane.util.env.get_controllers")
360
-    mock_get_conts.return_value = [node]
359
+    mock_get_nodes = mocker.patch("octane.util.env.get_nodes")
360
+    mock_get_nodes.return_value = [node]
361 361
     mock_add = mocker.patch("octane.util.node.add_compute_upgrade_levels")
362 362
     mock_restart = mocker.patch("octane.util.node.restart_nova_services")
363 363
 
364
-    env_util.set_upgrade_levels_for_controllers(env)
364
+    env_util.set_upgrade_levels(env)
365 365
 
366 366
     mock_get_levels.assert_called_once_with("9.1")
367 367
     mock_add.assert_called_once_with(node, "liberty")
368 368
     mock_restart.assert_called_once_with(node)
369
+    mock_get_nodes.assert_called_once_with(env, ["controller", "compute"])

+ 1
- 2
octane/tests/test_upgrade_node.py View File

@@ -76,8 +76,7 @@ def test_upgrade_node(mocker, node_ids, isolated, provision, roles,
76 76
     mock_deploy_nodes = mocker.patch(
77 77
         "octane.util.env.deploy_nodes_without_tasks"
78 78
     )
79
-    mock_upgrade_levels = mocker.patch(
80
-        "octane.util.env.set_upgrade_levels_for_controllers")
79
+    mock_upgrade_levels = mocker.patch("octane.util.env.set_upgrade_levels")
81 80
     mock_deploy_changes = mocker.patch("octane.util.env.deploy_changes")
82 81
     mock_check_isolation = mocker.patch(
83 82
         "octane.commands.upgrade_node.check_isolation")

+ 2
- 2
octane/util/env.py View File

@@ -416,9 +416,9 @@ def get_generated(env_id):
416 416
         'clusters/{0}/generated'.format(env_id))
417 417
 
418 418
 
419
-def set_upgrade_levels_for_controllers(env):
419
+def set_upgrade_levels(env):
420 420
     version = env.data["fuel_version"]
421 421
     openstack_release = nova.get_upgrade_levels(version)
422
-    for node in get_controllers(env):
422
+    for node in get_nodes(env, ["controller", "compute"]):
423 423
         node_util.add_compute_upgrade_levels(node, openstack_release)
424 424
         node_util.restart_nova_services(node)

Loading…
Cancel
Save