sut_orchestrator: hyperv: don't automatically add disks

The create_vm() method of the HyperV tool, automatically finds offline
disks and adds them to the VM. This behavior is not required for hyperv
platform. So, introduce a parameter to control it and modify hyperv
platform to disable that behavior.

Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
This commit is contained in:
Anirudh Rayabharam 2024-10-21 12:21:55 +05:30 коммит произвёл LiliDeng
Родитель 7184c06fce
Коммит d037082e5f
2 изменённых файлов: 15 добавлений и 12 удалений

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

@ -296,6 +296,7 @@ class HypervPlatform(Platform):
1: com1_pipe_path,
},
extra_args=extra_args,
attach_offline_disks=False,
)
# perform device passthrough for the VM
self.device_pool._set_device_passthrough_node_context(

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

@ -72,6 +72,7 @@ class HyperV(Tool):
generation: int = 1,
cores: int = 2,
memory: int = 2048,
attach_offline_disks: bool = True,
com_ports: Optional[Dict[int, str]] = None,
secure_boot: bool = True,
stop_existing_vm: bool = True,
@ -119,7 +120,8 @@ class HyperV(Tool):
force_run=True,
)
# add disks
# add disks if requested
if attach_offline_disks:
disk_info = powershell.run_cmdlet(
"(Get-Disk | Where-Object {$_.OperationalStatus -eq 'offline'}).Number",
force_run=True,