Ignore ro mount options in btrfs and windows drivers

Since now we always set the "ro" mount option, we need to ignore
these options on drivers that do not support them.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh 2019-08-09 11:24:39 -04:00
parent 1e89a4b923
commit a32ed165f4
2 changed files with 18 additions and 2 deletions

View File

@ -645,7 +645,15 @@ func (d *Driver) Get(id string, options graphdriver.MountOpts) (string, error) {
if err != nil {
return "", err
}
if len(options.Options) > 0 {
switch len(options.Options) {
case 0:
case 1:
if options.Options[0] == "ro" {
// ignore "ro" option
break
}
fallthrough
default:
return "", fmt.Errorf("btrfs driver does not support mount options")
}

View File

@ -372,7 +372,15 @@ func (d *Driver) Get(id string, options graphdriver.MountOpts) (string, error) {
logrus.Debugf("WindowsGraphDriver Get() id %s mountLabel %s", id, options.MountLabel)
var dir string
if len(options.Options) > 0 {
switch len(options.Options) {
case 0:
case 1:
if options.Options[0] == "ro" {
// ignore "ro" option
break
}
fallthrough
default:
return "", fmt.Errorf("windows driver does not support mount options")
}
rID, err := d.resolveID(id)