Skip to content

Commit afdea68

Browse files
kamalcaLiliDeng
authored andcommitted
Disk Size: Improve error message
1 parent aa82f35 commit afdea68

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lisa/sut_orchestrator/azure/features.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,7 +1711,7 @@ def _call_requirement_method( # noqa: C901
17111711
min_size = max(req_disk_size.min, cap_disk_size.min)
17121712
max_size = min(req_disk_size.max, cap_disk_size.max)
17131713

1714-
value.data_disk_size = min(
1714+
compliant_sizes = [
17151715
size
17161716
for size, iops, throughput in disk_type_performance
17171717
if iops >= min_iops
@@ -1720,7 +1720,18 @@ def _call_requirement_method( # noqa: C901
17201720
and throughput <= max_throughput
17211721
and size >= min_size
17221722
and size <= max_size
1723-
)
1723+
]
1724+
if not compliant_sizes:
1725+
raise NotMeetRequirementException(
1726+
f"DiskType {value.data_disk_type} cannot "
1727+
"achieve the requirement: "
1728+
f"{min_iops} <= IOPS <= {max_iops}, "
1729+
f"{min_throughput} <= Throughput <= {max_throughput}, "
1730+
f"{min_size} <= Disk Size <= {max_size}. "
1731+
"Consider specifiying a different disk type, "
1732+
"or changing your requirements."
1733+
)
1734+
value.data_disk_size = min(compliant_sizes)
17241735

17251736
(
17261737
value.data_disk_iops,

0 commit comments

Comments
 (0)