mirror of https://github.com/containers/podman.git
Merge pull request #19812 from baude/hypervciprep
Tweaks and cleanups to prepare hyperv for CI
This commit is contained in:
commit
2194bd098b
2
go.mod
2
go.mod
|
@ -16,7 +16,7 @@ require (
|
||||||
github.com/containers/common v0.55.1-0.20230830075933-12405381ff45
|
github.com/containers/common v0.55.1-0.20230830075933-12405381ff45
|
||||||
github.com/containers/conmon v2.0.20+incompatible
|
github.com/containers/conmon v2.0.20+incompatible
|
||||||
github.com/containers/image/v5 v5.26.1-0.20230807184415-3fb422379cfa
|
github.com/containers/image/v5 v5.26.1-0.20230807184415-3fb422379cfa
|
||||||
github.com/containers/libhvee v0.4.1-0.20230816135538-b81ee3f10e1e
|
github.com/containers/libhvee v0.4.1-0.20230830164110-3777cdaa7db8
|
||||||
github.com/containers/ocicrypt v1.1.8
|
github.com/containers/ocicrypt v1.1.8
|
||||||
github.com/containers/psgo v1.8.0
|
github.com/containers/psgo v1.8.0
|
||||||
github.com/containers/storage v1.49.1-0.20230823084450-6902c2df7cca
|
github.com/containers/storage v1.49.1-0.20230823084450-6902c2df7cca
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -252,8 +252,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/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
|
||||||
github.com/containers/image/v5 v5.26.1-0.20230807184415-3fb422379cfa h1:wDfVQtc6ik2MvsUmu/YRSyBAE5YUxdjcEDtuT1q2KDo=
|
github.com/containers/image/v5 v5.26.1-0.20230807184415-3fb422379cfa h1:wDfVQtc6ik2MvsUmu/YRSyBAE5YUxdjcEDtuT1q2KDo=
|
||||||
github.com/containers/image/v5 v5.26.1-0.20230807184415-3fb422379cfa/go.mod h1:apL4qwq31NV0gsSZQJPxYyTH0yzWavmMCjT8vsQaXSk=
|
github.com/containers/image/v5 v5.26.1-0.20230807184415-3fb422379cfa/go.mod h1:apL4qwq31NV0gsSZQJPxYyTH0yzWavmMCjT8vsQaXSk=
|
||||||
github.com/containers/libhvee v0.4.1-0.20230816135538-b81ee3f10e1e h1:j8QuCCOnTxQNtVwARhgUhe3+QYhXpcuoy9YuIgpLWDE=
|
github.com/containers/libhvee v0.4.1-0.20230830164110-3777cdaa7db8 h1:PTtzc5IcpcdHp9vLjE1cpT19Qo1GpouFTFE+rL0UO5I=
|
||||||
github.com/containers/libhvee v0.4.1-0.20230816135538-b81ee3f10e1e/go.mod h1:I30im5oKCYBJMEa+r0jffZn+Yb5/8CnYeAJy+vb77Mg=
|
github.com/containers/libhvee v0.4.1-0.20230830164110-3777cdaa7db8/go.mod h1:I30im5oKCYBJMEa+r0jffZn+Yb5/8CnYeAJy+vb77Mg=
|
||||||
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 h1:Qzk5C6cYglewc+UyGf6lc8Mj2UaPTHy/iF2De0/77CA=
|
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/libtrust v0.0.0-20230121012942-c1716e8a8d01/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY=
|
||||||
github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc=
|
github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc=
|
||||||
|
|
|
@ -2,6 +2,7 @@ package machine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
@ -40,6 +41,7 @@ func waitOnProcess(processID int) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to kill the pid with sigterm
|
// Try to kill the pid with sigterm
|
||||||
|
if runtime.GOOS != "windows" { // FIXME: temporary work around because signals are lame in windows
|
||||||
if err := proxyProc.Signal(syscall.SIGTERM); err != nil {
|
if err := proxyProc.Signal(syscall.SIGTERM); err != nil {
|
||||||
if err == syscall.ESRCH {
|
if err == syscall.ESRCH {
|
||||||
return nil
|
return nil
|
||||||
|
@ -50,6 +52,7 @@ func waitOnProcess(processID int) error {
|
||||||
if err := backoffForProcess(processID); err == nil {
|
if err := backoffForProcess(processID); err == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sigterm has not killed it yet, lets send a sigkill
|
// sigterm has not killed it yet, lets send a sigkill
|
||||||
proxyProc, err = findProcess(processID)
|
proxyProc, err = findProcess(processID)
|
||||||
|
|
|
@ -106,6 +106,8 @@ func (v HyperVVirtualization) NewMachine(opts machine.InitOptions) (machine.VM,
|
||||||
return nil, errors.New("must define --image-path for hyperv support")
|
return nil, errors.New("must define --image-path for hyperv support")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.RemoteUsername = opts.Username
|
||||||
|
|
||||||
configDir, err := machine.GetConfDir(machine.HyperVVirt)
|
configDir, err := machine.GetConfDir(machine.HyperVVirt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -131,7 +131,7 @@ Description=vsock_network
|
||||||
After=NetworkManager.service
|
After=NetworkManager.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/libexec/podman/gvforwader -preexisting -iface vsock0 -url vsock://2:%d/connect
|
ExecStart=/usr/libexec/podman/gvforwarder -preexisting -iface vsock0 -url vsock://2:%d/connect
|
||||||
ExecStartPost=/usr/bin/nmcli c up vsock0
|
ExecStartPost=/usr/bin/nmcli c up vsock0
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
@ -316,7 +316,7 @@ func (m *HyperVMachine) collectFilesToDestroy(opts machine.RemoveOptions, diskPa
|
||||||
files = append(files, *diskPath)
|
files = append(files, *diskPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
files = append(files, getVMConfigPath(m.ConfigPath.GetPath(), m.Name))
|
files = append(files, m.ConfigPath.GetPath())
|
||||||
return files
|
return files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,6 +354,11 @@ func (m *HyperVMachine) Remove(_ string, opts machine.RemoveOptions) (string, fu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vm, err = vmm.GetMachine(m.Name)
|
||||||
|
if err != nil {
|
||||||
|
return "", nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// Collect all the files that need to be destroyed
|
// Collect all the files that need to be destroyed
|
||||||
files = m.collectFilesToDestroy(opts, &diskPath)
|
files = m.collectFilesToDestroy(opts, &diskPath)
|
||||||
|
|
||||||
|
@ -366,7 +371,7 @@ func (m *HyperVMachine) Remove(_ string, opts machine.RemoveOptions) (string, fu
|
||||||
return confirmationMessage, func() error {
|
return confirmationMessage, func() error {
|
||||||
machine.RemoveFilesAndConnections(files, m.Name, m.Name+"-root")
|
machine.RemoveFilesAndConnections(files, m.Name, m.Name+"-root")
|
||||||
m.removeNetworkAndReadySocketsFromRegistry()
|
m.removeNetworkAndReadySocketsFromRegistry()
|
||||||
return vm.Remove(diskPath)
|
return vm.Remove("")
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,7 +508,11 @@ func (m *HyperVMachine) Stop(name string, opts machine.StopOptions) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if vm.State() != hypervctl.Enabled {
|
vmState := vm.State()
|
||||||
|
if vm.State() == hypervctl.Disabled {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if vmState != hypervctl.Enabled { // more states could be provided as well
|
||||||
return hypervctl.ErrMachineStateInvalid
|
return hypervctl.ErrMachineStateInvalid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -240,7 +240,7 @@ func (vm *VirtualMachine) Stop() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for vm to actually *be* down
|
// Wait for vm to actually *be* down
|
||||||
for i := 0; i < 25; i++ {
|
for i := 0; i < 200; i++ {
|
||||||
refreshVM, err := vm.vmm.GetMachine(vm.ElementName)
|
refreshVM, err := vm.vmm.GetMachine(vm.ElementName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -286,7 +286,7 @@ github.com/containers/image/v5/transports
|
||||||
github.com/containers/image/v5/transports/alltransports
|
github.com/containers/image/v5/transports/alltransports
|
||||||
github.com/containers/image/v5/types
|
github.com/containers/image/v5/types
|
||||||
github.com/containers/image/v5/version
|
github.com/containers/image/v5/version
|
||||||
# github.com/containers/libhvee v0.4.1-0.20230816135538-b81ee3f10e1e
|
# github.com/containers/libhvee v0.4.1-0.20230830164110-3777cdaa7db8
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/containers/libhvee/pkg/hypervctl
|
github.com/containers/libhvee/pkg/hypervctl
|
||||||
github.com/containers/libhvee/pkg/kvp/ginsu
|
github.com/containers/libhvee/pkg/kvp/ginsu
|
||||||
|
|
Loading…
Reference in New Issue