mirror of https://github.com/containers/podman.git
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:
parent
e7b9ae4f3b
commit
4b8230119e
2
go.mod
2
go.mod
|
|
@ -16,7 +16,7 @@ require (
|
|||
github.com/containers/common v0.52.1-0.20230411124844-19b624d9a20d
|
||||
github.com/containers/conmon v2.0.20+incompatible
|
||||
github.com/containers/image/v5 v5.25.0
|
||||
github.com/containers/libhvee v0.0.4
|
||||
github.com/containers/libhvee v0.0.5-0.20230416212920-2fc1c8ec6819
|
||||
github.com/containers/ocicrypt v1.1.7
|
||||
github.com/containers/psgo v1.8.0
|
||||
github.com/containers/storage v1.46.1
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -245,8 +245,8 @@ github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6J
|
|||
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
|
||||
github.com/containers/image/v5 v5.25.0 h1:TJ0unmalbU+scd0i3Txap2wjGsAnv06MSCwgn6bsizk=
|
||||
github.com/containers/image/v5 v5.25.0/go.mod h1:EKvys0WVlRFkDw26R8y52TuhV9Tfn0yq2luLX6W52Ls=
|
||||
github.com/containers/libhvee v0.0.4 h1:pt03gr9B0mhqg/pyzGHzQzRK1XVvFODWzwBQXNPY1SY=
|
||||
github.com/containers/libhvee v0.0.4/go.mod h1:AYsyMe44w9ylWWEZNW+IOzA7oZ2i/P9TChNljavhYMI=
|
||||
github.com/containers/libhvee v0.0.5-0.20230416212920-2fc1c8ec6819 h1:2/RoHew3DNdXshJghZpUJ1QAXVteG82Is+uzu5sb3bs=
|
||||
github.com/containers/libhvee v0.0.5-0.20230416212920-2fc1c8ec6819/go.mod h1:AYsyMe44w9ylWWEZNW+IOzA7oZ2i/P9TChNljavhYMI=
|
||||
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 h1:Qzk5C6cYglewc+UyGf6lc8Mj2UaPTHy/iF2De0/77CA=
|
||||
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY=
|
||||
github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc=
|
||||
|
|
|
|||
|
|
@ -107,6 +107,10 @@ func (m *HyperVMachine) Init(opts machine.InitOptions) (bool, error) {
|
|||
// TODO This needs to be fixed in c-common
|
||||
m.RemoteUsername = "core"
|
||||
|
||||
if m.UID == 0 {
|
||||
m.UID = 1000
|
||||
}
|
||||
|
||||
sshPort, err := utils.GetRandomPort()
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
|
@ -168,10 +172,6 @@ func (m *HyperVMachine) Init(opts machine.InitOptions) (bool, error) {
|
|||
return false, err
|
||||
}
|
||||
|
||||
if m.UID == 0 {
|
||||
m.UID = 1000
|
||||
}
|
||||
|
||||
// c/common sets the default machine user for "windows" to be "user"; this
|
||||
// is meant for the WSL implementation that does not use FCOS. For FCOS,
|
||||
// however, we want to use the DefaultIgnitionUserName which is currently
|
||||
|
|
|
|||
|
|
@ -84,8 +84,7 @@ func (ign *DynamicIgnition) GenerateIgnitionConfig() error {
|
|||
Name: ign.Name,
|
||||
SSHAuthorizedKeys: []SSHAuthorizedKey{SSHAuthorizedKey(ign.Key)},
|
||||
// Set the UID of the core user inside the machine
|
||||
UID: IntToPtr(ign.UID),
|
||||
PasswordHash: StrToPtr("$y$j9T$/us37H88.4.5WydimEMC3/$f0sz48KNYevw7RO8iT.9gjmqaUlpmhwfdk7nlTql8QB"),
|
||||
UID: IntToPtr(ign.UID),
|
||||
},
|
||||
{
|
||||
Name: "root",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ github.com/containers/image/v5/transports
|
|||
github.com/containers/image/v5/transports/alltransports
|
||||
github.com/containers/image/v5/types
|
||||
github.com/containers/image/v5/version
|
||||
# github.com/containers/libhvee v0.0.4
|
||||
# github.com/containers/libhvee v0.0.5-0.20230416212920-2fc1c8ec6819
|
||||
## explicit; go 1.18
|
||||
github.com/containers/libhvee/pkg/hypervctl
|
||||
github.com/containers/libhvee/pkg/kvp/ginsu
|
||||
|
|
|
|||
Loading…
Reference in New Issue