Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions lisa/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
BaseClassMixin,
LisaException,
constants,
deep_update_dict,
field_metadata,
strip_strs,
)
Expand Down Expand Up @@ -380,10 +381,20 @@ def _get_key(self) -> str:

def _call_requirement_method(self, method_name: str, capability: Any) -> Any:
# default FeatureSetting is a place holder, nothing to do.
extended_schemas = None
if hasattr(capability, "extended_schemas"):
extended_schemas = capability.extended_schemas
return FeatureSettings.create(self.type, extended_schemas=extended_schemas)
value = FeatureSettings.create(self.type)

# intersect the extended schemas
if (
self.extended_schemas
and method_name == search_space.RequirementMethod.intersect
):
if capability is not None:
value.extended_schemas = deep_update_dict(
self.extended_schemas,
capability.extended_schemas,
)

return value


class DiskType(str, Enum):
Expand Down Expand Up @@ -517,7 +528,12 @@ def _get_key(self) -> str:

def _call_requirement_method(self, method_name: str, capability: Any) -> Any:
assert isinstance(capability, DiskOptionSettings), f"actual: {type(capability)}"
parent_value = super()._call_requirement_method(method_name, capability)

# convert parent type to child type
value = DiskOptionSettings()
value.extended_schemas = parent_value.extended_schemas

search_space_countspace_method = getattr(
search_space, f"{method_name}_countspace"
)
Expand Down Expand Up @@ -648,7 +664,11 @@ def _call_requirement_method(self, method_name: str, capability: Any) -> Any:
assert isinstance(
capability, NetworkInterfaceOptionSettings
), f"actual: {type(capability)}"
parent_value = super()._call_requirement_method(method_name, capability)

# convert parent type to child type
value = NetworkInterfaceOptionSettings()
value.extended_schemas = parent_value.extended_schemas

value.max_nic_count = getattr(search_space, f"{method_name}_countspace")(
self.max_nic_count, capability.max_nic_count
Expand Down
7 changes: 7 additions & 0 deletions lisa/sut_orchestrator/azure/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,13 @@ def _call_requirement_method(self, method_name: str, capability: Any) -> Any:
value.data_disk_size = self._get_disk_size_from_iops(
value.data_disk_iops, disk_type_iops
)
elif method_name == RequirementMethod.intersect:
value.data_disk_iops = search_space.intersect_countspace(
self.data_disk_iops, capability.data_disk_iops
)
value.data_disk_size = search_space.intersect_countspace(
self.data_disk_size, capability.data_disk_size
)

# all caching types are supported, so just take the value from requirement.
value.data_disk_caching_type = self.data_disk_caching_type
Expand Down
8 changes: 8 additions & 0 deletions lisa/sut_orchestrator/azure/platform_.py
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,14 @@ def _resource_sku_to_capability( # noqa: C901
"standardEv4Family",
"standardESv4Family",
"standardEASv4Family",
"standardEASv5Family",
"standardESv5Family",
"standardEADSv5Family",
"standardDASv5Family",
"standardDSv5Family",
"standardFSv2Family",
"standardNCFamily",
"standardESv3Family",
]:
node_space.disk.has_resource_disk = False
else:
Expand Down