Skip to content

Commit

Permalink
HyperV: wait on stop
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
baude committed Apr 18, 2023
1 parent e7b9ae4 commit 4b82301
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
8 changes: 4 additions & 4 deletions pkg/machine/hyperv/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pkg/machine/ignition.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions vendor/github.com/containers/libhvee/pkg/hypervctl/vm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b82301

Please sign in to comment.