|
@@ -30,6 +30,7 @@ func linuxValidateNotRoot(p string) error {
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
+
|
|
|
func linuxValidateAbsolute(p string) error {
|
|
|
p = strings.ReplaceAll(p, `\`, `/`)
|
|
|
if path.IsAbs(p) {
|
|
@@ -37,12 +38,14 @@ func linuxValidateAbsolute(p string) error {
|
|
|
}
|
|
|
return fmt.Errorf("invalid mount path: '%s' mount path must be absolute", p)
|
|
|
}
|
|
|
+
|
|
|
func (p *linuxParser) ValidateMountConfig(mnt *mount.Mount) error {
|
|
|
// there was something looking like a bug in existing codebase:
|
|
|
// - validateMountConfig on linux was called with options skipping bind source existence when calling ParseMountRaw
|
|
|
// - but not when calling ParseMountSpec directly... nor when the unit test called it directly
|
|
|
return p.validateMountConfigImpl(mnt, true)
|
|
|
}
|
|
|
+
|
|
|
func (p *linuxParser) validateMountConfigImpl(mnt *mount.Mount, validateBindSourceExists bool) error {
|
|
|
if len(mnt.Target) == 0 {
|
|
|
return &errMountConfig{mnt, errMissingField("Target")}
|
|
@@ -123,6 +126,7 @@ var linuxConsistencyModes = map[mount.Consistency]bool{
|
|
|
mount.ConsistencyCached: true,
|
|
|
mount.ConsistencyDelegated: true,
|
|
|
}
|
|
|
+
|
|
|
var linuxPropagationModes = map[mount.Propagation]bool{
|
|
|
mount.PropagationPrivate: true,
|
|
|
mount.PropagationRPrivate: true,
|
|
@@ -289,9 +293,11 @@ func (p *linuxParser) ParseMountRaw(raw, volumeDriver string) (*MountPoint, erro
|
|
|
}
|
|
|
return mp, err
|
|
|
}
|
|
|
+
|
|
|
func (p *linuxParser) ParseMountSpec(cfg mount.Mount) (*MountPoint, error) {
|
|
|
return p.parseMountSpec(cfg, true)
|
|
|
}
|
|
|
+
|
|
|
func (p *linuxParser) parseMountSpec(cfg mount.Mount, validateBindSourceExists bool) (*MountPoint, error) {
|
|
|
if err := p.validateMountConfigImpl(&cfg, validateBindSourceExists); err != nil {
|
|
|
return nil, err
|
|
@@ -415,6 +421,7 @@ func (p *linuxParser) ConvertTmpfsOptions(opt *mount.TmpfsOptions, readOnly bool
|
|
|
func (p *linuxParser) DefaultCopyMode() bool {
|
|
|
return true
|
|
|
}
|
|
|
+
|
|
|
func (p *linuxParser) ValidateVolumeName(name string) error {
|
|
|
return nil
|
|
|
}
|