Skip to content

Commit

Permalink
Merge pull request #412 from akutz/bugfix/rbd-parse-ips
Browse files Browse the repository at this point in the history
Fix for Ceph MonIPs with Ports
  • Loading branch information
akutz authored Feb 11, 2017
2 parents ad5dbe0 + 1040f4c commit e43c941
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions drivers/storage/rbd/executor/rbd_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,19 @@ func getCephMonIPs() ([]net.IP, error) {

monStrings := strings.Split(strings.TrimSpace(string(out)), ",")

monIps := make([]net.IP, 0, 4)
monIps := []net.IP{}

for _, mon := range monStrings {
ip := net.ParseIP(mon)
if ip != nil {
monIps = append(monIps, ip)
} else {
ipSlice, err := net.LookupIP(mon)
if err == nil {
monIps = append(monIps, ipSlice...)
}
host, _, err := net.SplitHostPort(mon)
if err != nil {
return nil, err
}
addrs, err := net.LookupIP(host)
if err != nil {
return nil, err
}
if len(addrs) > 0 {
monIps = append(monIps, addrs...)
}
}

Expand Down

0 comments on commit e43c941

Please sign in to comment.