diff --git a/go.mod b/go.mod index 056275bb57..f852d21c00 100644 --- a/go.mod +++ b/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 diff --git a/go.sum b/go.sum index 5213f141bb..dbdf5089e4 100644 --- a/go.sum +++ b/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= diff --git a/pkg/machine/hyperv/machine.go b/pkg/machine/hyperv/machine.go index 30444d7a9a..e4cb4e2454 100644 --- a/pkg/machine/hyperv/machine.go +++ b/pkg/machine/hyperv/machine.go @@ -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 diff --git a/pkg/machine/ignition.go b/pkg/machine/ignition.go index aabf5c490b..f8ba4c0f89 100644 --- a/pkg/machine/ignition.go +++ b/pkg/machine/ignition.go @@ -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", diff --git a/vendor/github.com/containers/libhvee/pkg/hypervctl/vm.go b/vendor/github.com/containers/libhvee/pkg/hypervctl/vm.go index 8a10711083..1e14b6f408 100644 --- a/vendor/github.com/containers/libhvee/pkg/hypervctl/vm.go +++ b/vendor/github.com/containers/libhvee/pkg/hypervctl/vm.go @@ -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 } diff --git a/vendor/modules.txt b/vendor/modules.txt index 9030dfe8b4..30de2afb5c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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