Fix conditionals/types in check_flavors and verify_profiles

Existing resources "DISK_GB", "MEMORY_MB", "VCPU" were not considered to
be available in case of custom_resource_class_val == False, also use correct
types for resource comparison and required_count calculation.

Change-Id: Ia194cebaeb7dcc40b4011e50cdde7648b4bf87b1
Closes-Bug: #1905018
This commit is contained in:
Martin Schuppert 2020-11-20 13:01:52 +01:00
parent 3e4d00446f
commit 3221727a8d
3 changed files with 11 additions and 4 deletions

View File

@ -139,14 +139,15 @@ def validate_roles_and_flavors(roles_info, flavors):
if not custom_resource_class:
errors.append(resource_class_missing.format(
flavor_name))
if not custom_resource_class_val:
if key not in ["DISK_GB", "MEMORY_MB", "VCPU"] and \
not custom_resource_class_val:
errors.append(resource_class_value_incorrect.
format(flavor_name))
disk = resource_specs.get("DISK_GB", None)
memory = resource_specs.get("MEMORY_MB", None)
vcpu = resource_specs.get("VCPU", None)
if any(int(resource) != 0 for resource in [disk, memory,
vcpu]):
if any(int(resource) != 0 for resource in [disk,
memory, vcpu]):
errors.append(disable_standard_scheduling.
format(flavor_name))

View File

@ -109,7 +109,7 @@ def verify_profiles(nodes, flavors):
assigned_nodes = [uu for uu, caps in free_node_caps.items()
if caps.get('profile') == profile]
required_count = scale - len(assigned_nodes)
required_count = int(scale) - len(assigned_nodes)
if required_count < 0:
warnings.append('%d nodes with profile %s won\'t be used '

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Existing resources "DISK_GB", "MEMORY_MB", "VCPU" were not considered to
be available in case of custom_resource_class_val == False, also use correct
types for resource comparison and required_count calculation.