Skip to content

Commit

Permalink
Merge branch 'new_nested' of https://github.com/lixuemin2016/tp-qemu
Browse files Browse the repository at this point in the history
…into new_nested
  • Loading branch information
lixuemin2016 committed May 31, 2023
2 parents 750e9ee + 341dc63 commit 8bf0241
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions qemu/deps/nested_hyperv/hyperv_sets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@ param (
function VMStop([String] $vmName){
$vm = get-vm $vmName
if ( $vm.State -eq "Off"){
write-host "Info : $vmName is stopped"
write-host "Info: $vmName is stopped"
return $true
}

stop-vm $vmName -force
if ( $? -ne $true ){
write-host "Error : stop-VM $vm failed"
write-host "Error: stop-VM $vm failed"
return $false
}

$timeout = 100
while ($timeout -gt 0){
$vm = get-vm $vmName
if ($vm.state -eq "Off"){
write-host "Info : $vmName state is Off now"
write-host "Info: $vmName state is Off now"
break
}
else{
write-host "Info : $vmName state is not Off, waiting..."
write-host "Info: $vmName state is not Off, waiting..."
start-sleep -seconds 1
$timeout -= 1
}
}
if ( $timeout -eq 0 -and $vm.state -ne "Off"){
write-host "Error : Stop $vm failed (timeout=$timeout)"
write-host "Error: Stop $vm failed (timeout=$timeout)"
return $false
}

Expand Down Expand Up @@ -237,7 +237,7 @@ function VMStart([String]$vmPath, [String]$vmName, [Bool]$gen2, [String]$switchN
$hb = Get-VMIntegrationService -VMName $VMName -Name "Heartbeat"
$vm = Get-VM $vmName
if ($($hb.Enabled) -eq "True" -and $($vm.Heartbeat) -eq "OkApplicationsUnknown") {
write-host "Heartbeat detected"
write-host "Info: Heartbeat detected for $vmName"
return $true
}
else {
Expand Down Expand Up @@ -416,7 +416,7 @@ switch ($action){
}
"clone"{ # create 2 vcpu and 1G memory
$ret = VMStart $vhd_path $vm_name $gen2 $switchName 2 1
write-host $ret
write-host "Infor: return value of VMStart for $vm_name is $ret"
}
"snapshot"{
NewCheckpoint -vmName $vm_name -snapshotName $snapshotName
Expand Down
4 changes: 2 additions & 2 deletions qemu/tests/nested_hyperv_on_kvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
def run(test, params, env):
"""
Nested Hyper-V on KVM:
This case is used to test in L1 Windows VM, start L2 BIOS/UEFI Linux VM
This case is used to test in L1 Windows VM, start L2 BIOS/UEFI Linux VM via Fedora image
:param test: QEMU test object
:param params: Dictionary with the test parameters
Expand Down Expand Up @@ -49,7 +49,7 @@ def get_vhdx():
get_vhdx()

need_reboot = 0
status, output = session.cmd_status_output("powershell Get-VM -ErrorAction SilentlyContinue")
status, output = session.cmd_status_output("powershell Get-VM -ErrorAction SilentlyContinue", timeout=120, safe=True)

if status:
need_reboot = 1
Expand Down

0 comments on commit 8bf0241

Please sign in to comment.