diff --git a/modules/dcache-chimera/src/main/resources/diskCacheV111/namespace/pnfsmanager-chimera.xml b/modules/dcache-chimera/src/main/resources/diskCacheV111/namespace/pnfsmanager-chimera.xml
index 8fbdd153e1d..fa4c7089afd 100644
--- a/modules/dcache-chimera/src/main/resources/diskCacheV111/namespace/pnfsmanager-chimera.xml
+++ b/modules/dcache-chimera/src/main/resources/diskCacheV111/namespace/pnfsmanager-chimera.xml
@@ -50,6 +50,7 @@
+
@@ -151,6 +152,11 @@
+
+ Quota
+
+
+
Name space provider
diff --git a/modules/dcache-vehicles/src/main/java/diskCacheV111/vehicles/PnfsCreateEntryMessage.java b/modules/dcache-vehicles/src/main/java/diskCacheV111/vehicles/PnfsCreateEntryMessage.java
index f41742daaf1..da87da64f74 100644
--- a/modules/dcache-vehicles/src/main/java/diskCacheV111/vehicles/PnfsCreateEntryMessage.java
+++ b/modules/dcache-vehicles/src/main/java/diskCacheV111/vehicles/PnfsCreateEntryMessage.java
@@ -15,6 +15,8 @@
import static org.dcache.namespace.FileAttribute.OWNER;
import static org.dcache.namespace.FileAttribute.OWNER_GROUP;
import static org.dcache.namespace.FileAttribute.PNFSID;
+import static org.dcache.namespace.FileAttribute.QOS_POLICY;
+import static org.dcache.namespace.FileAttribute.QOS_STATE;
import static org.dcache.namespace.FileAttribute.RETENTION_POLICY;
import static org.dcache.namespace.FileAttribute.SIMPLE_TYPE;
import static org.dcache.namespace.FileAttribute.SIZE;
@@ -43,14 +45,14 @@ public class PnfsCreateEntryMessage extends PnfsSetFileAttributes {
public static final EnumSet INVALID_CREATE_DIRECTORY_ATTRIBUTES =
EnumSet.of(CACHECLASS, CHECKSUM, CREATION_TIME, FLAGS, HSM,
LOCATIONS, NLINK, PNFSID, RETENTION_POLICY, SIMPLE_TYPE,
- SIZE, STORAGECLASS, STORAGEINFO);
+ SIZE, STORAGECLASS, STORAGEINFO, QOS_POLICY, QOS_STATE);
public static final EnumSet INVALID_CREATE_FILE_ATTRIBUTES =
EnumSet.of(CACHECLASS, CREATION_TIME, NLINK, PNFSID, STORAGECLASS,
STORAGEINFO, SIMPLE_TYPE);
public static final EnumSet INVALID_CREATE_SYM_LINK_ATTRIBUTES =
EnumSet.of(ACCESS_LATENCY, CACHECLASS, CHECKSUM, CREATION_TIME,
FLAGS, HSM, LOCATIONS, NLINK, PNFSID, RETENTION_POLICY,
- SIZE, STORAGECLASS, STORAGEINFO, SIMPLE_TYPE);
+ SIZE, STORAGECLASS, STORAGEINFO, SIMPLE_TYPE, QOS_POLICY, QOS_STATE);
public PnfsCreateEntryMessage(String path, FileAttributes attributes) {
this(path, attributes, Collections.emptySet());
@@ -62,7 +64,7 @@ public PnfsCreateEntryMessage(String path, FileAttributes attributes,
EnumSet.of(OWNER, OWNER_GROUP, MODE, TYPE, SIZE,
CREATION_TIME, ACCESS_TIME, MODIFICATION_TIME,
PNFSID, STORAGEINFO, STORAGECLASS, CACHECLASS, HSM,
- ACCESS_LATENCY, RETENTION_POLICY))));
+ ACCESS_LATENCY, RETENTION_POLICY, QOS_POLICY, QOS_STATE))));
checkArgument(attributes.isDefined(TYPE));
switch (attributes.getFileType()) {
diff --git a/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerAddQoSPolicyMessage.java b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerAddQoSPolicyMessage.java
new file mode 100644
index 00000000000..223a593bc55
--- /dev/null
+++ b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerAddQoSPolicyMessage.java
@@ -0,0 +1,76 @@
+/*
+COPYRIGHT STATUS:
+Dec 1st 2001, Fermi National Accelerator Laboratory (FNAL) documents and
+software are sponsored by the U.S. Department of Energy under Contract No.
+DE-AC02-76CH03000. Therefore, the U.S. Government retains a world-wide
+non-exclusive, royalty-free license to publish or reproduce these documents
+and software for U.S. Government purposes. All documents and software
+available from this server are protected under the U.S. and Foreign
+Copyright Laws, and FNAL reserves all rights.
+
+Distribution of the software available from this server is free of
+charge subject to the user following the terms of the Fermitools
+Software Legal Information.
+
+Redistribution and/or modification of the software shall be accompanied
+by the Fermitools Software Legal Information (including the copyright
+notice).
+
+The user is asked to feed back problems, benefits, and/or suggestions
+about the software to the Fermilab Software Providers.
+
+Neither the name of Fermilab, the URA, nor the names of the contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+DISCLAIMER OF LIABILITY (BSD):
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FERMILAB,
+OR THE URA, OR THE U.S. DEPARTMENT of ENERGY, OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Liabilities of the Government:
+
+This software is provided by URA, independent from its Prime Contract
+with the U.S. Department of Energy. URA is acting independently from
+the Government and in its own private capacity and is not acting on
+behalf of the U.S. Government, nor as its contractor nor its agent.
+Correspondingly, it is understood and agreed that the U.S. Government
+has no connection to this software and in no manner whatsoever shall
+be liable for nor assume any responsibility or obligation for any claim,
+cost, or damages arising out of or resulting from the use of the software
+available from this server.
+
+Export Control:
+
+All documents and software available from this server are subject to U.S.
+export control laws. Anyone downloading information from this server is
+obligated to secure any necessary Government licenses before exporting
+documents or software obtained from this server.
+ */
+package org.dcache.vehicles.qos;
+
+import org.dcache.qos.QoSPolicy;
+
+public class PnfsManagerAddQoSPolicyMessage extends PnfsManagerQoSPolicyMessage {
+
+ private static final long serialVersionUID = -7885598791426942261L;
+ private final QoSPolicy policy;
+
+ public PnfsManagerAddQoSPolicyMessage(QoSPolicy policy) {
+ this.policy = policy;
+ }
+
+ public QoSPolicy getPolicy() {
+ return policy;
+ }
+}
diff --git a/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerGetQoSPolicyMessage.java b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerGetQoSPolicyMessage.java
new file mode 100644
index 00000000000..154ba0691e4
--- /dev/null
+++ b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerGetQoSPolicyMessage.java
@@ -0,0 +1,85 @@
+/*
+COPYRIGHT STATUS:
+Dec 1st 2001, Fermi National Accelerator Laboratory (FNAL) documents and
+software are sponsored by the U.S. Department of Energy under Contract No.
+DE-AC02-76CH03000. Therefore, the U.S. Government retains a world-wide
+non-exclusive, royalty-free license to publish or reproduce these documents
+and software for U.S. Government purposes. All documents and software
+available from this server are protected under the U.S. and Foreign
+Copyright Laws, and FNAL reserves all rights.
+
+Distribution of the software available from this server is free of
+charge subject to the user following the terms of the Fermitools
+Software Legal Information.
+
+Redistribution and/or modification of the software shall be accompanied
+by the Fermitools Software Legal Information (including the copyright
+notice).
+
+The user is asked to feed back problems, benefits, and/or suggestions
+about the software to the Fermilab Software Providers.
+
+Neither the name of Fermilab, the URA, nor the names of the contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+DISCLAIMER OF LIABILITY (BSD):
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FERMILAB,
+OR THE URA, OR THE U.S. DEPARTMENT of ENERGY, OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Liabilities of the Government:
+
+This software is provided by URA, independent from its Prime Contract
+with the U.S. Department of Energy. URA is acting independently from
+the Government and in its own private capacity and is not acting on
+behalf of the U.S. Government, nor as its contractor nor its agent.
+Correspondingly, it is understood and agreed that the U.S. Government
+has no connection to this software and in no manner whatsoever shall
+be liable for nor assume any responsibility or obligation for any claim,
+cost, or damages arising out of or resulting from the use of the software
+available from this server.
+
+Export Control:
+
+All documents and software available from this server are subject to U.S.
+export control laws. Anyone downloading information from this server is
+obligated to secure any necessary Government licenses before exporting
+documents or software obtained from this server.
+ */
+package org.dcache.vehicles.qos;
+
+import org.dcache.qos.QoSPolicy;
+
+public class PnfsManagerGetQoSPolicyMessage extends PnfsManagerQoSPolicyMessage {
+
+ private static final long serialVersionUID = 1132558931827401229L;
+ private final String policyName;
+ private QoSPolicy policy;
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ public PnfsManagerGetQoSPolicyMessage(String policyName) {
+ this.policyName = policyName;
+ }
+
+ public QoSPolicy getPolicy() {
+ return policy;
+ }
+
+ public void setPolicy(QoSPolicy policy) {
+ this.policy = policy;
+ }
+}
diff --git a/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerGetQoSPolicyStatsMessage.java b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerGetQoSPolicyStatsMessage.java
new file mode 100644
index 00000000000..ed688ee39b0
--- /dev/null
+++ b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerGetQoSPolicyStatsMessage.java
@@ -0,0 +1,77 @@
+/*
+COPYRIGHT STATUS:
+Dec 1st 2001, Fermi National Accelerator Laboratory (FNAL) documents and
+software are sponsored by the U.S. Department of Energy under Contract No.
+DE-AC02-76CH03000. Therefore, the U.S. Government retains a world-wide
+non-exclusive, royalty-free license to publish or reproduce these documents
+and software for U.S. Government purposes. All documents and software
+available from this server are protected under the U.S. and Foreign
+Copyright Laws, and FNAL reserves all rights.
+
+Distribution of the software available from this server is free of
+charge subject to the user following the terms of the Fermitools
+Software Legal Information.
+
+Redistribution and/or modification of the software shall be accompanied
+by the Fermitools Software Legal Information (including the copyright
+notice).
+
+The user is asked to feed back problems, benefits, and/or suggestions
+about the software to the Fermilab Software Providers.
+
+Neither the name of Fermilab, the URA, nor the names of the contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+DISCLAIMER OF LIABILITY (BSD):
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FERMILAB,
+OR THE URA, OR THE U.S. DEPARTMENT of ENERGY, OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Liabilities of the Government:
+
+This software is provided by URA, independent from its Prime Contract
+with the U.S. Department of Energy. URA is acting independently from
+the Government and in its own private capacity and is not acting on
+behalf of the U.S. Government, nor as its contractor nor its agent.
+Correspondingly, it is understood and agreed that the U.S. Government
+has no connection to this software and in no manner whatsoever shall
+be liable for nor assume any responsibility or obligation for any claim,
+cost, or damages arising out of or resulting from the use of the software
+available from this server.
+
+Export Control:
+
+All documents and software available from this server are subject to U.S.
+export control laws. Anyone downloading information from this server is
+obligated to secure any necessary Government licenses before exporting
+documents or software obtained from this server.
+ */
+package org.dcache.vehicles.qos;
+
+import java.util.List;
+import org.dcache.qos.QoSPolicyStat;
+
+public class PnfsManagerGetQoSPolicyStatsMessage extends PnfsManagerQoSPolicyMessage {
+
+ private static final long serialVersionUID = -6481629980312661139L;
+ private List policyStats;
+
+ public List getPolicyStats() {
+ return policyStats;
+ }
+
+ public void setPolicyStats(List policyStats) {
+ this.policyStats = policyStats;
+ }
+}
diff --git a/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerInvalidateQoSPolicyMessage.java b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerInvalidateQoSPolicyMessage.java
new file mode 100644
index 00000000000..acd8da80b1c
--- /dev/null
+++ b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerInvalidateQoSPolicyMessage.java
@@ -0,0 +1,73 @@
+/*
+COPYRIGHT STATUS:
+Dec 1st 2001, Fermi National Accelerator Laboratory (FNAL) documents and
+software are sponsored by the U.S. Department of Energy under Contract No.
+DE-AC02-76CH03000. Therefore, the U.S. Government retains a world-wide
+non-exclusive, royalty-free license to publish or reproduce these documents
+and software for U.S. Government purposes. All documents and software
+available from this server are protected under the U.S. and Foreign
+Copyright Laws, and FNAL reserves all rights.
+
+Distribution of the software available from this server is free of
+charge subject to the user following the terms of the Fermitools
+Software Legal Information.
+
+Redistribution and/or modification of the software shall be accompanied
+by the Fermitools Software Legal Information (including the copyright
+notice).
+
+The user is asked to feed back problems, benefits, and/or suggestions
+about the software to the Fermilab Software Providers.
+
+Neither the name of Fermilab, the URA, nor the names of the contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+DISCLAIMER OF LIABILITY (BSD):
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FERMILAB,
+OR THE URA, OR THE U.S. DEPARTMENT of ENERGY, OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Liabilities of the Government:
+
+This software is provided by URA, independent from its Prime Contract
+with the U.S. Department of Energy. URA is acting independently from
+the Government and in its own private capacity and is not acting on
+behalf of the U.S. Government, nor as its contractor nor its agent.
+Correspondingly, it is understood and agreed that the U.S. Government
+has no connection to this software and in no manner whatsoever shall
+be liable for nor assume any responsibility or obligation for any claim,
+cost, or damages arising out of or resulting from the use of the software
+available from this server.
+
+Export Control:
+
+All documents and software available from this server are subject to U.S.
+export control laws. Anyone downloading information from this server is
+obligated to secure any necessary Government licenses before exporting
+documents or software obtained from this server.
+ */
+package org.dcache.vehicles.qos;
+
+public class PnfsManagerInvalidateQoSPolicyMessage extends PnfsManagerQoSPolicyMessage {
+
+ private final Integer id;
+
+ public PnfsManagerInvalidateQoSPolicyMessage(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getPolicyId() {
+ return id;
+ }
+}
diff --git a/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerListQoSPoliciesMessage.java b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerListQoSPoliciesMessage.java
new file mode 100644
index 00000000000..bd6ffcd9b5e
--- /dev/null
+++ b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerListQoSPoliciesMessage.java
@@ -0,0 +1,76 @@
+/*
+COPYRIGHT STATUS:
+Dec 1st 2001, Fermi National Accelerator Laboratory (FNAL) documents and
+software are sponsored by the U.S. Department of Energy under Contract No.
+DE-AC02-76CH03000. Therefore, the U.S. Government retains a world-wide
+non-exclusive, royalty-free license to publish or reproduce these documents
+and software for U.S. Government purposes. All documents and software
+available from this server are protected under the U.S. and Foreign
+Copyright Laws, and FNAL reserves all rights.
+
+Distribution of the software available from this server is free of
+charge subject to the user following the terms of the Fermitools
+Software Legal Information.
+
+Redistribution and/or modification of the software shall be accompanied
+by the Fermitools Software Legal Information (including the copyright
+notice).
+
+The user is asked to feed back problems, benefits, and/or suggestions
+about the software to the Fermilab Software Providers.
+
+Neither the name of Fermilab, the URA, nor the names of the contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+DISCLAIMER OF LIABILITY (BSD):
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FERMILAB,
+OR THE URA, OR THE U.S. DEPARTMENT of ENERGY, OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Liabilities of the Government:
+
+This software is provided by URA, independent from its Prime Contract
+with the U.S. Department of Energy. URA is acting independently from
+the Government and in its own private capacity and is not acting on
+behalf of the U.S. Government, nor as its contractor nor its agent.
+Correspondingly, it is understood and agreed that the U.S. Government
+has no connection to this software and in no manner whatsoever shall
+be liable for nor assume any responsibility or obligation for any claim,
+cost, or damages arising out of or resulting from the use of the software
+available from this server.
+
+Export Control:
+
+All documents and software available from this server are subject to U.S.
+export control laws. Anyone downloading information from this server is
+obligated to secure any necessary Government licenses before exporting
+documents or software obtained from this server.
+ */
+package org.dcache.vehicles.qos;
+
+import java.util.List;
+
+public class PnfsManagerListQoSPoliciesMessage extends PnfsManagerQoSPolicyMessage {
+
+ private static final long serialVersionUID = 6919989300647938799L;
+ private List policies;
+
+ public List getPolicies() {
+ return policies;
+ }
+
+ public void setPolicies(List policies) {
+ this.policies = policies;
+ }
+}
diff --git a/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerQoSPolicyMessage.java b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerQoSPolicyMessage.java
new file mode 100644
index 00000000000..b785704c945
--- /dev/null
+++ b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerQoSPolicyMessage.java
@@ -0,0 +1,65 @@
+/*
+COPYRIGHT STATUS:
+Dec 1st 2001, Fermi National Accelerator Laboratory (FNAL) documents and
+software are sponsored by the U.S. Department of Energy under Contract No.
+DE-AC02-76CH03000. Therefore, the U.S. Government retains a world-wide
+non-exclusive, royalty-free license to publish or reproduce these documents
+and software for U.S. Government purposes. All documents and software
+available from this server are protected under the U.S. and Foreign
+Copyright Laws, and FNAL reserves all rights.
+
+Distribution of the software available from this server is free of
+charge subject to the user following the terms of the Fermitools
+Software Legal Information.
+
+Redistribution and/or modification of the software shall be accompanied
+by the Fermitools Software Legal Information (including the copyright
+notice).
+
+The user is asked to feed back problems, benefits, and/or suggestions
+about the software to the Fermilab Software Providers.
+
+Neither the name of Fermilab, the URA, nor the names of the contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+DISCLAIMER OF LIABILITY (BSD):
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FERMILAB,
+OR THE URA, OR THE U.S. DEPARTMENT of ENERGY, OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Liabilities of the Government:
+
+This software is provided by URA, independent from its Prime Contract
+with the U.S. Department of Energy. URA is acting independently from
+the Government and in its own private capacity and is not acting on
+behalf of the U.S. Government, nor as its contractor nor its agent.
+Correspondingly, it is understood and agreed that the U.S. Government
+has no connection to this software and in no manner whatsoever shall
+be liable for nor assume any responsibility or obligation for any claim,
+cost, or damages arising out of or resulting from the use of the software
+available from this server.
+
+Export Control:
+
+All documents and software available from this server are subject to U.S.
+export control laws. Anyone downloading information from this server is
+obligated to secure any necessary Government licenses before exporting
+documents or software obtained from this server.
+ */
+package org.dcache.vehicles.qos;
+
+import diskCacheV111.vehicles.Message;
+
+public abstract class PnfsManagerQoSPolicyMessage extends Message {
+}
diff --git a/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerRmQoSPolicyMessage.java b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerRmQoSPolicyMessage.java
new file mode 100644
index 00000000000..8e2d3eca960
--- /dev/null
+++ b/modules/dcache-vehicles/src/main/java/org/dcache/vehicles/qos/PnfsManagerRmQoSPolicyMessage.java
@@ -0,0 +1,79 @@
+/*
+COPYRIGHT STATUS:
+Dec 1st 2001, Fermi National Accelerator Laboratory (FNAL) documents and
+software are sponsored by the U.S. Department of Energy under Contract No.
+DE-AC02-76CH03000. Therefore, the U.S. Government retains a world-wide
+non-exclusive, royalty-free license to publish or reproduce these documents
+and software for U.S. Government purposes. All documents and software
+available from this server are protected under the U.S. and Foreign
+Copyright Laws, and FNAL reserves all rights.
+
+Distribution of the software available from this server is free of
+charge subject to the user following the terms of the Fermitools
+Software Legal Information.
+
+Redistribution and/or modification of the software shall be accompanied
+by the Fermitools Software Legal Information (including the copyright
+notice).
+
+The user is asked to feed back problems, benefits, and/or suggestions
+about the software to the Fermilab Software Providers.
+
+Neither the name of Fermilab, the URA, nor the names of the contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+DISCLAIMER OF LIABILITY (BSD):
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FERMILAB,
+OR THE URA, OR THE U.S. DEPARTMENT of ENERGY, OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Liabilities of the Government:
+
+This software is provided by URA, independent from its Prime Contract
+with the U.S. Department of Energy. URA is acting independently from
+the Government and in its own private capacity and is not acting on
+behalf of the U.S. Government, nor as its contractor nor its agent.
+Correspondingly, it is understood and agreed that the U.S. Government
+has no connection to this software and in no manner whatsoever shall
+be liable for nor assume any responsibility or obligation for any claim,
+cost, or damages arising out of or resulting from the use of the software
+available from this server.
+
+Export Control:
+
+All documents and software available from this server are subject to U.S.
+export control laws. Anyone downloading information from this server is
+obligated to secure any necessary Government licenses before exporting
+documents or software obtained from this server.
+ */
+package org.dcache.vehicles.qos;
+
+public class PnfsManagerRmQoSPolicyMessage extends PnfsManagerGetQoSPolicyMessage {
+
+ private static final long serialVersionUID = -5652319794572481960L;
+
+ private Integer id;
+
+ public PnfsManagerRmQoSPolicyMessage(String policyName) {
+ super(policyName);
+ }
+
+ public Integer getPolicyId() {
+ return id;
+ }
+
+ public void setPolicyId(Integer id) {
+ this.id = id;
+ }
+}
diff --git a/modules/dcache/src/main/java/diskCacheV111/namespace/PnfsManagerV3.java b/modules/dcache/src/main/java/diskCacheV111/namespace/PnfsManagerV3.java
index ad8ce543e9b..9af507e8c26 100644
--- a/modules/dcache/src/main/java/diskCacheV111/namespace/PnfsManagerV3.java
+++ b/modules/dcache/src/main/java/diskCacheV111/namespace/PnfsManagerV3.java
@@ -22,10 +22,15 @@
import static org.dcache.namespace.FileAttribute.OWNER;
import static org.dcache.namespace.FileAttribute.OWNER_GROUP;
import static org.dcache.namespace.FileAttribute.PNFSID;
+import static org.dcache.namespace.FileAttribute.QOS_POLICY;
+import static org.dcache.namespace.FileAttribute.QOS_STATE;
import static org.dcache.namespace.FileAttribute.SIZE;
import static org.dcache.namespace.FileAttribute.TYPE;
import static org.dcache.namespace.FileAttribute.XATTR;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
@@ -121,7 +126,9 @@
import org.dcache.auth.attributes.Activity;
import org.dcache.auth.attributes.Restriction;
import org.dcache.cells.CellStub;
+import org.dcache.chimera.ChimeraFsException;
import org.dcache.chimera.UnixPermission;
+import org.dcache.chimera.qos.JdbcQos;
import org.dcache.chimera.quota.JdbcQuota;
import org.dcache.chimera.quota.Quota;
import org.dcache.chimera.quota.QuotaHandler;
@@ -131,6 +138,7 @@
import org.dcache.namespace.FileType;
import org.dcache.namespace.ListHandler;
import org.dcache.namespace.PermissionHandler;
+import org.dcache.qos.QoSPolicy;
import org.dcache.quota.data.QuotaInfo;
import org.dcache.quota.data.QuotaRequest;
import org.dcache.quota.data.QuotaType;
@@ -149,6 +157,13 @@
import org.dcache.vehicles.PnfsRemoveChecksumMessage;
import org.dcache.vehicles.PnfsResolveSymlinksMessage;
import org.dcache.vehicles.PnfsSetFileAttributes;
+import org.dcache.vehicles.qos.PnfsManagerAddQoSPolicyMessage;
+import org.dcache.vehicles.qos.PnfsManagerGetQoSPolicyMessage;
+import org.dcache.vehicles.qos.PnfsManagerGetQoSPolicyStatsMessage;
+import org.dcache.vehicles.qos.PnfsManagerInvalidateQoSPolicyMessage;
+import org.dcache.vehicles.qos.PnfsManagerListQoSPoliciesMessage;
+import org.dcache.vehicles.qos.PnfsManagerQoSPolicyMessage;
+import org.dcache.vehicles.qos.PnfsManagerRmQoSPolicyMessage;
import org.dcache.vehicles.quota.PnfsManagerGetQuotaMessage;
import org.dcache.vehicles.quota.PnfsManagerQuotaMessage;
import org.dcache.vehicles.quota.PnfsManagerRemoveQuotaMessage;
@@ -259,6 +274,8 @@ public class PnfsManagerV3
private JdbcQuota quotaSystem;
+ private JdbcQos qosManager;
+
private final Function pathResolver = p -> resolveSymlinks(p.toString());
private void populateRequestMap() {
@@ -437,44 +454,44 @@ public void init() {
executor.execute(new ProcessThread(_fifos[i]));
}
- if (useParallelListing) {
- /**
- * when using parallel listing we have _listThreads
- * consumers serving a single queue.
- */
- _listQueues = new BlockingQueue[1];
- if (_queueMaxSize > 0) {
- _listQueues[0] = new LinkedBlockingQueue<>(_queueMaxSize);
- } else {
- _listQueues[0] = new LinkedBlockingQueue<>();
- }
-
- /**
- * spawn consumers
- */
- for (int i = 0; i < _listThreads; i++) {
- ProcessThread t = new ProcessThread(_listQueues[0]);
- _listProcessThreads.add(t);
- executor.execute(t);
- }
- } else {
- /**
- * Start separate _listThreads queues for list operations.
- * each consumer processes a dedicated queue
- */
- _listQueues = new BlockingQueue[_listThreads];
- for (int i = 0; i < _listQueues.length; i++) {
- if (_queueMaxSize > 0) {
- _listQueues[i] = new LinkedBlockingQueue<>(_queueMaxSize);
- } else {
- _listQueues[i] = new LinkedBlockingQueue<>();
- }
- ProcessThread t = null;
- t = new ProcessThread(_listQueues[i]);
- _listProcessThreads.add(t);
- executor.execute(t);
- }
- }
+ if (useParallelListing) {
+ /**
+ * when using parallel listing we have _listThreads
+ * consumers serving a single queue.
+ */
+ _listQueues = new BlockingQueue[1];
+ if (_queueMaxSize > 0) {
+ _listQueues[0] = new LinkedBlockingQueue<>(_queueMaxSize);
+ } else {
+ _listQueues[0] = new LinkedBlockingQueue<>();
+ }
+
+ /**
+ * spawn consumers
+ */
+ for (int i = 0; i < _listThreads; i++) {
+ ProcessThread t = new ProcessThread(_listQueues[0]);
+ _listProcessThreads.add(t);
+ executor.execute(t);
+ }
+ } else {
+ /**
+ * Start separate _listThreads queues for list operations.
+ * each consumer processes a dedicated queue
+ */
+ _listQueues = new BlockingQueue[_listThreads];
+ for (int i = 0; i < _listQueues.length; i++) {
+ if (_queueMaxSize > 0) {
+ _listQueues[i] = new LinkedBlockingQueue<>(_queueMaxSize);
+ } else {
+ _listQueues[i] = new LinkedBlockingQueue<>();
+ }
+ ProcessThread t = null;
+ t = new ProcessThread(_listQueues[i]);
+ _listProcessThreads.add(t);
+ executor.execute(t);
+ }
+ }
}
public void shutdown() throws InterruptedException {
@@ -566,8 +583,8 @@ public void getInfo(PrintWriter pw) {
}
pw.println();
pw.println("List queue: "
- + Arrays.stream(_listQueues)
- .mapToInt(BlockingQueue::size).sum());
+ + Arrays.stream(_listQueues)
+ .mapToInt(BlockingQueue::size).sum());
pw.println();
pw.println("Threads (" + _fifos.length + ") Queue");
for (int i = 0; i < _fifos.length; i++) {
@@ -583,21 +600,26 @@ public void getInfo(PrintWriter pw) {
pw.println(_foldedCounters.toString());
}
- @Command(name = "reset stats", hint="reset statistics",
- description = "Reset the counters and gauge statistics describing PnfsManager. These"
- + " statistics are shown as part of the 'info' command output.")
+ @Required
+ public void setQosManager(JdbcQos qosManager) {
+ this.qosManager = qosManager;
+ }
+
+ @Command(name = "reset stats", hint = "reset statistics",
+ description = "Reset the counters and gauge statistics describing PnfsManager. These"
+ + " statistics are shown as part of the 'info' command output.")
public class ResetStatsCommand implements Callable {
- @Option(name="target", usage="Which statistics to reset:\n"
- + "\n"
- + "\"calls\" is the cell message call gauges, labelled 'PnfsManagerV3'.\n"
- + "\n"
- + "\"folds\" is the message folding counts, labelled 'PnfsManagerV3.Folded'.\n"
- + "\n"
- + "\"all\" resets everything.\n"
- + "\n"
- + "If this option is not specified then \"all\" is assumed.",
- values={"calls", "folds", "all"})
+ @Option(name = "target", usage = "Which statistics to reset:\n"
+ + "\n"
+ + "\"calls\" is the cell message call gauges, labelled 'PnfsManagerV3'.\n"
+ + "\n"
+ + "\"folds\" is the message folding counts, labelled 'PnfsManagerV3.Folded'.\n"
+ + "\n"
+ + "\"all\" resets everything.\n"
+ + "\n"
+ + "If this option is not specified then \"all\" is assumed.",
+ values = {"calls", "folds", "all"})
private String target;
@Override
@@ -606,18 +628,18 @@ public String call() throws CommandException {
target = "all";
}
switch (target) {
- case "all":
- _gauges.reset();
- _foldedCounters.reset();
- break;
- case "calls":
- _gauges.reset();
- break;
- case "folds":
- _foldedCounters.reset();
- break;
- default:
- throw new CommandException("Unknown target \"" + target + "\".");
+ case "all":
+ _gauges.reset();
+ _foldedCounters.reset();
+ break;
+ case "calls":
+ _gauges.reset();
+ break;
+ case "folds":
+ _foldedCounters.reset();
+ break;
+ default:
+ throw new CommandException("Unknown target \"" + target + "\".");
}
return "";
}
@@ -994,6 +1016,40 @@ public String call() throws CacheException {
}
}
+ @Command(name = "qos policies",
+ hint = "List qos policy names",
+ description = "Show list of policy names")
+
+ public class ListQosPolicyCommand implements Callable {
+ @Override
+ public String call() throws CacheException {
+ return qosManager.listQoSPolicies().stream().collect(Collectors.joining("\n"));
+ }
+ }
+
+ @Command(name = "show qos policy",
+ hint = "Print qos policy",
+ description = "Display qos policy")
+
+ public class ShowQosPolicyCommand implements Callable {
+ @Argument(usage = "The policy name.")
+ String policy;
+
+ public String call() throws CacheException {
+ Optional optional = qosManager.getQosPolicy(policy);
+ if (optional.isPresent()) {
+ ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
+ try {
+ return ow.writeValueAsString(optional.get());
+ } catch (JsonProcessingException e) {
+ throw new CacheException(CacheException.INVALID_ARGS, e.getMessage());
+ }
+ }
+
+ return policy + " not found.";
+ }
+ }
+
@Command(name = "show group quota",
hint = "Print group quota",
description = "Display group quota")
@@ -1267,6 +1323,56 @@ public String call() throws CacheException {
}
}
+ @Command(name = "file policy",
+ hint = "shows qos policy info",
+ description = "Reports policy name and state for the file, if defined.")
+ public class FileQoSPolicy implements Callable {
+
+ @Argument(usage = "|.")
+ String pathOrId;
+
+ @Override
+ public String call() throws CacheException {
+ PnfsId pnfsId;
+
+ if (pathOrId.contains("/")) {
+ pnfsId = _nameSpaceProvider.pathToPnfsid(ROOT, pathOrId, true);
+ } else {
+ pnfsId = new PnfsId(pathOrId);
+ }
+
+ FileAttributes attr =
+ _nameSpaceProvider.getFileAttributes(ROOT, pnfsId,
+ EnumSet.of(QOS_POLICY, QOS_STATE));
+
+ String policy =
+ attr.isDefined(QOS_POLICY) ? attr.getQosPolicy() : "undefined.";
+ String state = attr.isDefined(QOS_STATE) ? Integer.toString(attr.getQosState())
+ : "undefined.";
+
+ return "QOS POLICY: " + policy + "\nQOS STATE: " + state;
+ }
+ }
+
+ @Command(name = "file policy stats",
+ hint = "shows summary of qos policy info",
+ description = "Gives a list of policy names, states and "
+ + "respective file counts.")
+ public class FileQoSPolicyStats implements Callable {
+
+ @Override
+ public String call() throws Exception {
+ PnfsManagerGetQoSPolicyStatsMessage message
+ = new PnfsManagerGetQoSPolicyStatsMessage();
+ message = (PnfsManagerGetQoSPolicyStatsMessage) messageArrived(
+ message);
+ message.setSubject(ROOT);
+ StringBuilder sb = new StringBuilder();
+ message.getPolicyStats().forEach(ps -> sb.append(ps));
+ return sb.toString();
+ }
+ }
+
public static final String hh_add_file_cache_location = " ";
public String ac_add_file_cache_location_$_2(Args args) throws Exception {
@@ -1560,7 +1666,7 @@ public class ShowListActivityCommand implements Callable {
public String call() {
ColumnWriter writer = buildColumnWriter();
- if (Arrays.stream(_listQueues).anyMatch(q -> !q.isEmpty())) {
+ if (Arrays.stream(_listQueues).anyMatch(q -> !q.isEmpty())) {
writer.section("QUEUED REQUESTS");
for (BlockingQueue queue : _listQueues) {
if (!queue.isEmpty()) {
@@ -2201,9 +2307,9 @@ private class ListHandlerImpl implements ListHandler {
private final BlockingQueue _fifo;
public ListHandlerImpl(CellPath requestor, UOID uoid,
- PnfsListDirectoryMessage msg,
- long initialDelay, long delay,
- BlockingQueue fifo) {
+ PnfsListDirectoryMessage msg,
+ long initialDelay, long delay,
+ BlockingQueue fifo) {
_msg = msg;
_requestor = requestor;
_uoid = uoid;
@@ -2234,7 +2340,6 @@ private void sendPartialReply() {
*/
for (CellMessage message : _fifo) {
-
PnfsMessage other = (PnfsMessage) message.getMessageObject();
if (other.invalidates(_msg)) {
@@ -2274,7 +2379,8 @@ public int getMessageCount() {
}
}
- private void listDirectory(CellMessage envelope, PnfsListDirectoryMessage msg, BlockingQueue fifo) {
+ private void listDirectory(CellMessage envelope, PnfsListDirectoryMessage msg,
+ BlockingQueue fifo) {
if (!msg.getReplyRequired()) {
return;
}
@@ -2292,8 +2398,8 @@ private void listDirectory(CellMessage envelope, PnfsListDirectoryMessage msg, B
: delay - envelope.getLocalAge();
CellPath source = envelope.getSourcePath().revert();
ListHandlerImpl handler =
- new ListHandlerImpl(source, envelope.getUOID(),
- msg, initialDelay, delay, fifo);
+ new ListHandlerImpl(source, envelope.getUOID(),
+ msg, initialDelay, delay, fifo);
if (msg.getPathType() == PnfsListDirectoryMessage.PathType.LABEL) {
_nameSpaceProvider.listVirtualDirectory(msg.getSubject(), path.substring(1),
@@ -2630,6 +2736,72 @@ private Quota getQuota(Integer qid, QuotaType type) {
}
}
+
+ /*
+ * --------------------------------------- QOS POLICY --------------------------------------
+ */
+ public PnfsManagerQoSPolicyMessage messageArrived(PnfsManagerQoSPolicyMessage message) {
+ try {
+ if (message instanceof PnfsManagerAddQoSPolicyMessage) {
+ processSetQoSPolicy((PnfsManagerAddQoSPolicyMessage) message);
+ } else if (message instanceof PnfsManagerRmQoSPolicyMessage) {
+ processRmQoSPolicy((PnfsManagerRmQoSPolicyMessage) message);
+ } else if (message instanceof PnfsManagerGetQoSPolicyMessage) {
+ processGetQoSPolicy((PnfsManagerGetQoSPolicyMessage) message);
+ } else if (message instanceof PnfsManagerListQoSPoliciesMessage) {
+ processListQoSPolicies((PnfsManagerListQoSPoliciesMessage) message);
+ } else if (message instanceof PnfsManagerGetQoSPolicyStatsMessage) {
+ processQoSPolicyStats((PnfsManagerGetQoSPolicyStatsMessage)message);
+ } else if (message instanceof PnfsManagerInvalidateQoSPolicyMessage) {
+ processInvalidateQoSPolcy((PnfsManagerInvalidateQoSPolicyMessage)message);
+ } else {
+ LOGGER.warn("Unexpected message type {}", message.getClass());
+ throw new CacheException(CacheException.INVALID_ARGS, "Unexpected message type.");
+ }
+ message.setSucceeded();
+ } catch (CacheException e) {
+ message.setFailed(e.getRc(), e.getMessage());
+ }
+ return message;
+ }
+
+ private void processQoSPolicyStats(PnfsManagerGetQoSPolicyStatsMessage message) {
+ message.setPolicyStats(qosManager.getPolicyStatsByPolicyName());
+ }
+
+ private void processGetQoSPolicy(PnfsManagerGetQoSPolicyMessage message) throws CacheException {
+ Optional policy = qosManager.getQosPolicy(message.getPolicyName());
+ if (policy.isPresent()) {
+ message.setPolicy(policy.get());
+ } else {
+ throw new MissingResourceCacheException(message.getPolicyName());
+ }
+ }
+
+ private void processRmQoSPolicy(PnfsManagerRmQoSPolicyMessage message) throws CacheException {
+ try {
+ message.setPolicyId(qosManager.removeQosPolicy(message.getPolicyName()));
+ } catch (ChimeraFsException e) {
+ throw new CacheException(CacheException.RESOURCE, e.getMessage());
+ }
+ }
+
+ private void processSetQoSPolicy(PnfsManagerAddQoSPolicyMessage message) throws CacheException {
+ try {
+ qosManager.addQosPolicy(message.getPolicy());
+ } catch (ChimeraFsException e) {
+ throw new CacheException(CacheException.RESOURCE, e.getMessage());
+ }
+ }
+
+ private void processListQoSPolicies(PnfsManagerListQoSPoliciesMessage message) {
+ message.setPolicies(qosManager.listQoSPolicies());
+ }
+
+ private void processInvalidateQoSPolcy(PnfsManagerInvalidateQoSPolicyMessage message) {
+ qosManager.invalidate(message.getPolicyId());
+ }
+
/*
* ----------------------------------------------------------------------------------------
*/
@@ -2652,7 +2824,6 @@ public void messageArrived(CellMessage envelope, PnfsListDirectoryMessage messag
* when useParallelListing is true, we only have 1 queue in the
* list of queues below
*/
-
if (!_listQueues[index].offer(envelope)) {
throw new MissingResourceCacheException("PnfsManager queue limit exceeded");
}
@@ -3405,7 +3576,7 @@ private void checkRestriction(Restriction restriction, Set mask,
private void resolveSymlinks(PnfsResolveSymlinksMessage message) {
String prefix = message.getPrefix();
- String path = message.getPnfsPath();
+ String path = message.getPnfsPath();
if (Strings.emptyToNull(prefix) != null) {
message.setResolvedPrefix(resolveSymlinks(prefix).toString());
}
diff --git a/modules/dcache/src/main/java/diskCacheV111/vehicles/PoolMgrSelectReadPoolMsg.java b/modules/dcache/src/main/java/diskCacheV111/vehicles/PoolMgrSelectReadPoolMsg.java
index 859598bd199..0e413ffa335 100644
--- a/modules/dcache/src/main/java/diskCacheV111/vehicles/PoolMgrSelectReadPoolMsg.java
+++ b/modules/dcache/src/main/java/diskCacheV111/vehicles/PoolMgrSelectReadPoolMsg.java
@@ -10,6 +10,8 @@
import static org.dcache.namespace.FileAttribute.HSM;
import static org.dcache.namespace.FileAttribute.LOCATIONS;
import static org.dcache.namespace.FileAttribute.PNFSID;
+import static org.dcache.namespace.FileAttribute.QOS_POLICY;
+import static org.dcache.namespace.FileAttribute.QOS_STATE;
import static org.dcache.namespace.FileAttribute.RETENTION_POLICY;
import static org.dcache.namespace.FileAttribute.SIZE;
import static org.dcache.namespace.FileAttribute.STORAGECLASS;
@@ -50,7 +52,7 @@ public class PoolMgrSelectReadPoolMsg extends PoolMgrSelectPoolMsg {
private static final EnumSet REQUIRED_ATTRIBUTES =
EnumSet.of(PNFSID, STORAGEINFO, STORAGECLASS, CACHECLASS, HSM, LOCATIONS, SIZE,
- ACCESS_LATENCY, RETENTION_POLICY);
+ ACCESS_LATENCY, RETENTION_POLICY, QOS_POLICY, QOS_STATE);
private static final long serialVersionUID = -2126253028981131441L;
diff --git a/modules/dcache/src/main/java/org/dcache/pool/repository/v5/WriteHandleImpl.java b/modules/dcache/src/main/java/org/dcache/pool/repository/v5/WriteHandleImpl.java
index 086e2882d2a..1820c7913cc 100644
--- a/modules/dcache/src/main/java/org/dcache/pool/repository/v5/WriteHandleImpl.java
+++ b/modules/dcache/src/main/java/org/dcache/pool/repository/v5/WriteHandleImpl.java
@@ -5,6 +5,8 @@
import static org.dcache.namespace.FileAttribute.ACCESS_LATENCY;
import static org.dcache.namespace.FileAttribute.CHECKSUM;
import static org.dcache.namespace.FileAttribute.LABELS;
+import static org.dcache.namespace.FileAttribute.QOS_POLICY;
+import static org.dcache.namespace.FileAttribute.QOS_STATE;
import static org.dcache.namespace.FileAttribute.RETENTION_POLICY;
import static org.dcache.namespace.FileAttribute.SIZE;
import static org.dcache.namespace.FileAttribute.XATTR;
@@ -185,6 +187,14 @@ private void registerFileAttributesInNameSpace() throws CacheException {
attributesToUpdate.setAccessLatency(_fileAttributes.getAccessLatency());
attributesToUpdate.setRetentionPolicy(_fileAttributes.getRetentionPolicy());
+ if (_fileAttributes.isDefined(QOS_POLICY)) {
+ attributesToUpdate.setQosPolicy(_fileAttributes.getQosPolicy());
+ }
+
+ if (_fileAttributes.isDefined(QOS_STATE)) {
+ attributesToUpdate.setQosState(_fileAttributes.getQosState());
+ }
+
if (_fileAttributes.isDefined(SIZE)) {
attributesToUpdate.setSize(_fileAttributes.getSize());
}
diff --git a/modules/dcache/src/test/java/org/dcache/pinmanager/PinManagerTests.java b/modules/dcache/src/test/java/org/dcache/pinmanager/PinManagerTests.java
index ebeec1e9f13..3e8bc0efa6c 100644
--- a/modules/dcache/src/test/java/org/dcache/pinmanager/PinManagerTests.java
+++ b/modules/dcache/src/test/java/org/dcache/pinmanager/PinManagerTests.java
@@ -105,6 +105,8 @@ private FileAttributes getAttributes(PnfsId pnfsId) {
attributes.setSize(0L);
attributes.setAccessLatency(StorageInfo.DEFAULT_ACCESS_LATENCY);
attributes.setRetentionPolicy(StorageInfo.DEFAULT_RETENTION_POLICY);
+ attributes.setQosState(0);
+ attributes.setQosPolicy(null);
attributes.setChecksums(Collections.emptySet());
attributes.setCacheClass(null);
attributes.setHsm("osm");
diff --git a/modules/dcache/src/test/java/org/dcache/tests/poolmanager/HsmRestoreTest.java b/modules/dcache/src/test/java/org/dcache/tests/poolmanager/HsmRestoreTest.java
index beb603bb277..a2af9d292ab 100644
--- a/modules/dcache/src/test/java/org/dcache/tests/poolmanager/HsmRestoreTest.java
+++ b/modules/dcache/src/test/java/org/dcache/tests/poolmanager/HsmRestoreTest.java
@@ -138,6 +138,8 @@ public void testRestoreNoLocations() throws Exception {
attributes.setSize(5);
attributes.setAccessLatency(StorageInfo.DEFAULT_ACCESS_LATENCY);
attributes.setRetentionPolicy(StorageInfo.DEFAULT_RETENTION_POLICY);
+ attributes.setQosPolicy(null);
+ attributes.setQosState(0);
attributes.setChecksums(Collections.emptySet());
fileAttributesMessage.setFileAttributes(attributes);
_cell.prepareMessage(new CellPath("PnfsManager"), fileAttributesMessage, true);
@@ -217,6 +219,8 @@ public void testRestoreNoLocationsOnePoolCantStage() throws Exception {
attributes.setSize(5);
attributes.setAccessLatency(StorageInfo.DEFAULT_ACCESS_LATENCY);
attributes.setRetentionPolicy(StorageInfo.DEFAULT_RETENTION_POLICY);
+ attributes.setQosPolicy(null);
+ attributes.setQosState(0);
attributes.setChecksums(Collections.emptySet());
fileAttributesMessage.setFileAttributes(attributes);
_cell.prepareMessage(new CellPath("PnfsManager"), fileAttributesMessage, true);
@@ -322,6 +326,8 @@ public void testRestoreNoLocationsSinglePool() throws Exception {
attributes.setSize(5);
attributes.setAccessLatency(StorageInfo.DEFAULT_ACCESS_LATENCY);
attributes.setRetentionPolicy(StorageInfo.DEFAULT_RETENTION_POLICY);
+ attributes.setQosPolicy(null);
+ attributes.setQosState(0);
attributes.setChecksums(Collections.emptySet());
fileAttributesMessage.setFileAttributes(attributes);
_cell.prepareMessage(new CellPath("PnfsManager"), fileAttributesMessage, true);
@@ -425,6 +431,8 @@ public void testRestoreNoLocationsAllPoolsCantStage() throws Exception {
attributes.setSize(5);
attributes.setAccessLatency(StorageInfo.DEFAULT_ACCESS_LATENCY);
attributes.setRetentionPolicy(StorageInfo.DEFAULT_RETENTION_POLICY);
+ attributes.setQosPolicy(null);
+ attributes.setQosState(0);
attributes.setChecksums(Collections.emptySet());
fileAttributesMessage.setFileAttributes(attributes);
_cell.prepareMessage(new CellPath("PnfsManager"), fileAttributesMessage, true);