File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ def remove_data_disk(self, names: Optional[List[str]] = None) -> None:
68
68
69
69
def _initialize (self , * args : Any , ** kwargs : Any ) -> None :
70
70
self .disks : List [str ] = []
71
+ self ._os_disk_controller_type : Optional [schema .DiskControllerType ] = None
71
72
72
73
def get_resource_disk_mount_point (self ) -> str :
73
74
raise NotImplementedError
@@ -136,10 +137,13 @@ def get_disk_type(self, disk: str) -> schema.StorageInterfaceType:
136
137
137
138
# Get disk controller type from the VM by checking the boot partition
138
139
def get_os_disk_controller_type (self ) -> schema .DiskControllerType :
139
- boot_partition = self .get_os_boot_partition ()
140
- assert boot_partition , "'boot_partition' must not be 'None'"
141
- os_disk_controller_type = self .get_disk_type (boot_partition .disk )
142
- return schema .DiskControllerType (os_disk_controller_type )
140
+ if self ._os_disk_controller_type is None :
141
+ boot_partition = self .get_os_boot_partition ()
142
+ assert boot_partition , "'boot_partition' must not be 'None'"
143
+ self ._os_disk_controller_type = schema .DiskControllerType (
144
+ self .get_disk_type (boot_partition .disk )
145
+ )
146
+ return self ._os_disk_controller_type
143
147
144
148
145
149
DiskEphemeral = partial (
You can’t perform that action at this time.
0 commit comments