From 34b411557f596c8176b7b93ee9bac784f9cf4675 Mon Sep 17 00:00:00 2001 From: Albert Louis Rossi Date: Wed, 27 Sep 2023 16:14:30 -0500 Subject: [PATCH] dcache-frontend: include new QoS Policy attributes in -optional Motivation: User should be able to request info on the QoS policy and state index for a given file. Modification: Return these as part of the optional attributes. Result: New attributes included in optional. Target: master Patch: https://rb.dcache.org/r/14104/ Requires-book: no Acked-by: Lea --- .../restful/providers/JsonFileAttributes.java | 23 +++++++++++++++++++ .../util/namespace/NamespaceUtils.java | 10 ++++++++ 2 files changed, 33 insertions(+) diff --git a/modules/dcache-frontend/src/main/java/org/dcache/restful/providers/JsonFileAttributes.java b/modules/dcache-frontend/src/main/java/org/dcache/restful/providers/JsonFileAttributes.java index 6667b4377b5..cb328e4f1b5 100644 --- a/modules/dcache-frontend/src/main/java/org/dcache/restful/providers/JsonFileAttributes.java +++ b/modules/dcache-frontend/src/main/java/org/dcache/restful/providers/JsonFileAttributes.java @@ -130,6 +130,13 @@ public class JsonFileAttributes { @ApiModelProperty("File's labels.") private Set labels; + @ApiModelProperty("File's QoS policy.") + private String qosPolicy; + + @ApiModelProperty("File's current QoS policy state index.") + private Integer qosState; + + public ACL getAcl() { return _acl; } @@ -407,4 +414,20 @@ public void setLabels(Set labelnames) { public Set getLabels() { return labels == null ? new HashSet() : labels; } + + public String getQosPolicy() { + return qosPolicy; + } + + public void setQosPolicy(String qosPolicy) { + this.qosPolicy = qosPolicy; + } + + public Integer getQosState() { + return qosState; + } + + public void setQosState(Integer qosState) { + this.qosState = qosState; + } } \ No newline at end of file diff --git a/modules/dcache-frontend/src/main/java/org/dcache/restful/util/namespace/NamespaceUtils.java b/modules/dcache-frontend/src/main/java/org/dcache/restful/util/namespace/NamespaceUtils.java index 20e8283d838..62f6e66b0f8 100644 --- a/modules/dcache-frontend/src/main/java/org/dcache/restful/util/namespace/NamespaceUtils.java +++ b/modules/dcache-frontend/src/main/java/org/dcache/restful/util/namespace/NamespaceUtils.java @@ -242,6 +242,14 @@ private static void addAllOptionalAttributes(JsonFileAttributes json, json.setStorageInfo(info); json.setSuris(info.locations()); } + + if (attributes.isDefined(FileAttribute.QOS_POLICY)) { + json.setQosPolicy(attributes.getQosPolicy()); + } + + if (attributes.isDefined(FileAttribute.QOS_STATE)) { + json.setQosState(attributes.getQosState()); + } } public static Set getRequestedAttributes(boolean locality, @@ -287,6 +295,8 @@ public static Set getRequestedAttributes(boolean locality, attributes.add(FileAttribute.OWNER_GROUP); attributes.add(FileAttribute.OWNER); attributes.add(FileAttribute.STORAGECLASS); + attributes.add(FileAttribute.QOS_POLICY); + attributes.add(FileAttribute.QOS_STATE); } return ImmutableSet.copyOf(attributes);