mirror of
https://github.com/containers/podman.git
synced 2025-06-05 22:31:06 +08:00
Make it possible to select the volume driver
Use the same type of mounts for all the machine volumes. The default could change in the future, depending on OS. [NO NEW TESTS NEEDED] Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
This commit is contained in:
@ -92,6 +92,10 @@ func init() {
|
|||||||
flags.StringArrayVarP(&initOpts.Volumes, VolumeFlagName, "v", []string{}, "Volumes to mount, source:target")
|
flags.StringArrayVarP(&initOpts.Volumes, VolumeFlagName, "v", []string{}, "Volumes to mount, source:target")
|
||||||
_ = initCmd.RegisterFlagCompletionFunc(VolumeFlagName, completion.AutocompleteDefault)
|
_ = initCmd.RegisterFlagCompletionFunc(VolumeFlagName, completion.AutocompleteDefault)
|
||||||
|
|
||||||
|
VolumeDriverFlagName := "volume-driver"
|
||||||
|
flags.StringVar(&initOpts.VolumeDriver, VolumeDriverFlagName, "", "Optional volume driver")
|
||||||
|
_ = initCmd.RegisterFlagCompletionFunc(VolumeDriverFlagName, completion.AutocompleteDefault)
|
||||||
|
|
||||||
IgnitionPathFlagName := "ignition-path"
|
IgnitionPathFlagName := "ignition-path"
|
||||||
flags.StringVar(&initOpts.IgnitionPath, IgnitionPathFlagName, "", "Path to ignition file")
|
flags.StringVar(&initOpts.IgnitionPath, IgnitionPathFlagName, "", "Path to ignition file")
|
||||||
_ = initCmd.RegisterFlagCompletionFunc(IgnitionPathFlagName, completion.AutocompleteDefault)
|
_ = initCmd.RegisterFlagCompletionFunc(IgnitionPathFlagName, completion.AutocompleteDefault)
|
||||||
|
@ -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,
|
The root filesystem is mounted read-only in the default operating system,
|
||||||
so mounts must be created under the /mnt directory.
|
so mounts must be created under the /mnt directory.
|
||||||
|
|
||||||
|
#### **--volume-driver**
|
||||||
|
|
||||||
|
Driver to use for mounting volumes from the host, such as `virtfs`.
|
||||||
|
|
||||||
#### **--help**
|
#### **--help**
|
||||||
|
|
||||||
Print usage statement.
|
Print usage statement.
|
||||||
|
@ -19,6 +19,7 @@ type InitOptions struct {
|
|||||||
IgnitionPath string
|
IgnitionPath string
|
||||||
ImagePath string
|
ImagePath string
|
||||||
Volumes []string
|
Volumes []string
|
||||||
|
VolumeDriver string
|
||||||
IsDefault bool
|
IsDefault bool
|
||||||
Memory uint64
|
Memory uint64
|
||||||
Name string
|
Name string
|
||||||
|
@ -172,8 +172,16 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
|
|||||||
// Add arch specific options including image location
|
// Add arch specific options including image location
|
||||||
v.CmdLine = append(v.CmdLine, v.addArchOptions()...)
|
v.CmdLine = append(v.CmdLine, v.addArchOptions()...)
|
||||||
|
|
||||||
// TODO: add to opts
|
var volumeType string
|
||||||
volumeType := VolumeTypeVirtfs
|
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{}
|
mounts := []Mount{}
|
||||||
for i, volume := range opts.Volumes {
|
for i, volume := range opts.Volumes {
|
||||||
|
Reference in New Issue
Block a user