hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject hadoop git commit: HDFS-11725. Ozone: Revise create container CLI specification and implementation. Contributed by Weiwei Yang
Date Wed, 03 May 2017 03:22:30 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 4b0f51306 -> 6def74c6c


HDFS-11725. Ozone: Revise create container CLI specification and implementation. Contributed
by Weiwei Yang


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6def74c6
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6def74c6
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6def74c6

Branch: refs/heads/HDFS-7240
Commit: 6def74c6ca5cec9791b1fa8adccf72227dacf6f0
Parents: 4b0f513
Author: Weiwei Yang <wwei@apache.org>
Authored: Wed May 3 11:21:15 2017 +0800
Committer: Weiwei Yang <wwei@apache.org>
Committed: Wed May 3 11:21:15 2017 +0800

----------------------------------------------------------------------
 .../cli/container/CreateContainerHandler.java   | 21 ++++++++++----------
 .../org/apache/hadoop/ozone/scm/TestSCMCli.java |  5 ++---
 2 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/6def74c6/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/cli/container/CreateContainerHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/cli/container/CreateContainerHandler.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/cli/container/CreateContainerHandler.java
index 9e5cc1a..b68d872 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/cli/container/CreateContainerHandler.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/cli/container/CreateContainerHandler.java
@@ -35,7 +35,9 @@ import static org.apache.hadoop.ozone.scm.cli.SCMCLI.HELP_OP;
 public class CreateContainerHandler extends OzoneCommandHandler {
 
   public static final String CONTAINER_CREATE = "create";
-  public static final String PIPELINE_ID = "p";
+  public static final String OPT_CONTAINER_NAME = "c";
+  // TODO Support an optional -p <pipelineID> option to create
+  // container on given datanodes.
 
   public CreateContainerHandler(ScmClient scmClient) {
     super(scmClient);
@@ -46,25 +48,23 @@ public class CreateContainerHandler extends OzoneCommandHandler {
     if (!cmd.hasOption(CONTAINER_CREATE)) {
       throw new IOException("Expecting container create");
     }
-    // TODO requires pipeline id (instead of optional as in the design) for now
-    if (!cmd.hasOption(PIPELINE_ID)) {
+    if (!cmd.hasOption(OPT_CONTAINER_NAME)) {
       displayHelp();
       if (!cmd.hasOption(HELP_OP)) {
-        throw new IOException("Expecting container ID");
+        throw new IOException("Expecting container name");
       } else {
         return;
       }
     }
-    String pipelineID = cmd.getOptionValue(PIPELINE_ID);
+    String containerName = cmd.getOptionValue(OPT_CONTAINER_NAME);
 
-    logOut("Creating container : %s.", pipelineID);
-    getScmClient().createContainer(pipelineID);
+    logOut("Creating container : %s.", containerName);
+    getScmClient().createContainer(containerName);
     logOut("Container created.");
   }
 
   @Override
   public void displayHelp() {
-    // TODO : may need to change this if we decide to make -p optional later
     Options options = new Options();
     addOptions(options);
     HelpFormatter helpFormatter = new HelpFormatter();
@@ -73,7 +73,8 @@ public class CreateContainerHandler extends OzoneCommandHandler {
   }
 
   public static void addOptions(Options options) {
-    Option pipelineID = new Option(PIPELINE_ID, true, "Specify pipeline ID");
-    options.addOption(pipelineID);
+    Option containerNameOpt = new Option(OPT_CONTAINER_NAME,
+        true, "Specify container name");
+    options.addOption(containerNameOpt);
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6def74c6/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/TestSCMCli.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/TestSCMCli.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/TestSCMCli.java
index b8ebec1..ec58677 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/TestSCMCli.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/TestSCMCli.java
@@ -113,9 +113,8 @@ public class TestSCMCli {
       assertTrue(ioe.getMessage().contains(
           "Specified key does not exist. key : " + containerName));
     }
-    String[] args = {"-container", "-create", "-p", containerName};
+    String[] args = {"-container", "-create", "-c", containerName};
     assertEquals(ResultCode.SUCCESS, cli.run(args));
-    Thread.sleep(3000);
     Pipeline container = scm.getContainer(containerName);
     assertNotNull(container);
     assertEquals(containerName, container.getContainerName());
@@ -226,7 +225,7 @@ public class TestSCMCli {
     String expected2 =
         "usage: hdfs scm -container -create <option>\n" +
         "where <option> is\n" +
-        " -p <arg>   Specify pipeline ID\n";
+        " -c <arg>   Specify container name\n";
     assertEquals(expected2, testContent.toString());
     System.setOut(init);
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message