|
@ -63,10 +63,12 @@ func (vg *VolumeGrowth) GrowByCountAndType(count int, repType storage.Replicatio |
|
|
if ret { |
|
|
if ret { |
|
|
var servers []*topology.DataNode |
|
|
var servers []*topology.DataNode |
|
|
for _, n := range picked { |
|
|
for _, n := range picked { |
|
|
|
|
|
if n.FreeSpace() > 0 { |
|
|
if ok, server := n.ReserveOneVolume(rand.Intn(n.FreeSpace()), vid); ok { |
|
|
if ok, server := n.ReserveOneVolume(rand.Intn(n.FreeSpace()), vid); ok { |
|
|
servers = append(servers, server) |
|
|
servers = append(servers, server) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
if len(servers) == 2 { |
|
|
if len(servers) == 2 { |
|
|
vg.grow(topo, vid, repType, servers[0], servers[1]) |
|
|
vg.grow(topo, vid, repType, servers[0], servers[1]) |
|
|
} |
|
|
} |
|
@ -80,10 +82,12 @@ func (vg *VolumeGrowth) GrowByCountAndType(count int, repType storage.Replicatio |
|
|
if ret { |
|
|
if ret { |
|
|
var servers []*topology.DataNode |
|
|
var servers []*topology.DataNode |
|
|
for _, n := range picked { |
|
|
for _, n := range picked { |
|
|
|
|
|
if n.FreeSpace() > 0 { |
|
|
if ok, server := n.ReserveOneVolume(rand.Intn(n.FreeSpace()), vid); ok { |
|
|
if ok, server := n.ReserveOneVolume(rand.Intn(n.FreeSpace()), vid); ok { |
|
|
servers = append(servers, server) |
|
|
servers = append(servers, server) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
if len(servers) == 3 { |
|
|
if len(servers) == 3 { |
|
|
vg.grow(topo, vid, repType, servers[0], servers[1], servers[2]) |
|
|
vg.grow(topo, vid, repType, servers[0], servers[1], servers[2]) |
|
|
} |
|
|
} |
|
|