Skip to content

Commit

Permalink
qos: QOS fails with 'Attribute is not defined: QOS_POLICY'
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
khys95 committed Dec 6, 2024
1 parent a4c0df8 commit 1bcc7e3
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -115,27 +113,18 @@ 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);
}

@Override
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);
}

Expand Down

0 comments on commit 1bcc7e3

Please sign in to comment.