Skip to content

Commit

Permalink
Merge pull request #21927 from n1hility/ressurect-port-reassign
Browse files Browse the repository at this point in the history
Resurrect auto-port reassignment, but for all providers
  • Loading branch information
openshift-merge-bot[bot] authored Mar 5, 2024
2 parents 722807a + 6272abb commit 7f9f384
Show file tree
Hide file tree
Showing 48 changed files with 526 additions and 491 deletions.
4 changes: 2 additions & 2 deletions cmd/podman/compose_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"net/url"
"strconv"

"github.com/containers/podman/v5/pkg/machine"
"github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/podman/v5/pkg/machine/env"
"github.com/containers/podman/v5/pkg/machine/provider"
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
)
Expand All @@ -18,7 +18,7 @@ func getMachineConn(connectionURI string, parsedConnection *url.URL) (string, er
if err != nil {
return "", fmt.Errorf("getting machine provider: %w", err)
}
dirs, err := machine.GetMachineDirs(machineProvider.VMType())
dirs, err := env.GetMachineDirs(machineProvider.VMType())
if err != nil {
return "", err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/podman/machine/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/containers/podman/v5/cmd/podman/validate"
"github.com/containers/podman/v5/libpod/define"
"github.com/containers/podman/v5/pkg/domain/entities"
"github.com/containers/podman/v5/pkg/machine"
machineDefine "github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/podman/v5/pkg/machine/env"
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"
Expand Down Expand Up @@ -100,7 +100,7 @@ func hostInfo() (*entities.MachineHostInfo, error) {
host.Arch = runtime.GOARCH
host.OS = runtime.GOOS

dirs, err := machine.GetMachineDirs(provider.VMType())
dirs, err := env.GetMachineDirs(provider.VMType())
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/podman/machine/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/containers/podman/v5/cmd/podman/registry"
"github.com/containers/podman/v5/cmd/podman/utils"
"github.com/containers/podman/v5/pkg/machine"
"github.com/containers/podman/v5/pkg/machine/env"
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -47,7 +48,7 @@ func inspect(cmd *cobra.Command, args []string) error {
var (
errs utils.OutputErrors
)
dirs, err := machine.GetMachineDirs(provider.VMType())
dirs, err := env.GetMachineDirs(provider.VMType())
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/podman/machine/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/containers/podman/v5/cmd/podman/registry"
"github.com/containers/podman/v5/cmd/podman/validate"
"github.com/containers/podman/v5/libpod/events"
"github.com/containers/podman/v5/pkg/machine"
"github.com/containers/podman/v5/pkg/machine/env"
provider2 "github.com/containers/podman/v5/pkg/machine/provider"
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
"github.com/containers/podman/v5/pkg/util"
Expand Down Expand Up @@ -82,7 +82,7 @@ func getMachines(toComplete string) ([]string, cobra.ShellCompDirective) {
if err != nil {
return nil, cobra.ShellCompDirectiveNoFileComp
}
dirs, err := machine.GetMachineDirs(provider.VMType())
dirs, err := env.GetMachineDirs(provider.VMType())
if err != nil {
return nil, cobra.ShellCompDirectiveNoFileComp
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/podman/machine/os/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

machineconfig "github.com/containers/common/pkg/machine"
pkgMachine "github.com/containers/podman/v5/pkg/machine"
"github.com/containers/podman/v5/pkg/machine/env"
pkgOS "github.com/containers/podman/v5/pkg/machine/os"
"github.com/containers/podman/v5/pkg/machine/provider"
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
Expand Down Expand Up @@ -52,7 +53,7 @@ func machineOSManager(opts ManagerOpts, _ vmconfigs.VMProvider) (pkgOS.Manager,
if err != nil {
return nil, err
}
dirs, err := pkgMachine.GetMachineDirs(p.VMType())
dirs, err := env.GetMachineDirs(p.VMType())
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/podman/machine/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/containers/podman/v5/cmd/podman/registry"
"github.com/containers/podman/v5/cmd/podman/validate"
"github.com/containers/podman/v5/pkg/machine"
"github.com/containers/podman/v5/pkg/machine/env"
"github.com/containers/podman/v5/pkg/machine/shim"
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -50,7 +51,7 @@ func reset(_ *cobra.Command, _ []string) error {
err error
)

dirs, err := machine.GetMachineDirs(provider.VMType())
dirs, err := env.GetMachineDirs(provider.VMType())
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/podman/machine/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/containers/podman/v5/cmd/podman/registry"
"github.com/containers/podman/v5/libpod/events"
"github.com/containers/podman/v5/pkg/machine"
"github.com/containers/podman/v5/pkg/machine/env"
"github.com/containers/podman/v5/pkg/machine/shim"
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -54,7 +55,7 @@ func rm(_ *cobra.Command, args []string) error {
vmName = args[0]
}

dirs, err := machine.GetMachineDirs(provider.VMType())
dirs, err := env.GetMachineDirs(provider.VMType())
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/podman/machine/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/strongunits"
"github.com/containers/podman/v5/cmd/podman/registry"
"github.com/containers/podman/v5/pkg/machine"
"github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/podman/v5/pkg/machine/env"
"github.com/containers/podman/v5/pkg/machine/shim"
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -99,7 +99,7 @@ func setMachine(cmd *cobra.Command, args []string) error {
vmName = args[0]
}

dirs, err := machine.GetMachineDirs(provider.VMType())
dirs, err := env.GetMachineDirs(provider.VMType())
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/podman/machine/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/url"

"github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/podman/v5/pkg/machine/env"

"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v5/cmd/podman/registry"
Expand Down Expand Up @@ -54,7 +55,7 @@ func ssh(cmd *cobra.Command, args []string) error {
validVM bool
)

dirs, err := machine.GetMachineDirs(provider.VMType())
dirs, err := env.GetMachineDirs(provider.VMType())
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/podman/machine/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/containers/podman/v5/libpod/events"
"github.com/containers/podman/v5/pkg/machine"
"github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/podman/v5/pkg/machine/env"
"github.com/containers/podman/v5/pkg/machine/shim"
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -55,7 +56,7 @@ func start(_ *cobra.Command, args []string) error {
vmName = args[0]
}

dirs, err := machine.GetMachineDirs(provider.VMType())
dirs, err := env.GetMachineDirs(provider.VMType())
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/podman/machine/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/containers/podman/v5/cmd/podman/registry"
"github.com/containers/podman/v5/libpod/events"
"github.com/containers/podman/v5/pkg/machine"
"github.com/containers/podman/v5/pkg/machine/env"
"github.com/containers/podman/v5/pkg/machine/shim"
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -46,7 +46,7 @@ func stop(cmd *cobra.Command, args []string) error {
vmName = args[0]
}

dirs, err := machine.GetMachineDirs(provider.VMType())
dirs, err := env.GetMachineDirs(provider.VMType())
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/podman/system/reset_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
package system

import (
"github.com/containers/podman/v5/pkg/machine"
"github.com/containers/podman/v5/pkg/machine/connection"
"github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/podman/v5/pkg/machine/env"
p "github.com/containers/podman/v5/pkg/machine/provider"
"github.com/containers/podman/v5/pkg/machine/shim"
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
Expand All @@ -18,7 +18,7 @@ func resetMachine() error {
if err != nil {
return err
}
dirs, err := machine.GetMachineDirs(provider.VMType())
dirs, err := env.GetMachineDirs(provider.VMType())
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/checkpoint-restore/go-criu/v7 v7.0.0
github.com/containernetworking/plugins v1.4.0
github.com/containers/buildah v1.34.1-0.20240229193131-f5d7689ef4cd
github.com/containers/common v0.57.1-0.20240229165734-cec09922602e
github.com/containers/common v0.57.1-0.20240304165751-a0d555c70d52
github.com/containers/conmon v2.0.20+incompatible
github.com/containers/gvisor-tap-vsock v0.7.3
github.com/containers/image/v5 v5.29.3-0.20240229213915-cdc68020a24f
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ github.com/containernetworking/plugins v1.4.0 h1:+w22VPYgk7nQHw7KT92lsRmuToHvb7w
github.com/containernetworking/plugins v1.4.0/go.mod h1:UYhcOyjefnrQvKvmmyEKsUA+M9Nfn7tqULPpH0Pkcj0=
github.com/containers/buildah v1.34.1-0.20240229193131-f5d7689ef4cd h1:4cHNzaywyyJsCAtwUKMZm8r/wqm/WuNC70GfnI3kh18=
github.com/containers/buildah v1.34.1-0.20240229193131-f5d7689ef4cd/go.mod h1:3fn5edBIPpIOPJYdnxBdTF7bjnBHhqZwYK5a6ApNdyk=
github.com/containers/common v0.57.1-0.20240229165734-cec09922602e h1:TPgCd6bWFyliJxCXEiCI1LnbB3kBUkpx1dw51ngDjWI=
github.com/containers/common v0.57.1-0.20240229165734-cec09922602e/go.mod h1:8irlyBcVooYx0F+YmoY7PQPAIgdJvCj17bvL7PqeaxI=
github.com/containers/common v0.57.1-0.20240304165751-a0d555c70d52 h1:+rq1qOOEv/2Sa1A9Tmv7yKuOzea8W2n6kFUH+bon61Y=
github.com/containers/common v0.57.1-0.20240304165751-a0d555c70d52/go.mod h1:h92alKzSekxVC+VDaX4gt7RJpXvJKF79a9TnULZ5ZDc=
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
github.com/containers/gvisor-tap-vsock v0.7.3 h1:yORnf15sP+sLFhxLNLgmB5/lOhldn9dRMHx/tmYtSOQ=
Expand Down
5 changes: 5 additions & 0 deletions pkg/machine/applehv/stubber.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ func (a AppleHVStubber) StopHostNetworking(_ *vmconfigs.MachineConfig, _ define.
return nil
}

func (a AppleHVStubber) UpdateSSHPort(mc *vmconfigs.MachineConfig, port int) error {
// managed by gvproxy on this backend, so nothing to do
return nil
}

func (a AppleHVStubber) VMType() define.VMType {
return define.AppleHvVirt
}
Expand Down
Loading

1 comment on commit 7f9f384

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.