Skip to content

Commit

Permalink
Reduce latencies caused by frequent calls to"get_os_disk_controller_t…
Browse files Browse the repository at this point in the history
…ype"
  • Loading branch information
SRIKKANTH committed Dec 27, 2024
1 parent 12950d7 commit 2fbcc19
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lisa/features/disks.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def remove_data_disk(self, names: Optional[List[str]] = None) -> None:

def _initialize(self, *args: Any, **kwargs: Any) -> None:
self.disks: List[str] = []
self._os_disk_controller_type: Optional[schema.DiskControllerType] = None

def get_resource_disk_mount_point(self) -> str:
raise NotImplementedError
Expand Down Expand Up @@ -136,10 +137,13 @@ def get_disk_type(self, disk: str) -> schema.StorageInterfaceType:

# Get disk controller type from the VM by checking the boot partition
def get_os_disk_controller_type(self) -> schema.DiskControllerType:
boot_partition = self.get_os_boot_partition()
assert boot_partition, "'boot_partition' must not be 'None'"
os_disk_controller_type = self.get_disk_type(boot_partition.disk)
return schema.DiskControllerType(os_disk_controller_type)
if self._os_disk_controller_type is None:
boot_partition = self.get_os_boot_partition()
assert boot_partition, "'boot_partition' must not be 'None'"
self._os_disk_controller_type = schema.DiskControllerType(
self.get_disk_type(boot_partition.disk)
)
return schema.DiskControllerType(self._os_disk_controller_type)


DiskEphemeral = partial(
Expand Down

0 comments on commit 2fbcc19

Please sign in to comment.