py3: nfv wrap dict.values() in list()
In python2 dict.values() returns a list, while in python3 it returns an iterator. Modifying a dict while iterating over it(insert, delete) produces a runtime error. Wrapped all dict.values() in list(). There was no atomic access (e.g. using locks) to be skipped. To aid development time and avoid excessive testing, converted some calls which could have been skipped: - local scoped variables - variables with no changes after assignment (saved time identifying those) Story: 2008454 Task: 42727 Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com> Change-Id: I14b970735a2f36649d008ce841527ee5467c03e7
This commit is contained in:
parent
0f9b521672
commit
62714dcfa6
|
@ -166,7 +166,7 @@ def reset_histogram_data(name=None):
|
|||
Reset histogram data
|
||||
"""
|
||||
if name is None:
|
||||
for histogram in _histograms.values():
|
||||
for histogram in list(_histograms.values()):
|
||||
histogram.reset_data()
|
||||
else:
|
||||
histogram = _find_histogram(name)
|
||||
|
@ -179,7 +179,7 @@ def display_histogram_data(name=None, pretty_format=True):
|
|||
Display histogram data captured
|
||||
"""
|
||||
if name is None:
|
||||
for histogram in _histograms.values():
|
||||
for histogram in list(_histograms.values()):
|
||||
histogram.display_data(pretty_format)
|
||||
else:
|
||||
histogram = _find_histogram(name)
|
||||
|
|
|
@ -110,7 +110,7 @@ class TCPServer(object):
|
|||
Shutdown the TCP Server
|
||||
"""
|
||||
connections = self._client_connections.copy()
|
||||
for client_connection in connections.values():
|
||||
for client_connection in list(connections.values()):
|
||||
selobj.selobj_del_read_obj(client_connection.selobj)
|
||||
selobj.selobj_del_error_callback(client_connection.selobj)
|
||||
client_connection.close()
|
||||
|
|
|
@ -63,7 +63,7 @@ class Test(object):
|
|||
"""
|
||||
Clears the log files so that they are empty, expected to be overloaded
|
||||
"""
|
||||
for file_name in self.LOG_FILES.values():
|
||||
for file_name in list(self.LOG_FILES.values()):
|
||||
with open(file_name, 'w'):
|
||||
pass
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ class SwUpdateStrategyTestCase(testcase.NFVTestCase):
|
|||
tenant = objects.Tenant(tenant_uuid, "%s_name" % tenant_uuid, '', True)
|
||||
self._tenant_table[tenant_uuid] = tenant
|
||||
|
||||
for instance_type in self._instance_type_table.values():
|
||||
for instance_type in list(self._instance_type_table.values()):
|
||||
if instance_type.name == instance_type_name:
|
||||
instance_uuid = str(uuid.uuid4())
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
strategy = create_fw_update_strategy()
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
worker_hosts.append(host)
|
||||
|
||||
|
@ -113,7 +113,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
worker_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -216,7 +216,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
max_parallel_worker_hosts=3)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -292,7 +292,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
default_instance_action=SW_UPDATE_INSTANCE_ACTION.MIGRATE)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -393,7 +393,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
max_parallel_worker_hosts=4)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -481,7 +481,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -640,7 +640,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
max_parallel_worker_hosts=10)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -738,7 +738,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
max_parallel_worker_hosts=10)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -865,7 +865,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
max_parallel_worker_hosts=4)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -1021,7 +1021,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
max_parallel_worker_hosts=2)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -1152,7 +1152,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
single_controller=True)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -1203,7 +1203,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
single_controller=True)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -1259,7 +1259,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
single_controller=True)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -1295,7 +1295,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
single_controller=True)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -1345,7 +1345,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
worker_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -1416,7 +1416,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
single_controller=False)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -1490,7 +1490,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
single_controller=False)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -1565,7 +1565,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
single_controller=False)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -1642,7 +1642,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
single_controller=False)
|
||||
|
||||
fw_update_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_host_list.append(host)
|
||||
|
||||
|
@ -1731,7 +1731,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
max_parallel_worker_hosts=2)
|
||||
|
||||
fw_update_worker_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if host._nfvi_host.admin_state == nfvi.objects.v1.HOST_ADMIN_STATE.UNLOCKED:
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_worker_host_list.append(host)
|
||||
|
@ -1851,7 +1851,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
max_parallel_worker_hosts=2)
|
||||
|
||||
fw_update_worker_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if host._nfvi_host.admin_state == nfvi.objects.v1.HOST_ADMIN_STATE.UNLOCKED:
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_worker_host_list.append(host)
|
||||
|
@ -1990,7 +1990,7 @@ class TestFwUpdateStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
|
||||
fw_update_controller_host_list = []
|
||||
fw_update_worker_host_list = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if host._nfvi_host.admin_state == nfvi.objects.v1.HOST_ADMIN_STATE.UNLOCKED:
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
fw_update_worker_host_list.append(host)
|
||||
|
|
|
@ -109,9 +109,9 @@ class TestInstance(testcase.NFVTestCase):
|
|||
tenant = objects.Tenant(tenant_uuid, "%s_name" % tenant_uuid, '', True)
|
||||
self._tenant_table[tenant_uuid] = tenant
|
||||
|
||||
for instance_type in self._instance_type_table.values():
|
||||
for instance_type in list(self._instance_type_table.values()):
|
||||
if instance_type.name == instance_type_name:
|
||||
for image in self._image_table.values():
|
||||
for image in list(self._image_table.values()):
|
||||
if image.name == image_name:
|
||||
instance_uuid = str(uuid.uuid4())
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class TestInstanceDirector(testcase.NFVTestCase):
|
|||
tenant = objects.Tenant(tenant_uuid, "%s_name" % tenant_uuid, '', True)
|
||||
self._tenant_table[tenant_uuid] = tenant
|
||||
|
||||
for instance_type in self._instance_type_table.values():
|
||||
for instance_type in list(self._instance_type_table.values()):
|
||||
if instance_type.name == instance_type_name:
|
||||
instance_uuid = uuid.uuid4()
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -131,7 +131,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -241,7 +241,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_instance('small', "test_instance_9", 'compute-9')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -404,7 +404,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_instance('small', "test_instance_9", 'compute-9')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -577,7 +577,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_instance('small', "test_instance_9", 'compute-9')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -742,7 +742,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_instance('small', "test_instance_9", 'compute-9')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -894,7 +894,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -1002,7 +1002,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -1044,7 +1044,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'compute-1')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -1192,7 +1192,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'compute-1')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -1279,7 +1279,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
admin_state=nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED)
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -1379,7 +1379,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'compute-1')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -1458,7 +1458,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -1549,7 +1549,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -1719,7 +1719,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('compute-3', openstack_installed=False)
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -1884,7 +1884,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('compute-3', openstack_installed=False)
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -2016,7 +2016,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -2188,7 +2188,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('compute-%02d' % x)
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -2318,7 +2318,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -2503,7 +2503,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -2601,7 +2601,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.HOST_GROUP_POLICY.STORAGE_REPLICATION])
|
||||
|
||||
storage_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.STORAGE in host.personality:
|
||||
storage_hosts.append(host)
|
||||
# Sort hosts so the order of the steps is deterministic
|
||||
|
@ -2648,7 +2648,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.HOST_GROUP_POLICY.STORAGE_REPLICATION])
|
||||
|
||||
storage_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.STORAGE in host.personality:
|
||||
storage_hosts.append(host)
|
||||
# Sort hosts so the order of the steps is deterministic
|
||||
|
@ -2772,7 +2772,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.HOST_GROUP_POLICY.STORAGE_REPLICATION])
|
||||
|
||||
storage_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.STORAGE in host.personality:
|
||||
storage_hosts.append(host)
|
||||
# Sort hosts so the order of the steps is deterministic
|
||||
|
@ -2895,7 +2895,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-1')
|
||||
|
||||
controller_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.CONTROLLER in host.personality:
|
||||
controller_hosts.append(host)
|
||||
|
||||
|
@ -2930,7 +2930,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-1')
|
||||
|
||||
controller_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.CONTROLLER in host.personality:
|
||||
controller_hosts.append(host)
|
||||
|
||||
|
@ -3040,7 +3040,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-1', openstack_installed=False)
|
||||
|
||||
controller_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.CONTROLLER in host.personality:
|
||||
controller_hosts.append(host)
|
||||
|
||||
|
@ -3157,7 +3157,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'controller-1')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -3283,7 +3283,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'controller-1')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -3364,7 +3364,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-1', aio=True)
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -3437,7 +3437,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-1', aio=True, openstack_installed=False)
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -3527,7 +3527,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'compute-1')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -3692,7 +3692,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'compute-1')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -3817,7 +3817,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('compute-1')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -3928,7 +3928,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'controller-0')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
worker_hosts.append(host)
|
||||
|
||||
|
@ -3955,7 +3955,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-0', aio=True, openstack_installed=False)
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
worker_hosts.append(host)
|
||||
|
||||
|
@ -4009,7 +4009,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
'controller-0')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
worker_hosts.append(host)
|
||||
|
||||
|
@ -4064,7 +4064,7 @@ class TestSwPatchStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-0', aio=True)
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
worker_hosts.append(host)
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -153,7 +153,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -256,7 +256,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_instance('small', "test_instance_9", 'compute-9')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -381,7 +381,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_instance('small', "test_instance_7", 'controller-1')
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -516,7 +516,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
["compute-%02d" % x for x in range(25, 50)])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -627,7 +627,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -724,7 +724,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('compute-3', openstack_installed=False)
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -825,7 +825,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.INSTANCE_GROUP_POLICY.ANTI_AFFINITY])
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -863,7 +863,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.HOST_GROUP_POLICY.STORAGE_REPLICATION])
|
||||
|
||||
storage_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.STORAGE in host.personality:
|
||||
storage_hosts.append(host)
|
||||
# Sort hosts so the order of the steps is deterministic
|
||||
|
@ -911,7 +911,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.HOST_GROUP_POLICY.STORAGE_REPLICATION])
|
||||
|
||||
storage_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.STORAGE in host.personality:
|
||||
storage_hosts.append(host)
|
||||
# Sort hosts so the order of the steps is deterministic
|
||||
|
@ -995,7 +995,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
[nfvi.objects.v1.HOST_GROUP_POLICY.STORAGE_REPLICATION])
|
||||
|
||||
storage_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if HOST_PERSONALITY.STORAGE in host.personality:
|
||||
storage_hosts.append(host)
|
||||
# Sort hosts so the order of the steps is deterministic
|
||||
|
@ -1088,7 +1088,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-1')
|
||||
|
||||
controller_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if (HOST_PERSONALITY.CONTROLLER in host.personality and
|
||||
HOST_NAME.CONTROLLER_0 == host.name):
|
||||
controller_hosts.append(host)
|
||||
|
@ -1137,7 +1137,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-1')
|
||||
|
||||
controller_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if (HOST_PERSONALITY.CONTROLLER in host.personality):
|
||||
controller_hosts.append(host)
|
||||
|
||||
|
@ -1203,13 +1203,13 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-1', aio=True, openstack_installed=False)
|
||||
|
||||
controller_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if (HOST_PERSONALITY.CONTROLLER in host.personality and
|
||||
HOST_NAME.CONTROLLER_0 == host.name):
|
||||
controller_hosts.append(host)
|
||||
|
||||
worker_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(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
|
||||
|
@ -1289,7 +1289,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-0', aio=True)
|
||||
|
||||
controller_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if (HOST_PERSONALITY.CONTROLLER in host.personality and
|
||||
HOST_NAME.CONTROLLER_0 == host.name):
|
||||
controller_hosts.append(host)
|
||||
|
@ -1846,7 +1846,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
|||
self.create_host('controller-1')
|
||||
|
||||
controller_hosts = []
|
||||
for host in self._host_table.values():
|
||||
for host in list(self._host_table.values()):
|
||||
if (HOST_PERSONALITY.CONTROLLER in host.personality and
|
||||
HOST_NAME.CONTROLLER_0 == host.name):
|
||||
controller_hosts.append(host)
|
||||
|
|
|
@ -25,7 +25,7 @@ def _audit_alarms():
|
|||
timer_id = (yield)
|
||||
DLOG.verbose("Audit alarms called, timer_id=%s." % timer_id)
|
||||
instance_table = tables.tables_get_instance_table()
|
||||
for instance in instance_table.values():
|
||||
for instance in list(instance_table.values()):
|
||||
if not instance.is_deleted():
|
||||
alarm.instance_manage_alarms(instance)
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class AsDictMixin(object):
|
|||
|
||||
|
||||
def lookup_class_by_table(table_name):
|
||||
for c in Base._decl_class_registry.values():
|
||||
for c in list(Base._decl_class_registry.values()):
|
||||
if hasattr(c, '__table__'):
|
||||
if table_name == str(c.__table__):
|
||||
return c
|
||||
|
|
|
@ -1834,7 +1834,7 @@ class InstanceDirector(object):
|
|||
instance_table = tables.tables_get_instance_table()
|
||||
instance_uuids = list()
|
||||
|
||||
for instance in instance_table.values():
|
||||
for instance in list(instance_table.values()):
|
||||
if instance.unlock_to_recover and instance.is_locked():
|
||||
instance_uuids.append(instance.uuid)
|
||||
instance.unlock_to_recover = False
|
||||
|
|
|
@ -182,7 +182,7 @@ def vim_image_api_get_images(connection, msg):
|
|||
"""
|
||||
DLOG.verbose("Get image, all=%s." % msg.get_all)
|
||||
image_table = tables.tables_get_image_table()
|
||||
for image in image_table.values():
|
||||
for image in list(image_table.values()):
|
||||
response = rpc.APIResponseGetImage()
|
||||
response.uuid = image.uuid
|
||||
response.name = image.name
|
||||
|
|
|
@ -334,7 +334,7 @@ def vim_instance_api_get_instances(connection, msg):
|
|||
"""
|
||||
DLOG.verbose("Get instance, all=%s." % msg.get_all)
|
||||
instance_table = tables.tables_get_instance_table()
|
||||
for instance in instance_table.values():
|
||||
for instance in list(instance_table.values()):
|
||||
response = rpc.APIResponseGetInstance()
|
||||
response.uuid = instance.uuid
|
||||
response.name = instance.name
|
||||
|
|
|
@ -502,7 +502,7 @@ def vim_network_api_get_networks(connection, msg):
|
|||
"""
|
||||
DLOG.verbose("Get network, all=%s." % msg.get_all)
|
||||
network_table = tables.tables_get_network_table()
|
||||
for network in network_table.values():
|
||||
for network in list(network_table.values()):
|
||||
response = rpc.APIResponseGetNetwork()
|
||||
response.uuid = network.uuid
|
||||
response.name = network.name
|
||||
|
|
|
@ -507,7 +507,7 @@ def _nfvi_periodic_timer_event():
|
|||
DLOG.verbose("NFVI periodic timer called, timer_id=%s." % timer_id)
|
||||
|
||||
host_table = tables.tables_get_host_table()
|
||||
for host in host_table.values():
|
||||
for host in list(host_table.values()):
|
||||
host.periodic_timer()
|
||||
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ def vim_volume_api_get_volumes(connection, msg):
|
|||
"""
|
||||
DLOG.verbose("Get volume, all=%s." % msg.get_all)
|
||||
volume_table = tables.tables_get_volume_table()
|
||||
for volume in volume_table.values():
|
||||
for volume in list(volume_table.values()):
|
||||
response = rpc.APIResponseGetVolume()
|
||||
response.uuid = volume.uuid
|
||||
response.name = volume.name
|
||||
|
|
|
@ -137,5 +137,5 @@ def nfvi_finalize():
|
|||
nfvi_sw_mgmt_finalize()
|
||||
nfvi_fault_mgmt_finalize()
|
||||
|
||||
for pool in _task_worker_pools.values():
|
||||
for pool in list(_task_worker_pools.values()):
|
||||
pool.shutdown()
|
||||
|
|
|
@ -268,7 +268,7 @@ class SwUpdateStrategy(strategy.Strategy):
|
|||
# service disruption when the remaining instances are stopped or
|
||||
# migrated.
|
||||
if reboot:
|
||||
for instance in instance_table.values():
|
||||
for instance in list(instance_table.values()):
|
||||
if instance.is_locked():
|
||||
for instance_group in instance_group_table.get_by_instance(
|
||||
instance.uuid):
|
||||
|
@ -1268,7 +1268,7 @@ class SwPatchStrategy(SwUpdateStrategy,
|
|||
self.save()
|
||||
return
|
||||
|
||||
for host in host_table.values():
|
||||
for host in list(host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality and \
|
||||
HOST_PERSONALITY.CONTROLLER not in host.personality:
|
||||
# Allow patch orchestration when worker hosts are available,
|
||||
|
@ -1922,7 +1922,7 @@ class SwUpgradeStrategy(SwUpdateStrategy):
|
|||
return
|
||||
|
||||
host_table = tables.tables_get_host_table()
|
||||
for host in host_table.values():
|
||||
for host in list(host_table.values()):
|
||||
# Only allow upgrade orchestration when all hosts are
|
||||
# available. It is not safe to automate upgrade application
|
||||
# when we do not have full redundancy.
|
||||
|
@ -1951,7 +1951,7 @@ class SwUpgradeStrategy(SwUpdateStrategy):
|
|||
self._add_upgrade_start_stage()
|
||||
|
||||
# All hosts will be upgraded
|
||||
for host in host_table.values():
|
||||
for host in list(host_table.values()):
|
||||
if HOST_PERSONALITY.CONTROLLER in host.personality:
|
||||
controller_hosts.append(host)
|
||||
|
||||
|
@ -1963,7 +1963,7 @@ class SwUpgradeStrategy(SwUpdateStrategy):
|
|||
else:
|
||||
# Only hosts not yet upgraded will be upgraded
|
||||
to_load = self.nfvi_upgrade.to_release
|
||||
for host in host_table.values():
|
||||
for host in list(host_table.values()):
|
||||
if host.software_load == to_load:
|
||||
# No need to upgrade this host
|
||||
continue
|
||||
|
@ -2147,7 +2147,7 @@ class FwUpdateStrategy(SwUpdateStrategy):
|
|||
|
||||
# using existing vim host inventory add a step for each host
|
||||
host_table = tables.tables_get_host_table()
|
||||
for host in host_table.values():
|
||||
for host in list(host_table.values()):
|
||||
if HOST_PERSONALITY.WORKER in host.personality:
|
||||
if host.is_unlocked() and host.is_enabled():
|
||||
stage.add_step(strategy.QueryFwUpdateHostStep(host))
|
||||
|
@ -2334,7 +2334,7 @@ class FwUpdateStrategy(SwUpdateStrategy):
|
|||
|
||||
worker_hosts = list()
|
||||
host_table = tables.tables_get_host_table()
|
||||
for host in host_table.values():
|
||||
for host in list(host_table.values()):
|
||||
if host.name in self._fw_update_hosts:
|
||||
worker_hosts.append(host)
|
||||
|
||||
|
@ -2742,7 +2742,7 @@ class KubeUpgradeStrategy(SwUpdateStrategy,
|
|||
|
||||
# todo(abailey): refactor the code duplication from SwPatch
|
||||
host_table = tables.tables_get_host_table()
|
||||
for host in host_table.values():
|
||||
for host in list(host_table.values()):
|
||||
# filter the host out if we do not need to patch it
|
||||
current, reboot = self._check_host_patch(host,
|
||||
patches_to_apply)
|
||||
|
@ -2842,7 +2842,7 @@ class KubeUpgradeStrategy(SwUpdateStrategy,
|
|||
# group the hosts by their type (controller, storage, worker)
|
||||
# place each controller in a separate list
|
||||
# there are no kubelets running on storage nodes
|
||||
for host in host_table.values():
|
||||
for host in list(host_table.values()):
|
||||
if kubelet_map.get(host.uuid) == self._to_version:
|
||||
DLOG.info("Host %s kubelet already up to date" % host.name)
|
||||
continue
|
||||
|
|
|
@ -1233,7 +1233,7 @@ class MigrateInstancesStep(strategy.StrategyStep):
|
|||
Returns true if all instances have migrated from the source hosts
|
||||
"""
|
||||
source_host_names = []
|
||||
for host_name in self._instance_host_names.values():
|
||||
for host_name in list(self._instance_host_names.values()):
|
||||
if host_name not in source_host_names:
|
||||
source_host_names.append(host_name)
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class HypervisorTable(Table):
|
|||
super(HypervisorTable, self).__init__()
|
||||
|
||||
def get_by_host_name(self, host_name, default=None):
|
||||
for hypervisor in self._entries.values():
|
||||
for hypervisor in list(self._entries.values()):
|
||||
if hypervisor.host_name == host_name:
|
||||
return hypervisor
|
||||
return default
|
||||
|
|
|
@ -18,12 +18,12 @@ class InstanceTable(Table):
|
|||
super(InstanceTable, self).__init__()
|
||||
|
||||
def on_host(self, host_name):
|
||||
for instance in self._entries.values():
|
||||
for instance in list(self._entries.values()):
|
||||
if instance.on_host(host_name):
|
||||
yield instance
|
||||
|
||||
def exist_on_host(self, host_name):
|
||||
for instance in self._entries.values():
|
||||
for instance in list(self._entries.values()):
|
||||
if instance.on_host(host_name):
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -33,7 +33,7 @@ class SubnetTable(Table):
|
|||
return None
|
||||
|
||||
def on_network(self, network_uuid):
|
||||
for subnet in self._entries.values():
|
||||
for subnet in list(self._entries.values()):
|
||||
if network_uuid == subnet.network_uuid:
|
||||
yield subnet
|
||||
|
||||
|
|
Loading…
Reference in New Issue