Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ public PoolDataDetails getDataObject() {
info.setPingHeartbeatInSecs(_pingThread.getHeartbeat());
info.setP2pFileMode(_p2pFileMode == P2P_PRECIOUS ?
P2PMode.PRECIOUS : P2PMode.CACHED);
info.setHotFileReplicationEnabled(_hotFileReplicationEnabled);
info.setPoolMode(_poolMode.toString());
if (_poolMode.isDisabled()) {
info.setPoolStatusCode(_poolStatusCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public enum P2PMode {
private Lsf largeFileStore;

private P2PMode p2pFileMode;
private boolean isHotFileReplicationEnabled;
private Integer hybridInventory;

private int errorCode;
Expand Down Expand Up @@ -159,6 +160,10 @@ public P2PMode getP2pFileMode() {
return p2pFileMode;
}

public boolean isHotFileReplicationEnabled() {
return isHotFileReplicationEnabled;
}

public Integer getPingHeartbeatInSecs() {
return pingHeartbeatInSecs;
}
Expand Down Expand Up @@ -196,22 +201,23 @@ private String asOnOff(boolean value) {
}

public void print(PrintWriter pw) {
pw.println("Base directory : " + baseDir);
pw.println("Version : " + poolVersion);
pw.println("Report remove : " + asOnOff(isRemovalReported));
pw.println("Pool Mode : " + poolMode);
pw.println("Base directory : " + baseDir);
pw.println("Version : " + poolVersion);
pw.println("Report remove : " + asOnOff(isRemovalReported));
pw.println("Pool Mode : " + poolMode);
if (poolStatusCode != null) {
pw.println("Detail : [" + poolStatusCode + "] "
pw.println("Detail : [" + poolStatusCode + "] "
+ poolStatusMessage);
}
pw.println("Hsm Load Suppr. : " + asOnOff(isHsmLoadSuppressed));
pw.println("Ping Heartbeat : " + pingHeartbeatInSecs + " seconds");
pw.println("Breakeven : " + breakEven);
pw.println("LargeFileStore : " + largeFileStore);
pw.println("P2P File Mode : " + p2pFileMode);
pw.println("Hsm Load Suppression : " + asOnOff(isHsmLoadSuppressed));
pw.println("Ping Heartbeat : " + pingHeartbeatInSecs + " seconds");
pw.println("Breakeven : " + breakEven);
pw.println("LargeFileStore : " + largeFileStore);
pw.println("P2P File Mode : " + p2pFileMode);
pw.println("Hot File Replication : " + asOnOff(isHotFileReplicationEnabled));

if (hybridInventory != null) {
pw.println("Inventory : " + hybridInventory);
pw.println("Inventory : " + hybridInventory);
}

if (costData != null) {
Expand Down Expand Up @@ -269,6 +275,10 @@ public void setP2pFileMode(
this.p2pFileMode = p2pFileMode;
}

public void setHotFileReplicationEnabled(boolean isEnabled) {
this.isHotFileReplicationEnabled = isEnabled;
}

public void setPingHeartbeatInSecs(Integer pingHeartbeatInSecs) {
this.pingHeartbeatInSecs = pingHeartbeatInSecs;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1634,4 +1634,15 @@ public String call() {
return "Current threshold: " + getThreshold();
}
}

@Command(name = "hotfile show",
description = "Show the values of the 'replicas' and 'threshold' parameters.",
hint = "Show hot-file replication status.")
public class HotfileShowCommand implements Callable<String> {

@Override
public String call() {
return "replicas=" + hotFileReplicaCount + " threshold=" + hotFileThreshold;
}
Comment thread
greenc-FNAL marked this conversation as resolved.
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.dcache.pool.json;

import org.junit.Test;
import java.io.PrintWriter;
import java.io.StringWriter;
import static org.junit.Assert.assertTrue;

public class PoolDataDetailsTest {

@Test
public void shouldPrintHotfileReplicationStatus() {
PoolDataDetails details = new PoolDataDetails();
details.setHotFileReplicationEnabled(true);

StringWriter sw = new StringWriter();
try (PrintWriter pw = new PrintWriter(sw)) {
details.print(pw);
}

String output = sw.toString();
assertTrue("Output should contain Hot File Replication status", output.contains("Hot File Replication : ON"));

details.setHotFileReplicationEnabled(false);
sw = new StringWriter();
try (PrintWriter pw = new PrintWriter(sw)) {
details.print(pw);
}
output = sw.toString();
assertTrue("Output should contain Hot File Replication status", output.contains("Hot File Replication : OFF"));
}
}
Loading