Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MachineHostType specification #1005

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/containers.conf.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,12 @@ Indicates if Podman is running inside a VM via Podman Machine.
Podman uses this value to do extra setup around networking from the
container inside the VM to to host.

**machine_host_type**=""

Indicates the type of machine if Podman is running inside a podman machine
instance. The value is only relevant if machine_enabled is true. The default
value (empty string) indicates the machine host type is unknown.

**multi_image_archive**=false

Allows for creating archives (e.g., tarballs) with more than one image. Some container engines, such as Podman, interpret additional arguments as tags for one image and hence do not store more than one image. The default behavior can be altered with this option.
Expand Down
4 changes: 4 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ type EngineConfig struct {
// MachineEnabled indicates if Podman is running in a podman-machine VM
MachineEnabled bool `toml:"machine_enabled,omitempty"`

// MachineHostType indicates the type of machine if Podman is running inside a
// podman-machine instance
MachineHostType string `toml:"machine_host_type,omitempty"`

// MultiImageArchive - if true, the container engine allows for storing
// archives (e.g., of the docker-archive transport) with multiple
// images. By default, Podman creates single-image archives.
Expand Down
12 changes: 12 additions & 0 deletions pkg/config/config_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,18 @@ var _ = Describe("Config Local", func() {
gomega.Expect(config2.Engine.MachineEnabled).To(gomega.Equal(true))
})

It("Set Machine Type", func() {
// Given
config, err := NewConfig("")
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(config.Engine.MachineHostType).To(gomega.Equal(""))
// When
config2, err := NewConfig("testdata/containers_default.conf")
// Then
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(config2.Engine.MachineHostType).To(gomega.Equal("wsl"))
})

It("default netns", func() {
// Given
config, err := NewConfig("")
Expand Down
1 change: 1 addition & 0 deletions pkg/config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ func defaultConfigFromMemory() (*EngineConfig, error) {
// constants.
c.LockType = "shm"
c.MachineEnabled = false
c.MachineHostType = ""
c.ChownCopiedFiles = true

return c, nil
Expand Down
1 change: 1 addition & 0 deletions pkg/config/testdata/containers_default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ env = ["super=duper", "foo=bar"]
tmp_dir = "/run/libpod"

machine_enabled = true
machine_type = "wsl"

# Whether to use chroot instead of pivot_root in the runtime
no_pivot_root = false
Expand Down