forked from TrueCloudLab/frostfs-api-go
[#220] netmap: process REP X
policies correctly
For `REP X` select X nodes from the default filter and fail if it cannot be done. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
576841e0e0
commit
707a0bcb35
2 changed files with 50 additions and 0 deletions
|
@ -71,6 +71,19 @@ func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerN
|
|||
}
|
||||
|
||||
if r.Selector() == "" {
|
||||
if len(p.Selectors()) == 0 {
|
||||
s := new(Selector)
|
||||
s.SetCount(r.Count())
|
||||
s.SetFilter(MainFilterName)
|
||||
|
||||
nodes, err := c.getSelection(p, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result[i] = flattenNodes(nodes)
|
||||
}
|
||||
|
||||
for _, s := range p.Selectors() {
|
||||
result[i] = append(result[i], flattenNodes(c.Selections[s.Name()])...)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue