aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/machine/init.go4
-rw-r--r--docs/source/markdown/podman-machine-init.1.md4
-rw-r--r--pkg/machine/config.go1
-rw-r--r--pkg/machine/qemu/machine.go12
4 files changed, 19 insertions, 2 deletions
diff --git a/cmd/podman/machine/init.go b/cmd/podman/machine/init.go
index b913a252e..ed04239c4 100644
--- a/cmd/podman/machine/init.go
+++ b/cmd/podman/machine/init.go
@@ -92,6 +92,10 @@ func init() {
flags.StringArrayVarP(&initOpts.Volumes, VolumeFlagName, "v", []string{}, "Volumes to mount, source:target")
_ = initCmd.RegisterFlagCompletionFunc(VolumeFlagName, completion.AutocompleteDefault)
+ VolumeDriverFlagName := "volume-driver"
+ flags.StringVar(&initOpts.VolumeDriver, VolumeDriverFlagName, "", "Optional volume driver")
+ _ = initCmd.RegisterFlagCompletionFunc(VolumeDriverFlagName, completion.AutocompleteDefault)
+
IgnitionPathFlagName := "ignition-path"
flags.StringVar(&initOpts.IgnitionPath, IgnitionPathFlagName, "", "Path to ignition file")
_ = initCmd.RegisterFlagCompletionFunc(IgnitionPathFlagName, completion.AutocompleteDefault)
diff --git a/docs/source/markdown/podman-machine-init.1.md b/docs/source/markdown/podman-machine-init.1.md
index b936447fb..b515e8763 100644
--- a/docs/source/markdown/podman-machine-init.1.md
+++ b/docs/source/markdown/podman-machine-init.1.md
@@ -71,6 +71,10 @@ Podman mounts _host-dir_ in the host to _machine-dir_ in the Podman machine.
The root filesystem is mounted read-only in the default operating system,
so mounts must be created under the /mnt directory.
+#### **--volume-driver**
+
+Driver to use for mounting volumes from the host, such as `virtfs`.
+
#### **--help**
Print usage statement.
diff --git a/pkg/machine/config.go b/pkg/machine/config.go
index 162ef43e2..33a352898 100644
--- a/pkg/machine/config.go
+++ b/pkg/machine/config.go
@@ -19,6 +19,7 @@ type InitOptions struct {
IgnitionPath string
ImagePath string
Volumes []string
+ VolumeDriver string
IsDefault bool
Memory uint64
Name string
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index fde520f03..f09107c71 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -172,8 +172,16 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
// Add arch specific options including image location
v.CmdLine = append(v.CmdLine, v.addArchOptions()...)
- // TODO: add to opts
- volumeType := VolumeTypeVirtfs
+ var volumeType string
+ switch opts.VolumeDriver {
+ case "virtfs":
+ volumeType = VolumeTypeVirtfs
+ case "": // default driver
+ volumeType = VolumeTypeVirtfs
+ default:
+ err := fmt.Errorf("unknown volume driver: %s", opts.VolumeDriver)
+ return false, err
+ }
mounts := []Mount{}
for i, volume := range opts.Volumes {