Rename disk_type to data_disk_type

Also change all the test requirements to set both data disk and os disk types as to keep the same behavior as before.
This commit is contained in:
Kameron Carr 2023-08-01 14:30:18 -07:00 коммит произвёл LiliDeng
Родитель be948728d7
Коммит ba04ef56b7
13 изменённых файлов: 96 добавлений и 78 удалений

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

@ -70,19 +70,19 @@ DiskEphemeral = partial(
)
DiskPremiumSSDLRS = partial(
schema.DiskOptionSettings,
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
)
DiskStandardHDDLRS = partial(
schema.DiskOptionSettings,
disk_type=schema.DiskType.StandardHDDLRS,
data_disk_type=schema.DiskType.StandardHDDLRS,
os_disk_type=schema.DiskType.StandardHDDLRS,
)
DiskStandardSSDLRS = partial(
schema.DiskOptionSettings,
disk_type=schema.DiskType.StandardSSDLRS,
data_disk_type=schema.DiskType.StandardSSDLRS,
os_disk_type=schema.DiskType.StandardSSDLRS,
)
DiskUltraSSDLRS = partial(
schema.DiskOptionSettings, disk_type=schema.DiskType.UltraSSDLRS
schema.DiskOptionSettings, data_disk_type=schema.DiskType.UltraSSDLRS
)

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

