Skip to content

Commit

Permalink
info: fix issue 7327 adding nested pgGroup
Browse files Browse the repository at this point in the history
Motivation

info service does not account for pools in nested pool groups

Modifications

Add the missing information to the message.

Result

neted groups are displayed now both for xml and json

Target: master

Acted-by: Tigran Mkrtchyan
Fixes: dCache#7326
Requires-notes: yes
Requires-book:
  • Loading branch information
mksahakyan committed Nov 10, 2023
1 parent ddb1720 commit 3a6fae5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ protected void addDefault() {
branchMetadata("queue", "name"));

this.add(StatePath.parsePath("poolgroups.*"), branchMetadata("poolgroup", "name"));
this.add(StatePath.parsePath("poolgroups.*.nestedgroups.*"), branchMetadata("nestedgroups", "name"));

this.add(StatePath.parsePath("poolgroups.*.links.*"), branchMetadata("linkref", "name"));
this.add(StatePath.parsePath("poolgroups.*.pools.*"), branchMetadata("poolref", "name"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void process(Object msgPayload, long metricLifetime) {

Object array[] = (Object[]) msgPayload;

if (array.length != 4) {
if (array.length != 5) {
LOGGER.error("Pool group info, unexpected array size: {}", array.length);
return;
}
Expand All @@ -42,15 +42,18 @@ public void process(Object msgPayload, long metricLifetime) {
Object poolNames[] = (Object[]) array[1];
Object linkNames[] = (Object[]) array[2];
Boolean resilient = (Boolean) array[3];
Object nestedPolls[] = (Object[]) array[4];

StateUpdate update = new StateUpdate();

StatePath thisPoolGroupPath = POOLGROUPS_PATH.newChild(poolgroupName);

if (poolNames.length + linkNames.length == 0) {
// Add an entry, even though this poolgroup is empty.
if (poolNames.length + linkNames.length + nestedPolls.length == 0) {
// Add an entry, even though this poolgroup is empty
update.appendUpdate(thisPoolGroupPath, new StateComposite(metricLifetime));
} else {
addItems(update, thisPoolGroupPath.newChild("nestedgroups"), nestedPolls,
metricLifetime);
addItems(update, thisPoolGroupPath.newChild("pools"), poolNames, metricLifetime);
addItems(update, thisPoolGroupPath.newChild("links"), linkNames, metricLifetime);
update.appendUpdate(thisPoolGroupPath.newChild("resilient"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1532,11 +1532,13 @@ public Object listPoolGroupXml(String groupName) {
+ groupName);
}

Object[] result = new Object[4];
Object[] result = new Object[5];
result[0] = groupName;
result[1] = group._poolList.keySet().toArray();
result[2] = group._linkList.keySet().toArray();
result[3] = group.isPrimary();
result[4] = group._pgroupList.stream().sorted(comparing(PGroup::getName))
.map(PGroup::getName).toArray();
xlsResult = result;
}
} finally {
Expand Down

0 comments on commit 3a6fae5

Please sign in to comment.