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 @@ -20,6 +20,7 @@
import java.io.IOException;
import java.util.stream.Collectors;

import org.apache.hadoop.hdds.cli.GenericParentCommand;
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
import org.apache.hadoop.hdds.scm.cli.ScmSubcommand;
Expand All @@ -31,7 +32,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Command;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Parameters;
import picocli.CommandLine.Spec;

/**
* This is the handler that process container info command.
Expand All @@ -46,6 +49,9 @@ public class InfoSubcommand extends ScmSubcommand {
private static final Logger LOG =
LoggerFactory.getLogger(InfoSubcommand.class);

@Spec
private CommandSpec spec;

@Parameters(description = "Decimal id of the container.")
private long containerID;

Expand All @@ -57,7 +63,13 @@ public void execute(ScmClient scmClient) throws IOException {

// Print container report info.
LOG.info("Container id: {}", containerID);
LOG.info("Pipeline id: {}", container.getPipeline().getId().getId());
boolean verbose = spec.root().userObject() instanceof GenericParentCommand
&& ((GenericParentCommand) spec.root().userObject()).isVerbose();
if (verbose) {
LOG.info("Pipeline Info: {}", container.getPipeline());
} else {
LOG.info("Pipeline id: {}", container.getPipeline().getId().getId());
}
LOG.info("Container State: {}", container.getContainerInfo().getState());

// Print pipeline of an existing container.
Expand Down
5 changes: 5 additions & 0 deletions hadoop-ozone/dist/src/main/smoketest/admincli/container.robot
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ List containers with explicit host
Container info
${output} = Execute ozone admin container info "${CONTAINER}"
Should contain ${output} Container id: ${CONTAINER}
Should contain ${output} Pipeline id
Should contain ${output} Datanodes

Verbose container info
${output} = Execute ozone admin --verbose container info "${CONTAINER}"
Should contain ${output} Pipeline Info

Close container
Execute ozone admin container close "${CONTAINER}"
${output} = Execute ozone admin container info "${CONTAINER}"
Expand Down