@ -453,7 +453,7 @@ class DiskOptionSettings(FeatureSettings):
decoder=partial(search_space.decode_set_space_by_type, base_type=DiskType)
),
)
disk_type: Optional[
data_disk_type: Optional[
Union[search_space.SetSpace[DiskType], DiskType]
] = field( # type:ignore
default_factory=partial(
@ -531,7 +531,7 @@ class DiskOptionSettings(FeatureSettings):
return (
self.type == o.type
and self.os_disk_type == o.os_disk_type
and self.disk_type == o.disk_type
and self.data_disk_type == o.data_disk_type
and self.data_disk_count == o.data_disk_count
and self.data_disk_caching_type == o.data_disk_caching_type
and self.data_disk_iops == o.data_disk_iops
@ -543,7 +543,7 @@ class DiskOptionSettings(FeatureSettings):
def __repr__(self) -> str:
return (
f"os_disk_type: {self.os_disk_type},"
f"disk_type: {self.disk_type},"
f"data_disk_type: {self.data_disk_type},"
f"count: {self.data_disk_count},"
f"caching: {self.data_disk_caching_type},"
f"iops: {self.data_disk_iops},"
@ -583,7 +583,7 @@ class DiskOptionSettings(FeatureSettings):
def _get_key(self) -> str:
return (
f"{super()._get_key()}/{self.os_disk_type}/{self.disk_type}/"
f"{super()._get_key()}/{self.os_disk_type}/{self.data_disk_type}/"
f"{self.data_disk_count}/{self.data_disk_caching_type}/"
f"{self.data_disk_iops}/{self.data_disk_size}/"
f"{self.disk_controller_type}"
@ -606,10 +606,10 @@ class DiskOptionSettings(FeatureSettings):
value.os_disk_type = getattr(
search_space, f"{method.value}_setspace_by_priority"
)(self.os_disk_type, capability.os_disk_type, disk_type_priority)
if self.disk_type or capability.disk_type:
value.disk_type = getattr(
if self.data_disk_type or capability.data_disk_type:
value.data_disk_type = getattr(
search_space, f"{method.value}_setspace_by_priority"
)(self.disk_type, capability.disk_type, disk_type_priority)
)(self.data_disk_type, capability.data_disk_type, disk_type_priority)
if self.data_disk_count or capability.data_disk_count:
value.data_disk_count = search_space_countspace_method(
self.data_disk_count, capability.data_disk_count

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

@ -367,7 +367,7 @@ class AwsDiskOptionSettings(schema.DiskOptionSettings):
result = super().check(capability)
result.merge(
search_space.check_setspace(self.disk_type, capability.disk_type),
search_space.check_setspace(self.data_disk_type, capability.data_disk_type),
"disk_type",
)
result.merge(
@ -405,7 +405,7 @@ class AwsDiskOptionSettings(schema.DiskOptionSettings):
), f"actual: {type(capability)}"
assert (
capability.disk_type
capability.data_disk_type
), "capability should have at least one disk type, but it's None"
value = AwsDiskOptionSettings()
super_value = schema.DiskOptionSettings._call_requirement_method(
@ -413,7 +413,7 @@ class AwsDiskOptionSettings(schema.DiskOptionSettings):
)
set_filtered_fields(super_value, value, ["data_disk_count"])
cap_disk_type = capability.disk_type
cap_disk_type = capability.data_disk_type
if isinstance(cap_disk_type, search_space.SetSpace):
assert (
len(cap_disk_type) > 0
@ -427,9 +427,9 @@ class AwsDiskOptionSettings(schema.DiskOptionSettings):
f"unknown disk type on capability, type: {cap_disk_type}"
)
value.disk_type = getattr(search_space, f"{method.value}_setspace_by_priority")(
self.disk_type, capability.disk_type, schema.disk_type_priority
)
value.data_disk_type = getattr(
search_space, f"{method.value}_setspace_by_priority"
)(self.data_disk_type, capability.data_disk_type, schema.disk_type_priority)
# below values affect data disk only.
if self.data_disk_count is not None or capability.data_disk_count is not None:
@ -452,9 +452,9 @@ class AwsDiskOptionSettings(schema.DiskOptionSettings):
if method == RequirementMethod.generate_min_capability:
assert isinstance(
value.disk_type, schema.DiskType
), f"actual: {type(value.disk_type)}"
disk_type_iops = _disk_size_iops_map.get(value.disk_type, None)
value.data_disk_type, schema.DiskType
), f"actual: {type(value.data_disk_type)}"
disk_type_iops = _disk_size_iops_map.get(value.data_disk_type, None)
# ignore unsupported disk type like Ephemeral. It supports only os
# disk. Calculate for iops, if it has value. If not, try disk size
if disk_type_iops:

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

@ -614,9 +614,9 @@ class AwsPlatform(Platform):
# Set disk type
assert node_space.disk, "node space must have disk defined."
assert isinstance(node_space.disk.disk_type, schema.DiskType)
assert isinstance(node_space.disk.data_disk_type, schema.DiskType)
aws_node_runbook.disk_type = features.get_aws_disk_type(
node_space.disk.disk_type
node_space.disk.data_disk_type
)
aws_node_runbook.data_disk_caching_type = node_space.disk.data_disk_caching_type
assert isinstance(
@ -1021,7 +1021,7 @@ class AwsPlatform(Platform):
is_allow_set=True
)
node_space.disk = features.AwsDiskOptionSettings()
node_space.disk.disk_type = search_space.SetSpace[schema.DiskType](
node_space.disk.data_disk_type = search_space.SetSpace[schema.DiskType](
is_allow_set=True, items=[]
)
node_space.disk.data_disk_iops = search_space.IntRange(min=0)
@ -1060,9 +1060,9 @@ class AwsPlatform(Platform):
schema.FeatureSettings.create(features.SerialConsole.name()),
]
)
node_space.disk.disk_type.add(schema.DiskType.StandardHDDLRS)
node_space.disk.disk_type.add(schema.DiskType.StandardSSDLRS)
node_space.disk.disk_type.add(schema.DiskType.PremiumSSDLRS)
node_space.disk.data_disk_type.add(schema.DiskType.StandardHDDLRS)
node_space.disk.data_disk_type.add(schema.DiskType.StandardSSDLRS)
node_space.disk.data_disk_type.add(schema.DiskType.PremiumSSDLRS)
node_space.network_interface.data_path.add(schema.NetworkDataPath.Synthetic)
return node_space

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

@ -395,7 +395,7 @@
"storageUri": "[reference(resourceId(parameters('shared_resource_group_name'), 'Microsoft.Storage/storageAccounts', parameters('storage_name')), '2015-06-15').primaryEndpoints['blob']]"
}
},
"additionalCapabilities": "[if(equals(parameters('nodes')[copyIndex('vmCopy')]['disk_type'], 'UltraSSD_LRS'), json('{\"ultraSSDEnabled\": true}'), json('null'))]",
"additionalCapabilities": "[if(equals(parameters('nodes')[copyIndex('vmCopy')]['data_disk_type'], 'UltraSSD_LRS'), json('{\"ultraSSDEnabled\": true}'), json('null'))]",
"securityProfile": "[if(empty(parameters('nodes')[copyIndex('vmCopy')]['security_profile']), json('null'), lisa.getSecurityProfile(parameters('nodes')[copyIndex('vmCopy')]['security_profile']))]"
}
}

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

@ -253,7 +253,7 @@ class AzureNodeSchema:
"vhd_raw",
"data_disk_caching_type",
"os_disk_type",
"disk_type",
"data_disk_type",
],
)
# If vhd contains sas token, need add mask
@ -450,7 +450,7 @@ class AzureNodeArmParameter(AzureNodeSchema):
nic_count: int = 1
enable_sriov: bool = False
os_disk_type: str = ""
disk_type: str = ""
data_disk_type: str = ""
disk_controller_type: str = ""
security_profile: Dict[str, Any] = field(default_factory=dict)

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

