Skip to content

Commit

Permalink
fix issue #7326
Browse files Browse the repository at this point in the history
Motivation:

the nested groups are not included by Frontend:

wget -q --no-check-certificate https://dcacheweb-kit.gridka.de:3880/api/v1/poolgroups -O - | jq '.[] | select(.name == "all-belle-pools")'
{
  "name": "all-belle-pools"
}

Modification:

add a way do get poolGroups from poolSelectionUnit

Result:

Nested groups are  shown

[
{"name":"alias-pools",
"nestedPoolGroups":["qos-disk"]
},
{
"name":"alias-pools1",
"nestedPoolGroups":["alias-pools2","qos-disk","resgroup"]
},
{
"name":"alias-pools2"
},
{
"name":"default"
},
{
"name":"qos-disk",
"pools":["pool_res1","pool_res2","pool_res3"]
},
{
"name":"resgroup",
"links":["resilient-link"],
"pools":["pool_res1","pool_res2","pool_res3"],
"nestedPoolGroups":["alias-pools2"]
}
]

Target: master
Request: 9.0
Request: 8.2
Request: 8.1
Acted-by: Tigran Mkrtchyan
Fixes: #7326
Requires-notes: yes
Requires-book:
  • Loading branch information
mksahakyan committed Oct 20, 2023
1 parent f7e1913 commit 6b49307
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
import diskCacheV111.poolManager.PoolSelectionUnit;
import diskCacheV111.poolManager.PoolSelectionUnit.SelectionLink;
import diskCacheV111.poolManager.PoolSelectionUnit.SelectionPool;
import diskCacheV111.poolManager.PoolSelectionUnit.SelectionPoolGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Comparator;
Expand All @@ -76,8 +77,13 @@ public final class PoolGroup extends SelectionTypeWithLinks {
@ApiModelProperty("The pools that are a member of this poolgroup.")
private final List<String> pools;

@ApiModelProperty("The Nested poolGroups that are a member of this poolgroup.")
private final List<String> nestedPoolGroups;

public PoolGroup() {
this.pools = null;
this.nestedPoolGroups = null;

}

public PoolGroup(String group, PoolSelectionUnit psu) {
Expand All @@ -87,12 +93,20 @@ public PoolGroup(String group, PoolSelectionUnit psu) {
.sorted(Comparator.comparing(SelectionPool::getName))
.map(SelectionPool::getName)
.collect(Collectors.toList());

nestedPoolGroups = psu.getPoolGroupByName(name).getPoolGroups().stream()
.map((SelectionPoolGroup::getName))
.collect(Collectors.toList());
}

public List<String> getPools() {
return pools;
}

public List<String> getNestedPoolGroups() {
return nestedPoolGroups;
}

@Override
protected List<String> extractLinks(PoolSelectionUnit psu) {
return psu.getLinksPointingToPoolGroup(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ public Map<String, SelectionPool> getPools() {
return psu.getPools();
}

@Override
public SelectionPoolGroup getPoolGroupByName(String poolGroup) throws NoSuchElementException {
return psu.getPoolGroupByName(poolGroup);
}

@Override
public Collection<SelectionPool> getPoolsByPoolGroup(String poolGroup)
throws NoSuchElementException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public List<Pool> getPools() {
return allPools;
}

@Override
public List<PGroup> getPoolGroups() {
return _pgroupList;
}

// check whatever there is a pool group that exist in there reference list
// IOW, A -> B -> C ; C -> A not allowed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ interface SelectionPoolGroup extends SelectionEntity {
boolean isResilient();

List<? extends SelectionPool> getPools();
List<? extends SelectionPoolGroup> getPoolGroups();
}

interface SelectionLinkGroup extends SelectionEntity {
Expand Down Expand Up @@ -300,5 +301,7 @@ Collection<SelectionLink> getLinksPointingToPoolGroup(String poolGroup)

Map<String, SelectionUnitGroup> getUnitGroups();

SelectionPoolGroup getPoolGroupByName(String poolGroup);

boolean isEnabledRegex();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2544,6 +2544,18 @@ public LinkGroup getLinkGroupByName(String linkGroupName) {
return linkGroup;
}

@Override
public PGroup getPoolGroupByName(String pgroup) {
PGroup poolGroup = null;
rlock();
try {
poolGroup = _pGroups.get(pgroup);
} finally {
runlock();
}
return poolGroup;
}

@Override
public Collection<SelectionPoolGroup> getPoolGroupsOfPool(String poolName) {
rlock();
Expand Down

0 comments on commit 6b49307

Please sign in to comment.