From 1e2464c29c5a32663cfa7e912be221d8db023703 Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Wed, 19 Apr 2023 19:09:05 +0200 Subject: [PATCH] nearline-storage: update st/rh/rm kill command to accept wildcard Motivation: In some situations admins need to cancel all pending store/restore/remove requests from HSM. Currently dcache allows only kill by pnfsid, which makes it quite complicated to cancel all requests. Modification: Update st/rh/rm kill command to accept wildcard Result: less gray hear for admins Acked-by: Albert Rossi Acked-by: Lea Morschel Target: master Require-book: no Require-notes: yes --- .../pool/nearline/NearlineStorageHandler.java | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/modules/dcache/src/main/java/org/dcache/pool/nearline/NearlineStorageHandler.java b/modules/dcache/src/main/java/org/dcache/pool/nearline/NearlineStorageHandler.java index 97d5cd6754a..921c67fa0b0 100644 --- a/modules/dcache/src/main/java/org/dcache/pool/nearline/NearlineStorageHandler.java +++ b/modules/dcache/src/main/java/org/dcache/pool/nearline/NearlineStorageHandler.java @@ -1548,12 +1548,17 @@ public String call() { description = "Remove an HSM restore request.") class RestoreKillCommand implements Callable { - @Argument - PnfsId pnfsId; + @Argument(metaVar = "pnfsid|*") + String arg; @Override public String call() throws NoSuchElementException, IllegalStateException { - stageRequests.cancel(pnfsId); + if ("*".equals(arg)) { + stageRequests.cancelRequests(); + } else { + var pnfsId = new PnfsId(arg); + stageRequests.cancel(pnfsId); + } return "Kill initialized"; } } @@ -1610,12 +1615,18 @@ public String call() { description = "Remove an HSM store request.") class StoreKillCommand implements Callable { - @Argument - PnfsId pnfsId; + @Argument(metaVar = "pnfsid|*") + String arg; @Override public String call() throws NoSuchElementException, IllegalStateException { - flushRequests.cancel(pnfsId); + + if ("*".equals(arg)) { + flushRequests.cancelRequests(); + } else { + var pnfsId = new PnfsId(arg); + flushRequests.cancel(pnfsId); + } return "Kill initialized"; } } @@ -1685,12 +1696,17 @@ public String call() { description = "Remove and cancel the requests to remove a file from HSM.\n\n") class RemoveKillCommand implements Callable { - @Argument(metaVar = "HSM uri") - String uri; + @Argument(metaVar = "uri|*") + String arg; @Override public String call() { - removeRequests.cancel(URI.create(uri)); + + if ("*".equals(arg)) { + removeRequests.cancelRequests(); + } else { + removeRequests.cancel(URI.create(arg)); + } return "Kill initialized"; } }