@ -938,7 +938,7 @@ class AzureDiskOptionSettings(schema.DiskOptionSettings):
"os_disk_type",
)
result.merge(
search_space.check_setspace(self.disk_type, capability.disk_type),
search_space.check_setspace(self.data_disk_type, capability.data_disk_type),
"disk_type",
)
result.merge(
@ -991,7 +991,7 @@ class AzureDiskOptionSettings(schema.DiskOptionSettings):
capability.os_disk_type
), "capability should have at least one OS disk type, but it's None"
assert (
capability.disk_type
capability.data_disk_type
), "capability should have at least one disk type, but it's None"
assert (
capability.disk_controller_type
@ -1020,7 +1020,7 @@ class AzureDiskOptionSettings(schema.DiskOptionSettings):
search_space, f"{method.value}_setspace_by_priority"
)(self.os_disk_type, capability.os_disk_type, schema.disk_type_priority)
cap_disk_type = capability.disk_type
cap_disk_type = capability.data_disk_type
if isinstance(cap_disk_type, search_space.SetSpace):
assert (
len(cap_disk_type) > 0
@ -1034,9 +1034,9 @@ class AzureDiskOptionSettings(schema.DiskOptionSettings):
f"unknown disk type on capability, type: {cap_disk_type}"
)
value.disk_type = getattr(search_space, f"{method.value}_setspace_by_priority")(
self.disk_type, capability.disk_type, schema.disk_type_priority
)
value.data_disk_type = getattr(
search_space, f"{method.value}_setspace_by_priority"
)(self.data_disk_type, capability.data_disk_type, schema.disk_type_priority)
cap_disk_controller_type = capability.disk_controller_type
if isinstance(cap_disk_controller_type, search_space.SetSpace):
@ -1083,9 +1083,9 @@ class AzureDiskOptionSettings(schema.DiskOptionSettings):
if method == RequirementMethod.generate_min_capability:
assert isinstance(
value.disk_type, schema.DiskType
), f"actual: {type(value.disk_type)}"
disk_type_iops = _disk_size_iops_map.get(value.disk_type, None)
value.data_disk_type, schema.DiskType
), f"actual: {type(value.data_disk_type)}"
disk_type_iops = _disk_size_iops_map.get(value.data_disk_type, None)
# ignore unsupported disk type like Ephemeral. It supports only os
# disk. Calculate for iops, if it has value. If not, try disk size
if disk_type_iops:
@ -1140,7 +1140,7 @@ class AzureDiskOptionSettings(schema.DiskOptionSettings):
value.data_disk_size = self._get_disk_size_from_iops(
value.data_disk_iops, disk_type_iops
)
elif value.disk_type == schema.DiskType.UltraSSDLRS:
elif value.data_disk_type == schema.DiskType.UltraSSDLRS:
req_disk_size = search_space.count_space_to_int_range(
self.data_disk_size
)

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

