Skip to content

Commit

Permalink
Add MachineType specification
Browse files Browse the repository at this point in the history
Signed-off-by: Jason T. Greene <[email protected]>
  • Loading branch information
n1hility committed Apr 18, 2022
1 parent 5215683 commit d077283
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
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_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 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"`

// MachineType indicates the type of machine if Podman is running inside a
// podman-machine instance
MachineType string `toml:"machine_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.MachineType).To(gomega.Equal(""))
// When
config2, err := NewConfig("testdata/containers_default.conf")
// Then
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(config2.Engine.MachineType).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.MachineType = ""
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

0 comments on commit d077283

Please sign in to comment.