Skip to content

Commit

Permalink
nearline-storage: update st/rh/rm kill command to accept wildcard
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kofemann committed Apr 21, 2023
1 parent c136bb3 commit 1e2464c
Showing 1 changed file with 25 additions and 9 deletions.
Expand Up @@ -1548,12 +1548,17 @@ public String call() {
description = "Remove an HSM restore request.")
class RestoreKillCommand implements Callable<String> {

@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";
}
}
Expand Down Expand Up @@ -1610,12 +1615,18 @@ public String call() {
description = "Remove an HSM store request.")
class StoreKillCommand implements Callable<String> {

@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";
}
}
Expand Down Expand Up @@ -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<String> {

@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";
}
}
Expand Down

0 comments on commit 1e2464c

Please sign in to comment.