@ -1401,9 +1401,9 @@ class AzurePlatform(Platform):
arm_parameters.os_disk_type = features.get_azure_disk_type(
capability.disk.os_disk_type
)
assert isinstance(capability.disk.disk_type, schema.DiskType)
arm_parameters.disk_type = features.get_azure_disk_type(
capability.disk.disk_type
assert isinstance(capability.disk.data_disk_type, schema.DiskType)
arm_parameters.data_disk_type = features.get_azure_disk_type(
capability.disk.data_disk_type
)
assert isinstance(
capability.disk.disk_controller_type, schema.DiskControllerType
@ -1637,7 +1637,7 @@ class AzurePlatform(Platform):
node_space.disk.os_disk_type = search_space.SetSpace[schema.DiskType](
is_allow_set=True, items=[]
)
node_space.disk.disk_type = search_space.SetSpace[schema.DiskType](
node_space.disk.data_disk_type = search_space.SetSpace[schema.DiskType](
is_allow_set=True, items=[]
)
node_space.disk.disk_controller_type = search_space.SetSpace[
@ -1696,10 +1696,10 @@ class AzurePlatform(Platform):
if azure_raw_capabilities.get("PremiumIO", None) == "True":
node_space.disk.os_disk_type.add(schema.DiskType.PremiumSSDLRS)
node_space.disk.disk_type.add(schema.DiskType.PremiumSSDLRS)
node_space.disk.data_disk_type.add(schema.DiskType.PremiumSSDLRS)
if azure_raw_capabilities.get("UltraSSDAvailable", None) == "True":
node_space.disk.disk_type.add(schema.DiskType.UltraSSDLRS)
node_space.disk.data_disk_type.add(schema.DiskType.UltraSSDLRS)
disk_controller_types = azure_raw_capabilities.get("DiskControllerTypes", None)
if disk_controller_types:
@ -1823,8 +1823,8 @@ class AzurePlatform(Platform):
node_space.disk.os_disk_type.add(schema.DiskType.StandardHDDLRS)
node_space.disk.os_disk_type.add(schema.DiskType.StandardSSDLRS)
node_space.disk.disk_type.add(schema.DiskType.StandardHDDLRS)
node_space.disk.disk_type.add(schema.DiskType.StandardSSDLRS)
node_space.disk.data_disk_type.add(schema.DiskType.StandardHDDLRS)
node_space.disk.data_disk_type.add(schema.DiskType.StandardSSDLRS)
node_space.network_interface.data_path.add(schema.NetworkDataPath.Synthetic)
return node_space
@ -1999,13 +1999,13 @@ class AzurePlatform(Platform):
node_space.disk.os_disk_type.add(schema.DiskType.Ephemeral)
node_space.disk.os_disk_type.add(schema.DiskType.StandardHDDLRS)
node_space.disk.os_disk_type.add(schema.DiskType.StandardSSDLRS)
node_space.disk.disk_type = search_space.SetSpace[schema.DiskType](
node_space.disk.data_disk_type = search_space.SetSpace[schema.DiskType](
is_allow_set=True, items=[]
)
node_space.disk.disk_type.add(schema.DiskType.UltraSSDLRS)
node_space.disk.disk_type.add(schema.DiskType.PremiumSSDLRS)
node_space.disk.disk_type.add(schema.DiskType.StandardHDDLRS)
node_space.disk.disk_type.add(schema.DiskType.StandardSSDLRS)
node_space.disk.data_disk_type.add(schema.DiskType.UltraSSDLRS)
node_space.disk.data_disk_type.add(schema.DiskType.PremiumSSDLRS)
node_space.disk.data_disk_type.add(schema.DiskType.StandardHDDLRS)
node_space.disk.data_disk_type.add(schema.DiskType.StandardSSDLRS)
node_space.disk.disk_controller_type = search_space.SetSpace[
schema.DiskControllerType
](is_allow_set=True, items=[])
@ -2092,7 +2092,7 @@ class AzurePlatform(Platform):
_get_disk_size_in_gb(
default_data_disk.additional_properties
),
azure_node_runbook.disk_type,
azure_node_runbook.data_disk_type,
DataDiskCreateOption.DATADISK_CREATE_OPTION_TYPE_FROM_IMAGE,
)
)
@ -2105,7 +2105,7 @@ class AzurePlatform(Platform):
DataDiskSchema(
node.capability.disk.data_disk_caching_type,
node.capability.disk.data_disk_size,
azure_node_runbook.disk_type,
azure_node_runbook.data_disk_type,
DataDiskCreateOption.DATADISK_CREATE_OPTION_TYPE_EMPTY,
)
)

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

@ -85,7 +85,8 @@ class KVMPerformance(TestSuite): # noqa
timeout=_TIME_OUT,
requirement=simple_requirement(
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=2),
),
@ -111,7 +112,8 @@ class KVMPerformance(TestSuite): # noqa
timeout=_TIME_OUT,
requirement=simple_requirement(
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=7),
),
@ -139,7 +141,8 @@ class KVMPerformance(TestSuite): # noqa
supported_os=[Windows],
supported_platform_type=[AZURE, READY],
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.StandardSSDLRS,
data_disk_type=schema.DiskType.StandardSSDLRS,
os_disk_type=schema.DiskType.StandardSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=1),
),
@ -166,7 +169,8 @@ class KVMPerformance(TestSuite): # noqa
supported_os=[Windows],
supported_platform_type=[AZURE, READY],
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.StandardSSDLRS,
data_disk_type=schema.DiskType.StandardSSDLRS,
os_disk_type=schema.DiskType.StandardSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=6),
),

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

