DFSAdmin extends FsShell { int getReconfigurationStatus(String nodeType, String address, PrintStream out, PrintStream err) throws IOException { if ("datanode".equals(nodeType)) { ClientDatanodeProtocol dnProxy = getDataNodeProxy(address); try { ReconfigurationTaskStatus status = dnProxy.getReconfigurationStatus(); out.print("Reconfiguring status for DataNode[" + address + "]: "); if (!status.hasTask()) { out.println("no task was found."); return 0; } out.print("started at " + new Date(status.getStartTime())); if (!status.stopped()) { out.println(" and is still running."); return 0; } out.println(" and finished at " + new Date(status.getEndTime()).toString() + "."); if (status.getStatus() == null) { return 0; } for (Map.Entry<PropertyChange, Optional<String>> result : status.getStatus().entrySet()) { if (!result.getValue().isPresent()) { out.printf( "SUCCESS: Changed property %s%n\tFrom: \"%s\"%n\tTo: \"%s\"%n", result.getKey().prop, result.getKey().oldVal, result.getKey().newVal); } else { final String errorMsg = result.getValue().get(); out.printf( "FAILED: Change property %s%n\tFrom: \"%s\"%n\tTo: \"%s\"%n", result.getKey().prop, result.getKey().oldVal, result.getKey().newVal); out.println("\tError: " + errorMsg + "."); } } } catch (IOException e) { err.println("DataNode reloading configuration: " + e + "."); return 1; } } else { err.println("Node type " + nodeType + " does not support reconfiguration."); return 1; } return 0; } DFSAdmin();  DFSAdmin(Configuration conf); void report(String[] argv, int i); void setSafeMode(String[] argv, int idx); int triggerBlockReport(String[] argv); void allowSnapshot(String[] argv); void disallowSnapshot(String[] argv); int saveNamespace(String[] argv); int rollEdits(); int restoreFailedStorage(String arg); int refreshNodes(); int setBalancerBandwidth(String[] argv, int idx); int getBalancerBandwidth(String[] argv, int idx); int fetchImage(final String[] argv, final int idx); int finalizeUpgrade(); int metaSave(String[] argv, int idx); int printTopology(); int refreshServiceAcl(); int refreshUserToGroupsMappings(); int refreshSuperUserGroupsConfiguration(); int refreshCallQueue(); int reconfig(String[] argv, int i); int genericRefresh(String[] argv, int i); @Override int run(String[] argv); static void main(String[] argv);  }
@Test(timeout = 30000) public void testGetReconfigurationStatus() throws IOException, InterruptedException { testGetReconfigurationStatus(true); restartCluster(); testGetReconfigurationStatus(false); }