Upgrade Orchestration for AIO-DX
This commit provides support for orchestration of platform upgrades across all teh hosts in a single AIO-DX deployment (with or without worker nodes). The changes include: 1) Allow an upgrade strategy to be created for an AIO-DX configuration. 2) When dealing with controller hosts, treat it like a worker rather than a controller 3) Modify worker code to handle controllers i.e. check which step should be added to the stage (WaitDataSyncStep, WaitAlarmsClearStep or SystemStabilizeStep) depending on the host personality and openstack installation Change-Id: I42daaa357d04eacd02be08ceab628882cb8987da Story: 2008055 Task: 41829 Signed-off-by: Jessica Castelino <jessica.castelino@windriver.com>
This commit is contained in:
parent
9b79211a3c
commit
af3bddc28d
|
@ -35,7 +35,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
alarm_restrictions=SW_UPDATE_ALARM_RESTRICTION.STRICT,
|
||||
start_upgrade=False,
|
||||
complete_upgrade=False,
|
||||
nfvi_upgrade=None
|
||||
nfvi_upgrade=None,
|
||||
single_controller=False
|
||||
):
|
||||
"""
|
||||
Create a software update strategy
|
||||
|
@ -48,7 +49,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
alarm_restrictions=alarm_restrictions,
|
||||
start_upgrade=start_upgrade,
|
||||
complete_upgrade=complete_upgrade,
|
||||
ignore_alarms=[]
|
||||
ignore_alarms=[],
|
||||
single_controller=single_controller,
|
||||
)
|
||||
strategy.nfvi_upgrade = nfvi_upgrade
|
||||
return strategy
|
||||
|
@ -162,7 +164,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-2', 'compute-3']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-2', 'compute-3']},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
|
@ -178,7 +181,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-0']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-0']},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
|
@ -194,7 +198,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-1']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-1']},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -265,7 +270,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-1', 'compute-5']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-1', 'compute-5']},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
|
@ -283,7 +289,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-0', 'compute-2', 'compute-3']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-0', 'compute-2', 'compute-3']},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
|
@ -301,7 +308,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-4', 'compute-6', 'compute-7']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-4', 'compute-6', 'compute-7']},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
|
@ -318,7 +326,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-8', 'compute-9']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-8', 'compute-9']},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -327,6 +336,150 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
sw_update_testcase.validate_strategy_persists(strategy)
|
||||
sw_update_testcase.validate_phase(apply_phase, expected_results)
|
||||
|
||||
@mock.patch('nfv_vim.strategy._strategy.get_local_host_name',
|
||||
sw_update_testcase.fake_host_name_controller_1)
|
||||
def test_sw_upgrade_strategy_worker_stages_parallel_migrate_for_aio(self):
|
||||
"""
|
||||
Test the sw_upgrade strategy add worker strategy stages:
|
||||
- parallel apply
|
||||
- migrate instance action
|
||||
Verify:
|
||||
- AIO hosts upgraded first in serial
|
||||
- hosts with no instances upgraded next
|
||||
- instances migrated
|
||||
- for AIO controllers, the last step is wait-data-sync
|
||||
- for workers, the last step is wait-alarms-clear (openstack workers)
|
||||
"""
|
||||
self.create_host('compute-0')
|
||||
self.create_host('compute-1')
|
||||
self.create_host('compute-2')
|
||||
self.create_host('compute-3')
|
||||
self.create_host('compute-4')
|
||||
self.create_host('controller-0', aio=True)
|
||||
self.create_host('controller-1', aio=True)
|
||||
|
||||
self.create_instance('small', "test_instance_0", 'compute-0')
|
||||
self.create_instance('small', "test_instance_2", 'compute-2')
|
||||
self.create_instance('small', "test_instance_3", 'compute-3')
|
||||
self.create_instance('small', "test_instance_4", 'compute-4')
|
||||
self.create_instance('small', "test_instance_6", 'controller-0')
|
||||
self.create_instance('small', "test_instance_7", 'controller-1')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
worker_hosts.append(host)
|
||||
# Sort worker hosts so the order of the steps is deterministic
|
||||
sorted_worker_hosts = sorted(worker_hosts, key=lambda host: host.name)
|
||||
|
||||
strategy = self.create_sw_upgrade_strategy(
|
||||
worker_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL,
|
||||
max_parallel_worker_hosts=3
|
||||
)
|
||||
|
||||
strategy._add_worker_strategy_stages(
|
||||
worker_hosts=sorted_worker_hosts,
|
||||
reboot=True)
|
||||
|
||||
apply_phase = strategy.apply_phase.as_dict()
|
||||
|
||||
expected_results = {
|
||||
'total_stages': 5,
|
||||
'stages': [
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
'total_steps': 8,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'disable-host-services'},
|
||||
{'name': 'migrate-instances',
|
||||
'entity_names': ['test_instance_6']},
|
||||
{'name': 'swact-hosts',
|
||||
'entity_names': ['controller-0']},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['controller-0']},
|
||||
{'name': 'upgrade-hosts',
|
||||
'entity_names': ['controller-0']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['controller-0']},
|
||||
{'name': 'wait-data-sync',
|
||||
'timeout': 14400}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
'total_steps': 8,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'disable-host-services'},
|
||||
{'name': 'migrate-instances',
|
||||
'entity_names': ['test_instance_7']},
|
||||
{'name': 'swact-hosts',
|
||||
'entity_names': ['controller-1']},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['controller-1']},
|
||||
{'name': 'upgrade-hosts',
|
||||
'entity_names': ['controller-1']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['controller-1']},
|
||||
{'name': 'wait-data-sync',
|
||||
'timeout': 14400}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
'total_steps': 5,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['compute-1']},
|
||||
{'name': 'upgrade-hosts',
|
||||
'entity_names': ['compute-1']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-1']},
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
'total_steps': 7,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'disable-host-services'},
|
||||
{'name': 'migrate-instances',
|
||||
'entity_names': ['test_instance_0',
|
||||
'test_instance_2',
|
||||
'test_instance_3']},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['compute-0', 'compute-2', 'compute-3']},
|
||||
{'name': 'upgrade-hosts',
|
||||
'entity_names': ['compute-0', 'compute-2', 'compute-3']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-0', 'compute-2', 'compute-3']},
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
'total_steps': 7,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'disable-host-services'},
|
||||
{'name': 'migrate-instances',
|
||||
'entity_names': ['test_instance_4']},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['compute-4']},
|
||||
{'name': 'upgrade-hosts',
|
||||
'entity_names': ['compute-4']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-4']},
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
sw_update_testcase.validate_strategy_persists(strategy)
|
||||
sw_update_testcase.validate_phase(apply_phase, expected_results)
|
||||
|
||||
@mock.patch('nfv_vim.strategy._strategy.get_local_host_name',
|
||||
sw_update_testcase.fake_host_name_controller_1)
|
||||
def test_sw_upgrade_strategy_worker_stages_parallel_migrate_fifty_hosts(self):
|
||||
|
@ -407,7 +560,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': stage_hosts[0]},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': stage_hosts[0]},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
]
|
||||
|
@ -428,7 +582,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': stage_hosts[x]},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': stage_hosts[x]},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
}
|
||||
)
|
||||
|
@ -491,7 +646,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-2']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-2']},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
|
@ -504,7 +660,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-3']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-3']},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
|
@ -519,7 +676,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-0']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-0']},
|
||||
{'name': 'system-stabilize'}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
|
@ -534,6 +692,100 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-1']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-1']},
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
sw_update_testcase.validate_strategy_persists(strategy)
|
||||
sw_update_testcase.validate_phase(apply_phase, expected_results)
|
||||
|
||||
@mock.patch('nfv_vim.strategy._strategy.get_local_host_name',
|
||||
sw_update_testcase.fake_host_name_controller_1)
|
||||
def test_sw_upgrade_strategy_non_openstack_worker_stages_serial(self):
|
||||
"""
|
||||
Test the sw_upgrade strategy add worker strategy stages:
|
||||
- workers with no openstack installed
|
||||
- serial apply
|
||||
- no migrate instance action
|
||||
Verify:
|
||||
- final step is SystemStabilize
|
||||
"""
|
||||
self.create_host('compute-0', openstack_installed=False)
|
||||
self.create_host('compute-1', openstack_installed=False)
|
||||
self.create_host('compute-2', openstack_installed=False)
|
||||
self.create_host('compute-3', openstack_installed=False)
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
worker_hosts.append(host)
|
||||
# Sort worker hosts so the order of the steps is deterministic
|
||||
sorted_worker_hosts = sorted(worker_hosts, key=lambda host: host.name)
|
||||
|
||||
strategy = self.create_sw_upgrade_strategy(
|
||||
worker_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL
|
||||
)
|
||||
|
||||
strategy._add_worker_strategy_stages(worker_hosts=sorted_worker_hosts,
|
||||
reboot=True)
|
||||
|
||||
apply_phase = strategy.apply_phase.as_dict()
|
||||
|
||||
expected_results = {
|
||||
'total_stages': 4,
|
||||
'stages': [
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
'total_steps': 5,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['compute-0']},
|
||||
{'name': 'upgrade-hosts',
|
||||
'entity_names': ['compute-0']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-0']},
|
||||
{'name': 'system-stabilize'}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
'total_steps': 5,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['compute-1']},
|
||||
{'name': 'upgrade-hosts',
|
||||
'entity_names': ['compute-1']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-1']},
|
||||
{'name': 'system-stabilize'}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
'total_steps': 5,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['compute-2']},
|
||||
{'name': 'upgrade-hosts',
|
||||
'entity_names': ['compute-2']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-2']},
|
||||
{'name': 'system-stabilize'}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
'total_steps': 5,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['compute-3']},
|
||||
{'name': 'upgrade-hosts',
|
||||
'entity_names': ['compute-3']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-3']},
|
||||
{'name': 'system-stabilize'}
|
||||
]
|
||||
}
|
||||
|
@ -950,10 +1202,10 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
- aio hosts
|
||||
- serial apply
|
||||
Verify:
|
||||
- controller-0 upgraded
|
||||
- controller-0 and controller-1 upgraded
|
||||
"""
|
||||
self.create_host('controller-0', aio=True)
|
||||
self.create_host('controller-1', aio=True)
|
||||
self.create_host('controller-0', aio=True, openstack_installed=False)
|
||||
self.create_host('controller-1', aio=True, openstack_installed=False)
|
||||
|
||||
controller_hosts = []
|
||||
for host in self._host_table.values():
|
||||
|
@ -961,15 +1213,108 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
HOST_NAME.CONTROLLER_0 == host.name):
|
||||
controller_hosts.append(host)
|
||||
|
||||
strategy = self.create_sw_upgrade_strategy()
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
worker_hosts.append(host)
|
||||
# Sort worker hosts so the order of the steps is deterministic
|
||||
sorted_worker_hosts = sorted(worker_hosts, key=lambda host: host.name)
|
||||
|
||||
strategy = self.create_sw_upgrade_strategy(worker_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL)
|
||||
|
||||
success, reason = strategy._add_controller_strategy_stages(
|
||||
controllers=controller_hosts,
|
||||
reboot=True)
|
||||
|
||||
assert success is False, "Strategy creation did not fail"
|
||||
assert reason == "cannot apply software upgrades to AIO configuration", \
|
||||
"Invalid failure reason"
|
||||
assert success is True, ""
|
||||
apply_phase = strategy.apply_phase.as_dict()
|
||||
expected_results = {
|
||||
'total_stages': 0,
|
||||
}
|
||||
sw_update_testcase.validate_strategy_persists(strategy)
|
||||
sw_update_testcase.validate_phase(apply_phase, expected_results)
|
||||
|
||||
strategy._add_worker_strategy_stages(
|
||||
worker_hosts=sorted_worker_hosts,
|
||||
reboot=True)
|
||||
|
||||
apply_phase = strategy.apply_phase.as_dict()
|
||||
|
||||
expected_results = {
|
||||
'total_stages': 2,
|
||||
'stages': [
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
'total_steps': 6,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'swact-hosts',
|
||||
'entity_names': ['controller-0']},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['controller-0']},
|
||||
{'name': 'upgrade-hosts',
|
||||
'entity_names': ['controller-0']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['controller-0']},
|
||||
{'name': 'wait-data-sync',
|
||||
'ignore_alarms': ['900.005', '900.201', '750.006'],
|
||||
'timeout': 14400}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
'total_steps': 6,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'swact-hosts',
|
||||
'entity_names': ['controller-1']},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['controller-1']},
|
||||
{'name': 'upgrade-hosts',
|
||||
'entity_names': ['controller-1']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['controller-1']},
|
||||
{'name': 'wait-data-sync',
|
||||
'ignore_alarms': ['900.005', '900.201', '750.006'],
|
||||
'timeout': 14400}
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
sw_update_testcase.validate_strategy_persists(strategy)
|
||||
sw_update_testcase.validate_phase(apply_phase, expected_results)
|
||||
|
||||
@mock.patch('nfv_vim.strategy._strategy.get_local_host_name',
|
||||
sw_update_testcase.fake_host_name_controller_1)
|
||||
def test_sw_upgrade_strategy_aiosx_stages_serial(self):
|
||||
"""
|
||||
Test the sw_upgrade strategy add controller strategy stages:
|
||||
- aio-sx hosts
|
||||
- serial apply
|
||||
Verify:
|
||||
- failure
|
||||
"""
|
||||
self.create_host('controller-0', aio=True)
|
||||
|
||||
controller_hosts = []
|
||||
for host in self._host_table.values():
|
||||
if (HOST_PERSONALITY.CONTROLLER in host.personality and
|
||||
HOST_NAME.CONTROLLER_0 == host.name):
|
||||
controller_hosts.append(host)
|
||||
|
||||
strategy = self.create_sw_upgrade_strategy(single_controller=True)
|
||||
|
||||
success, reason = strategy._add_controller_strategy_stages(
|
||||
controllers=controller_hosts,
|
||||
reboot=True)
|
||||
|
||||
assert success is False
|
||||
assert reason == "not enough controllers to apply software upgrades"
|
||||
apply_phase = strategy.apply_phase.as_dict()
|
||||
expected_results = {
|
||||
'total_stages': 0,
|
||||
}
|
||||
sw_update_testcase.validate_strategy_persists(strategy)
|
||||
sw_update_testcase.validate_phase(apply_phase, expected_results)
|
||||
|
||||
@testtools.skip('No support for start_upgrade')
|
||||
def test_sw_upgrade_strategy_build_complete_serial_migrate_start_complete(self):
|
||||
|
@ -1035,11 +1380,9 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-controllers',
|
||||
'total_steps': 6,
|
||||
'total_steps': 5,
|
||||
'steps': [
|
||||
{'name': 'query-alarms'},
|
||||
{'name': 'swact-hosts',
|
||||
'entity_names': ['controller-0']},
|
||||
{'name': 'lock-hosts',
|
||||
'entity_names': ['controller-0']},
|
||||
{'name': 'upgrade-hosts',
|
||||
|
@ -1207,8 +1550,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-1']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-1']},
|
||||
{'name': 'system-stabilize',
|
||||
'timeout': 60}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
},
|
||||
{'name': 'sw-upgrade-worker-hosts',
|
||||
|
@ -1223,8 +1566,8 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'entity_names': ['compute-0']},
|
||||
{'name': 'unlock-hosts',
|
||||
'entity_names': ['compute-0']},
|
||||
{'name': 'system-stabilize',
|
||||
'timeout': 60}
|
||||
{'name': 'wait-alarms-clear',
|
||||
'timeout': 600}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -95,7 +95,8 @@ class SwMgmtDirector(object):
|
|||
strategy_uuid, storage_apply_type,
|
||||
worker_apply_type, max_parallel_worker_hosts,
|
||||
alarm_restrictions, start_upgrade,
|
||||
complete_upgrade, self._ignore_alarms)
|
||||
complete_upgrade, self._ignore_alarms,
|
||||
self._single_controller)
|
||||
|
||||
schedule.schedule_function_call(callback, success, reason,
|
||||
self._sw_update.strategy)
|
||||
|
|
|
@ -30,7 +30,7 @@ class SwUpgrade(SwUpdate):
|
|||
def strategy_build(self, strategy_uuid, storage_apply_type,
|
||||
worker_apply_type, max_parallel_worker_hosts,
|
||||
alarm_restrictions, start_upgrade,
|
||||
complete_upgrade, ignore_alarms):
|
||||
complete_upgrade, ignore_alarms, single_controller):
|
||||
"""
|
||||
Create a software upgrade strategy
|
||||
"""
|
||||
|
@ -43,7 +43,8 @@ class SwUpgrade(SwUpdate):
|
|||
self._strategy = strategy.SwUpgradeStrategy(
|
||||
strategy_uuid, storage_apply_type, worker_apply_type,
|
||||
max_parallel_worker_hosts,
|
||||
alarm_restrictions, start_upgrade, complete_upgrade, ignore_alarms)
|
||||
alarm_restrictions, start_upgrade, complete_upgrade,
|
||||
ignore_alarms, single_controller)
|
||||
|
||||
self._strategy.sw_update_obj = self
|
||||
self._strategy.build()
|
||||
|
|
|
@ -1159,7 +1159,7 @@ class SwUpgradeStrategy(SwUpdateStrategy):
|
|||
def __init__(self, uuid, storage_apply_type, worker_apply_type,
|
||||
max_parallel_worker_hosts,
|
||||
alarm_restrictions, start_upgrade, complete_upgrade,
|
||||
ignore_alarms):
|
||||
ignore_alarms, single_controller):
|
||||
super(SwUpgradeStrategy, self).__init__(
|
||||
uuid,
|
||||
STRATEGY_NAME.SW_UPGRADE,
|
||||
|
@ -1192,7 +1192,7 @@ class SwUpgradeStrategy(SwUpdateStrategy):
|
|||
'750.006', # Configuration change requires reapply of cert-manager
|
||||
]
|
||||
self._ignore_alarms += IGNORE_ALARMS
|
||||
|
||||
self._single_controller = single_controller
|
||||
self._nfvi_upgrade = None
|
||||
|
||||
@property
|
||||
|
@ -1293,9 +1293,16 @@ class SwUpgradeStrategy(SwUpdateStrategy):
|
|||
|
||||
for host in controllers:
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
DLOG.warn("Cannot apply software upgrades to AIO configuration.")
|
||||
reason = 'cannot apply software upgrades to AIO configuration'
|
||||
return False, reason
|
||||
# Do nothing for AIO hosts. We let the worker code handle everything.
|
||||
# This is done to handle the case where stx-openstack is
|
||||
# installed and there could be instances running on the
|
||||
# AIO-DX controllers which need to be migrated.
|
||||
if self._single_controller:
|
||||
DLOG.warn("Cannot apply software upgrades to AIO-SX deployment.")
|
||||
reason = 'cannot apply software upgrades to AIO-SX deployment'
|
||||
return False, reason
|
||||
else:
|
||||
return True, ''
|
||||
elif HOST_NAME.CONTROLLER_1 == host.name:
|
||||
controller_1_host = host
|
||||
elif HOST_NAME.CONTROLLER_0 == host.name:
|
||||
|
@ -1424,10 +1431,29 @@ class SwUpgradeStrategy(SwUpdateStrategy):
|
|||
strategy.STRATEGY_STAGE_NAME.SW_UPGRADE_WORKER_HOSTS)
|
||||
stage.add_step(strategy.QueryAlarmsStep(
|
||||
True, ignore_alarms=self._ignore_alarms))
|
||||
if HOST_PERSONALITY.CONTROLLER in host_list[0].personality:
|
||||
stage.add_step(strategy.SwactHostsStep(host_list))
|
||||
stage.add_step(strategy.LockHostsStep(host_list))
|
||||
stage.add_step(strategy.UpgradeHostsStep(host_list))
|
||||
stage.add_step(strategy.UnlockHostsStep(host_list))
|
||||
stage.add_step(strategy.SystemStabilizeStep())
|
||||
if HOST_PERSONALITY.CONTROLLER in host_list[0].personality:
|
||||
# AIO Controller hosts will undergo WaitDataSyncStep step
|
||||
# Allow up to four hours for controller disks to synchronize
|
||||
stage.add_step(strategy.WaitDataSyncStep(
|
||||
timeout_in_secs=4 * 60 * 60,
|
||||
ignore_alarms=self._ignore_alarms))
|
||||
else:
|
||||
# Worker hosts will undergo:
|
||||
# 1) WaitAlarmsClear step if openstack is installed.
|
||||
# 2) SystemStabilizeStep step if openstack is not installed.
|
||||
if any([host.openstack_control or host.openstack_compute
|
||||
for host in host_list]):
|
||||
# Hosts with openstack that just need to wait for services to start up:
|
||||
stage.add_step(strategy.WaitAlarmsClearStep(
|
||||
timeout_in_secs=10 * 60,
|
||||
ignore_alarms=self._ignore_alarms))
|
||||
else:
|
||||
stage.add_step(strategy.SystemStabilizeStep())
|
||||
self.apply_phase.add_stage(stage)
|
||||
continue
|
||||
|
||||
|
@ -1452,10 +1478,30 @@ class SwUpgradeStrategy(SwUpdateStrategy):
|
|||
# kubernetes services will have to be added.
|
||||
|
||||
stage.add_step(strategy.MigrateInstancesStep(instance_list))
|
||||
if HOST_PERSONALITY.CONTROLLER in host_list[0].personality:
|
||||
stage.add_step(strategy.SwactHostsStep(host_list))
|
||||
stage.add_step(strategy.LockHostsStep(host_list))
|
||||
stage.add_step(strategy.UpgradeHostsStep(host_list))
|
||||
stage.add_step(strategy.UnlockHostsStep(host_list))
|
||||
stage.add_step(strategy.SystemStabilizeStep())
|
||||
if HOST_PERSONALITY.CONTROLLER in host_list[0].personality:
|
||||
# AIO Controller hosts will undergo WaitDataSyncStep step
|
||||
# Allow up to four hours for controller disks to synchronize
|
||||
stage.add_step(strategy.WaitDataSyncStep(
|
||||
timeout_in_secs=4 * 60 * 60,
|
||||
ignore_alarms=self._ignore_alarms))
|
||||
else:
|
||||
# Worker hosts will undergo:
|
||||
# 1) WaitAlarmsClear step if openstack is installed.
|
||||
# 2) SystemStabilizeStep step if openstack is not installed.
|
||||
if any([host.openstack_control or host.openstack_compute
|
||||
for host in host_list]):
|
||||
# Hosts with openstack that just need to wait for
|
||||
# services to start up:
|
||||
stage.add_step(strategy.WaitAlarmsClearStep(
|
||||
timeout_in_secs=10 * 60,
|
||||
ignore_alarms=self._ignore_alarms))
|
||||
else:
|
||||
stage.add_step(strategy.SystemStabilizeStep())
|
||||
self.apply_phase.add_stage(stage)
|
||||
|
||||
return True, ''
|
||||
|
@ -1583,7 +1629,7 @@ class SwUpgradeStrategy(SwUpdateStrategy):
|
|||
elif HOST_PERSONALITY.STORAGE in host.personality:
|
||||
storage_hosts.append(host)
|
||||
|
||||
elif HOST_PERSONALITY.WORKER in host.personality:
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
worker_hosts.append(host)
|
||||
else:
|
||||
# Only hosts not yet upgraded will be upgraded
|
||||
|
@ -1599,7 +1645,7 @@ class SwUpgradeStrategy(SwUpdateStrategy):
|
|||
elif HOST_PERSONALITY.STORAGE in host.personality:
|
||||
storage_hosts.append(host)
|
||||
|
||||
elif HOST_PERSONALITY.WORKER in host.personality:
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
worker_hosts.append(host)
|
||||
|
||||
STRATEGY_CREATION_COMMANDS = [
|
||||
|
|
Loading…
Reference in New Issue