@ -54,7 +54,8 @@ class StoragePerformance(TestSuite):
timeout=TIME_OUT,
requirement=simple_requirement(
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=16),
),
@ -71,7 +72,8 @@ class StoragePerformance(TestSuite):
timeout=TIME_OUT,
requirement=simple_requirement(
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=16),
),
@ -88,7 +90,8 @@ class StoragePerformance(TestSuite):
timeout=TIME_OUT,
requirement=simple_requirement(
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=24),
),
@ -107,7 +110,8 @@ class StoragePerformance(TestSuite):
requirement=simple_requirement(
min_count=2,
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=12),
data_disk_size=search_space.IntRange(min=10),
@ -128,7 +132,8 @@ class StoragePerformance(TestSuite):
requirement=simple_requirement(
min_count=2,
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=12),
data_disk_size=search_space.IntRange(min=10),
@ -149,7 +154,8 @@ class StoragePerformance(TestSuite):
requirement=simple_requirement(
min_count=2,
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=12),
data_disk_size=search_space.IntRange(min=10),
@ -170,7 +176,8 @@ class StoragePerformance(TestSuite):
requirement=simple_requirement(
min_count=2,
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=5000),
data_disk_count=search_space.IntRange(min=12),
data_disk_size=search_space.IntRange(min=10),

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

@ -62,7 +62,8 @@ class StorageTest(TestSuite):
priority=3,
requirement=simple_requirement(
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.StandardHDDLRS,
data_disk_type=schema.DiskType.StandardHDDLRS,
os_disk_type=schema.DiskType.StandardHDDLRS,
data_disk_iops=search_space.IntRange(min=500),
data_disk_count=search_space.IntRange(min=64),
),

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

