DFSAdmin extends FsShell { private int getVolumeReport(String[] argv, int i) throws IOException { ClientDatanodeProtocol datanode = getDataNodeProxy(argv[i]); List<DatanodeVolumeInfo> volumeReport = datanode .getVolumeReport(); System.out.println("Active Volumes : " + volumeReport.size()); for (DatanodeVolumeInfo info : volumeReport) { System.out.println("\n" + info.getDatanodeVolumeReport()); } 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); void provisionSnapshotTrash(String[] argv); int saveNamespace(String[] argv); int rollEdits(); int restoreFailedStorage(String arg); int refreshNodes(); int listOpenFiles(String[] argv); int setBalancerBandwidth(String[] argv, int idx); int getBalancerBandwidth(String[] argv, int idx); int fetchImage(final String[] argv, final int idx); int finalizeUpgrade(); int getUpgradeStatus(); int upgrade(String arg); 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 testGetVolumeReport() throws Exception { redirectStream(); final DFSAdmin dfsAdmin = new DFSAdmin(conf); for (int i = 0; i < cluster.getDataNodes().size(); i++) { resetStream(); final DataNode dn = cluster.getDataNodes().get(i); final String addr = String.format("%s:%d", dn.getXferAddress() .getHostString(), dn.getIpcPort()); final int ret = ToolRunner.run(dfsAdmin, new String[] { "-getVolumeReport", addr }); assertEquals(0, ret); final List<String> outs = Lists.newArrayList(); scanIntoList(out, outs); assertEquals(outs.get(0), "Active Volumes : 2"); } }