mirror of
https://github.com/containers/podman.git
synced 2025-12-01 10:38:05 +08:00
HyperV: wait on stop
When using podman machine with hyperv, stop was releasing the terminal back top the user prematurely. This resulted in users being able to run subsequent commands while the vm was still stopped. Commands like machine stop were prone to failing. [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
11
vendor/github.com/containers/libhvee/pkg/hypervctl/vm.go
generated
vendored
11
vendor/github.com/containers/libhvee/pkg/hypervctl/vm.go
generated
vendored
@@ -239,6 +239,17 @@ func (vm *VirtualMachine) Stop() error {
|
||||
return translateShutdownError(int(res))
|
||||
}
|
||||
|
||||
// Wait for vm to actually *be* down
|
||||
for i := 0; i < 25; i++ {
|
||||
refreshVM, err := vm.vmm.GetMachine(vm.ElementName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if refreshVM.State() == Disabled {
|
||||
break
|
||||
}
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user