diff --git a/modules/dcache-qos/src/main/java/org/dcache/qos/services/engine/provider/PolicyBasedQoSProvider.java b/modules/dcache-qos/src/main/java/org/dcache/qos/services/engine/provider/PolicyBasedQoSProvider.java index 23ff30157f0..2bf9b7cad95 100644 --- a/modules/dcache-qos/src/main/java/org/dcache/qos/services/engine/provider/PolicyBasedQoSProvider.java +++ b/modules/dcache-qos/src/main/java/org/dcache/qos/services/engine/provider/PolicyBasedQoSProvider.java @@ -59,10 +59,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ package org.dcache.qos.services.engine.provider; -import static org.dcache.qos.util.QoSPermissionUtils.canModifyQos; - import diskCacheV111.util.CacheException; -import diskCacheV111.util.PermissionDeniedCacheException; import diskCacheV111.util.PnfsId; import java.util.Collections; import java.util.EnumSet; @@ -71,6 +68,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING import java.util.Optional; import java.util.Set; import javax.security.auth.Subject; + import org.dcache.namespace.FileAttribute; import org.dcache.poolmanager.SerializablePoolMonitor; import org.dcache.qos.QoSDiskSpecification; @@ -115,17 +113,6 @@ public FileQoSRequirements fetchRequirements(FileQoSUpdate update) throws QoSExc return null; } - FileAttributes attributes = descriptor.getAttributes(); - if (attributes.isDefined(FileAttribute.QOS_POLICY) && attributes.getQosPolicy() == null) { - /* - * This is a lazily discovered change, so - * as a matter of consistency it calls for removal - * of the pnfsid from the engine's tracking tables. - */ - engineDao.delete(update.getPnfsId()); - return super.fetchRequirements(update, descriptor); - } - return fetchRequirements(update, descriptor); } @@ -133,9 +120,11 @@ public FileQoSRequirements fetchRequirements(FileQoSUpdate update) throws QoSExc public FileQoSRequirements fetchRequirements(FileQoSUpdate update, FileQoSRequirements descriptor) throws QoSException { FileAttributes attributes = descriptor.getAttributes(); - String name = attributes.getQosPolicy(); + + String name = attributes.getQosPolicyIfPresent().orElse(null); if (name == null) { + engineDao.delete(update.getPnfsId()); return super.fetchRequirements(update, descriptor); }