Skip to content

Commit 466bb8e

Browse files
committed
windows: Fix test_xenvbd_ssd on Server 2016
Server 2016 doesn't have Get-PhysicalDisk -DeviceNumber. We want to go through Get-Disk for correctness anyway. Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
1 parent e42dcef commit 466bb8e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/guest_tools/win/test_guest_tools_win.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,11 @@ def test_xenvbd_ssd(self, vm_install_test_tools_per_test_class: VM):
131131
"""Xenvbd must always advertise as SSD to avoid unnecessary defragging by Windows."""
132132
vm = vm_install_test_tools_per_test_class
133133
is_ssd = strtobool(
134+
# We have to filter Get-PhysicalDisk instead of piping directly from Get-Disk since direct Get-PhysicalDisk
135+
# by ID doesn't work on Server 2016.
134136
vm.execute_powershell_script(
135-
r'''(Get-PhysicalDisk -DeviceNumber (Get-Partition -DriveLetter C).DiskNumber).MediaType -eq "SSD"'''
137+
r'''$disk = Get-Partition -DriveLetter ($Env:SystemDrive[0]) | Get-Disk;
138+
(Get-PhysicalDisk | Where-Object UniqueId -eq $disk.UniqueId).MediaType -eq "SSD"'''
136139
)
137140
)
138141
assert is_ssd

0 commit comments

Comments
 (0)