diff --git a/modules/dcache-vehicles/src/main/java/diskCacheV111/util/DiskErrorCacheException.java b/modules/dcache-vehicles/src/main/java/diskCacheV111/util/DiskErrorCacheException.java index 2545d2452fe..5429cb86c9a 100644 --- a/modules/dcache-vehicles/src/main/java/diskCacheV111/util/DiskErrorCacheException.java +++ b/modules/dcache-vehicles/src/main/java/diskCacheV111/util/DiskErrorCacheException.java @@ -14,8 +14,13 @@ */ public class DiskErrorCacheException extends CacheException { + private static final long serialVersionUID = -5386946146340646052L; + public enum FileStoreState { + READ_ONLY, FAILED + } + public DiskErrorCacheException(String msg) { super(CacheException.ERROR_IO_DISK, msg); } @@ -23,4 +28,13 @@ public DiskErrorCacheException(String msg) { public DiskErrorCacheException(String message, Throwable cause) { super(CacheException.ERROR_IO_DISK, message, cause); } + + public FileStoreState checkStatus(String message) { + if (message.contains("No space available.")) { + return FileStoreState.READ_ONLY; + } else { + return FileStoreState.FAILED; + } + } + } diff --git a/modules/dcache/src/main/java/org/dcache/pool/classic/MoverRequestScheduler.java b/modules/dcache/src/main/java/org/dcache/pool/classic/MoverRequestScheduler.java index 7504d09c647..dde02e9cd52 100644 --- a/modules/dcache/src/main/java/org/dcache/pool/classic/MoverRequestScheduler.java +++ b/modules/dcache/src/main/java/org/dcache/pool/classic/MoverRequestScheduler.java @@ -513,8 +513,19 @@ public void failed(Throwable exc, Void attachment) { .setTransferStatus(CacheException.DEFAULT_ERROR_CODE, "Transfer was killed"); } else if (exc instanceof DiskErrorCacheException) { + FaultAction faultAction = null; + //TODO this is done because the FileStoreState is in another module + // to be improved + switch (((DiskErrorCacheException) exc).checkStatus(exc.getMessage())){ + case READ_ONLY: + faultAction = FaultAction.READONLY; + break; + default: + faultAction = FaultAction.DISABLED; + break; + } FaultEvent faultEvent = new FaultEvent("transfer", - FaultAction.DISABLED, exc.getMessage(), exc); + faultAction, exc.getMessage(), exc); _faultListeners.forEach(l -> l.faultOccurred(faultEvent)); } postprocess(); @@ -532,9 +543,18 @@ public void completed(Void result, Void attachment) { @Override public void failed(Throwable exc, Void attachment) { if (exc instanceof DiskErrorCacheException) { + FaultAction faultAction = null; + switch (((DiskErrorCacheException) exc).checkStatus(exc.getMessage())){ + case READ_ONLY: + faultAction = FaultAction.READONLY; + break; + default: + faultAction = FaultAction.DISABLED; + break; + } FaultEvent faultEvent = new FaultEvent( "post-processing", - FaultAction.DISABLED, + faultAction, exc.getMessage(), exc); _faultListeners.forEach( l -> l.faultOccurred(faultEvent));