Skip to content

Commit 0265bee

Browse files
committed
qos: QOS fails with 'Attribute is not defined: QOS_POLICY'
Motivation: Find out where in the code we throw the above error and resolve it. Modification: Removal of redundant qos policy logic. Result: Instead of checking if the qos_policy attribute is defined AND null, we will check if it is present using one of the predefined methods. If not, set it to null and resume previous logic. Acked-by: Tigran Mkrtchyan Target: master, 10.2, 10.1, 10.0, 9.2 Require-book: no Require-notes: yes (cherry picked from commit 8b9dfb3) Signed-off-by: khys95 <[email protected]>
1 parent 342e010 commit 0265bee

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

modules/dcache-qos/src/main/java/org/dcache/qos/services/engine/provider/PolicyBasedQoSProvider.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5959
*/
6060
package org.dcache.qos.services.engine.provider;
6161

62-
import static org.dcache.qos.util.QoSPermissionUtils.canModifyQos;
63-
6462
import diskCacheV111.util.CacheException;
65-
import diskCacheV111.util.PermissionDeniedCacheException;
6663
import diskCacheV111.util.PnfsId;
6764
import java.util.Collections;
6865
import java.util.EnumSet;
@@ -71,6 +68,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
7168
import java.util.Optional;
7269
import java.util.Set;
7370
import javax.security.auth.Subject;
71+
7472
import org.dcache.namespace.FileAttribute;
7573
import org.dcache.poolmanager.SerializablePoolMonitor;
7674
import org.dcache.qos.QoSDiskSpecification;
@@ -115,27 +113,18 @@ public FileQoSRequirements fetchRequirements(FileQoSUpdate update) throws QoSExc
115113
return null;
116114
}
117115

118-
FileAttributes attributes = descriptor.getAttributes();
119-
if (attributes.isDefined(FileAttribute.QOS_POLICY) && attributes.getQosPolicy() == null) {
120-
/*
121-
* This is a lazily discovered change, so
122-
* as a matter of consistency it calls for removal
123-
* of the pnfsid from the engine's tracking tables.
124-
*/
125-
engineDao.delete(update.getPnfsId());
126-
return super.fetchRequirements(update, descriptor);
127-
}
128-
129116
return fetchRequirements(update, descriptor);
130117
}
131118

132119
@Override
133120
public FileQoSRequirements fetchRequirements(FileQoSUpdate update, FileQoSRequirements descriptor)
134121
throws QoSException {
135122
FileAttributes attributes = descriptor.getAttributes();
136-
String name = attributes.getQosPolicy();
123+
124+
String name = attributes.getQosPolicyIfPresent().orElse(null);
137125

138126
if (name == null) {
127+
engineDao.delete(update.getPnfsId());
139128
return super.fetchRequirements(update, descriptor);
140129
}
141130

0 commit comments

Comments
 (0)