Skip to content

Commit 1dc06f1

Browse files
committed
windows: Wait for Xenvif offboard after uninstall
Xenvif offboard will reset the NIC, which will cause any running SSH commands to fail. Signed-off-by: Tu Dinh <[email protected]>
1 parent 67f3506 commit 1dc06f1

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

tests/guest_tools/win/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,19 @@ def vif_set_dns(vif: VIF, nameservers: List[str]):
147147
)
148148

149149

150+
def wait_for_vm_xenvif_offboard(vm: VM):
151+
# Xenvif offboard will reset the NIC, so need to wait for it to disappear first
152+
wait_for(
153+
lambda: strtobool(
154+
vm.execute_powershell_script(
155+
r'$null -eq (Get-ScheduledTask "Copy-XenVifSettings" -ErrorAction SilentlyContinue)', simple_output=True
156+
)
157+
),
158+
timeout_secs=300,
159+
retry_delay_secs=30,
160+
)
161+
162+
150163
def set_vm_dns(vm: VM):
151164
logging.info("Set VM DNS")
152165
vif = vm.vifs()[0]

tests/guest_tools/win/guest_tools.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
enable_testsign,
1111
insert_cd_safe,
1212
wait_for_vm_running_and_ssh_up_without_tools,
13+
wait_for_vm_xenvif_offboard,
1314
)
1415

1516
from typing import Any, Dict
@@ -79,3 +80,4 @@ def uninstall_guest_tools(vm: VM, action: PowerAction):
7980
if action == PowerAction.Reboot:
8081
vm.start()
8182
wait_for_vm_running_and_ssh_up_without_tools(vm)
83+
wait_for_vm_xenvif_offboard(vm)

tests/guest_tools/win/test_xenclean.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
insert_cd_safe,
1313
set_vm_dns,
1414
wait_for_vm_running_and_ssh_up_without_tools,
15+
wait_for_vm_xenvif_offboard,
1516
)
1617

1718
from typing import Any, Dict, Tuple
@@ -33,6 +34,7 @@ def run_xenclean(vm: VM, guest_tools_iso: Dict[str, Any]):
3334

3435
vm.start()
3536
wait_for_vm_running_and_ssh_up_without_tools(vm)
37+
wait_for_vm_xenvif_offboard(vm)
3638

3739

3840
@pytest.mark.multi_vms

0 commit comments

Comments
 (0)