Removing vm size from candidate list if the candidate vm size gen conflict with current vm size gen

This commit is contained in:
Lili Deng 2022-12-29 20:18:47 +08:00 коммит произвёл LiliDeng
Родитель 460e5a2d5a
Коммит 236c34829e
2 изменённых файлов: 22 добавлений и 1 удалений

Просмотреть файл

@ -1351,6 +1351,11 @@ class Resize(AzureFeatureMixin, features.Resize):
for feature in current_vm_size.capability.features
if feature.type == ArchitectureSettings.type
]
current_gen = [
feature
for feature in current_vm_size.capability.features
if feature.type == VhdGenerationSettings.type
]
# Loop removes candidate vm sizes if they can't be resized to or if the
# change in cores resulting from the resize is undesired
for candidate_size in avail_eligible_intersect[:]:
@ -1369,6 +1374,22 @@ class Resize(AzureFeatureMixin, features.Resize):
avail_eligible_intersect.remove(candidate_size)
continue
candidate_gen = [
feature
for feature in candidate_size.capability.features
if feature.type == VhdGenerationSettings.type
]
if isinstance(current_gen[0], VhdGenerationSettings) and isinstance(
candidate_gen[0], VhdGenerationSettings
):
result = search_space.check_setspace(
current_gen[0].gen, candidate_gen[0].gen
)
# Removing vm size from candidate list if the candidate vhd gen type is
# different with current vm size gen type
if not result.result:
avail_eligible_intersect.remove(candidate_size)
continue
candidate_network_interface = candidate_size.capability.network_interface
assert_that(candidate_network_interface).described_as(
"candidate_network_interface is not of type "

Просмотреть файл

@ -1187,7 +1187,7 @@ class AzurePlatform(Platform):
else:
log.debug(
"there is no way to detect vhd generation, unless user provides it"
f"current vhd generation is {azure_node_runbook.hyperv_generation}"
f" current vhd generation is {azure_node_runbook.hyperv_generation}"
)
if azure_node_runbook.is_linux is None: