(volume types.ServiceVolumeConfig)
| 1240 | } |
| 1241 | |
| 1242 | func buildMountOptions(volume types.ServiceVolumeConfig) (*mount.BindOptions, *mount.VolumeOptions, *mount.TmpfsOptions, *mount.ImageOptions) { |
| 1243 | if volume.Type != types.VolumeTypeBind && volume.Bind != nil { |
| 1244 | logrus.Warnf("mount of type `%s` should not define `bind` option", volume.Type) |
| 1245 | } |
| 1246 | if volume.Type != types.VolumeTypeVolume && volume.Volume != nil { |
| 1247 | logrus.Warnf("mount of type `%s` should not define `volume` option", volume.Type) |
| 1248 | } |
| 1249 | if volume.Type != types.VolumeTypeTmpfs && volume.Tmpfs != nil { |
| 1250 | logrus.Warnf("mount of type `%s` should not define `tmpfs` option", volume.Type) |
| 1251 | } |
| 1252 | if volume.Type != types.VolumeTypeImage && volume.Image != nil { |
| 1253 | logrus.Warnf("mount of type `%s` should not define `image` option", volume.Type) |
| 1254 | } |
| 1255 | |
| 1256 | switch volume.Type { |
| 1257 | case "bind": |
| 1258 | return buildBindOption(volume.Bind), nil, nil, nil |
| 1259 | case "volume": |
| 1260 | return nil, buildVolumeOptions(volume.Volume), nil, nil |
| 1261 | case "tmpfs": |
| 1262 | return nil, nil, buildTmpfsOptions(volume.Tmpfs), nil |
| 1263 | case "image": |
| 1264 | return nil, nil, nil, buildImageOptions(volume.Image) |
| 1265 | } |
| 1266 | return nil, nil, nil, nil |
| 1267 | } |
| 1268 | |
| 1269 | func buildBindOption(bind *types.ServiceVolumeBind) *mount.BindOptions { |
| 1270 | if bind == nil { |
no test coverage detected