From 4eb510aac7b902557830340641998c130d021d91 Mon Sep 17 00:00:00 2001 From: Divyansh Date: Mon, 23 May 2022 10:14:12 -0700 Subject: [PATCH 1/2] Update VM families with no resource disk --- lisa/sut_orchestrator/azure/platform_.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisa/sut_orchestrator/azure/platform_.py b/lisa/sut_orchestrator/azure/platform_.py index b0856e6aa7..48744417c2 100644 --- a/lisa/sut_orchestrator/azure/platform_.py +++ b/lisa/sut_orchestrator/azure/platform_.py @@ -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: From 1e5d1d9c164fef151282552c0483fcffb5b6ee28 Mon Sep 17 00:00:00 2001 From: Divyansh Date: Wed, 25 May 2022 08:33:09 -0700 Subject: [PATCH 2/2] Fix intersection in AzureDiskOptionSettings --- lisa/schema.py | 28 +++++++++++++++++++++---- lisa/sut_orchestrator/azure/features.py | 7 +++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/lisa/schema.py b/lisa/schema.py index 2986e1b812..49b329fdba 100644 --- a/lisa/schema.py +++ b/lisa/schema.py @@ -22,6 +22,7 @@ BaseClassMixin, LisaException, constants, + deep_update_dict, field_metadata, strip_strs, ) @@ -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): @@ -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" ) @@ -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 diff --git a/lisa/sut_orchestrator/azure/features.py b/lisa/sut_orchestrator/azure/features.py index 124577e59c..9142f1e937 100644 --- a/lisa/sut_orchestrator/azure/features.py +++ b/lisa/sut_orchestrator/azure/features.py @@ -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