Merge pull request #39250 from shuchow/706-cifs-lookup

Enable DNS Lookups for CIFS Volumes
This commit is contained in:
Sebastiaan van Stijn 2019-09-03 11:07:20 +02:00 committed by GitHub
commit a114a2c019
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -97,11 +97,12 @@ func (v *localVolume) mount() error {
return fmt.Errorf("missing device in volume options")
}
mountOpts := v.opts.MountOpts
if v.opts.MountType == "nfs" {
switch v.opts.MountType {
case "nfs", "cifs":
if addrValue := getAddress(v.opts.MountOpts); addrValue != "" && net.ParseIP(addrValue).To4() == nil {
ipAddr, err := net.ResolveIPAddr("ip", addrValue)
if err != nil {
return errors.Wrapf(err, "error resolving passed in nfs address")
return errors.Wrapf(err, "error resolving passed in network volume address")
}
mountOpts = strings.Replace(mountOpts, "addr="+addrValue, "addr="+ipAddr.String(), 1)
}