@ -146,7 +146,8 @@ class Xfstesting(TestSuite):
""",
requirement=simple_requirement(
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.StandardHDDLRS,
data_disk_type=schema.DiskType.StandardHDDLRS,
os_disk_type=schema.DiskType.StandardHDDLRS,
data_disk_iops=500,
data_disk_count=search_space.IntRange(min=1),
),
@ -181,7 +182,8 @@ class Xfstesting(TestSuite):
""",
requirement=simple_requirement(
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.StandardHDDLRS,
data_disk_type=schema.DiskType.StandardHDDLRS,
os_disk_type=schema.DiskType.StandardHDDLRS,
data_disk_iops=500,
data_disk_count=search_space.IntRange(min=1),
),
@ -215,7 +217,8 @@ class Xfstesting(TestSuite):
""",
requirement=simple_requirement(
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.StandardHDDLRS,
data_disk_type=schema.DiskType.StandardHDDLRS,
os_disk_type=schema.DiskType.StandardHDDLRS,
data_disk_iops=500,
data_disk_count=search_space.IntRange(min=1),
),
@ -250,7 +253,8 @@ class Xfstesting(TestSuite):
""",
requirement=simple_requirement(
disk=schema.DiskOptionSettings(
disk_type=schema.DiskType.StandardHDDLRS,
data_disk_type=schema.DiskType.StandardHDDLRS,
os_disk_type=schema.DiskType.StandardHDDLRS,
data_disk_iops=500,
data_disk_count=search_space.IntRange(min=1),
),

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

@ -23,7 +23,7 @@ class AzureDiskFeatureTestCase(TestCase):
def test_disk_type_overlap(self) -> None:
# req and cap both have DiskPremiumSSDLRS, so it's selected
req = features.AzureDiskOptionSettings(
disk_type=search_space.SetSpace[schema.DiskType](
data_disk_type=search_space.SetSpace[schema.DiskType](
items=[schema.DiskType.PremiumSSDLRS, schema.DiskType.StandardSSDLRS]
)
)
@ -40,7 +40,7 @@ class AzureDiskFeatureTestCase(TestCase):
def test_disk_type_no_common(self) -> None:
# req and cap has no common disk type
req = features.AzureDiskOptionSettings(
disk_type=search_space.SetSpace[schema.DiskType](
data_disk_type=search_space.SetSpace[schema.DiskType](
items=[schema.DiskType.StandardSSDLRS]
)
)
@ -90,7 +90,8 @@ class AzureDiskFeatureTestCase(TestCase):
# given a range of iops, match min one in range
req = features.AzureDiskOptionSettings(
data_disk_count=1,
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=1800, max=8000),
)
cap = self._get_default_cap()
@ -106,7 +107,8 @@ class AzureDiskFeatureTestCase(TestCase):
# given a range of iops on req and cap, match min one in range
req = features.AzureDiskOptionSettings(
data_disk_count=1,
disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_type=schema.DiskType.PremiumSSDLRS,
os_disk_type=schema.DiskType.PremiumSSDLRS,
data_disk_iops=search_space.IntRange(min=1800, max=8000),
)
cap = self._get_default_cap()
@ -122,7 +124,7 @@ class AzureDiskFeatureTestCase(TestCase):
def test_disk_specify_iops_use_premium(self) -> None:
# given premium disk type
req = features.AzureDiskOptionSettings(
disk_type=search_space.SetSpace[schema.DiskType](
data_disk_type=search_space.SetSpace[schema.DiskType](
items=[schema.DiskType.PremiumSSDLRS]
),
data_disk_count=1,
@ -154,7 +156,7 @@ class AzureDiskFeatureTestCase(TestCase):
def test_disk_specify_disk_size_a_range(self) -> None:
# given a range to disk size, match the min one in range
req = features.AzureDiskOptionSettings(
disk_type=search_space.SetSpace[schema.DiskType](
data_disk_type=search_space.SetSpace[schema.DiskType](
items=[schema.DiskType.PremiumSSDLRS]
),
data_disk_count=1,
@ -182,7 +184,7 @@ class AzureDiskFeatureTestCase(TestCase):
reason = req.check(cap)
self.assertTrue(reason.result, f"check reasons: {reason.reasons}")
min_value: features.AzureDiskOptionSettings = req.generate_min_capability(cap)
self.assertEqual(disk_type, min_value.disk_type)
self.assertEqual(disk_type, min_value.data_disk_type)
self.assertEqual(data_disk_count, min_value.data_disk_count)
self.assertEqual(data_disk_caching_type, min_value.data_disk_caching_type)
self.assertEqual(data_disk_iops, min_value.data_disk_iops)
@ -190,7 +192,7 @@ class AzureDiskFeatureTestCase(TestCase):
def _get_default_cap(self) -> features.AzureDiskOptionSettings:
return features.AzureDiskOptionSettings(
disk_type=search_space.SetSpace[schema.DiskType](
data_disk_type=search_space.SetSpace[schema.DiskType](
items=[schema.DiskType.PremiumSSDLRS, schema.DiskType.StandardHDDLRS]
),
data_disk_iops=search_space.IntRange(max=sys.maxsize),