Search in sources :

Example 1 with StorageCommand

use of alluxio.cli.fsadmin.doctor.StorageCommand in project alluxio by Alluxio.

the class DoctorCommand method run.

@Override
public int run(CommandLine cl) throws IOException {
    String[] args = cl.getArgs();
    if (cl.hasOption(HELP_OPTION_NAME)) {
        System.out.println(getUsage());
        System.out.println(getDescription());
        return 0;
    }
    FileSystemAdminShellUtils.checkMasterClientService(mConf);
    // Get the doctor category
    Command command = Command.ALL;
    if (args.length == 1) {
        switch(args[0]) {
            case "configuration":
                command = Command.CONFIGURATION;
                break;
            case "storage":
                command = Command.STORAGE;
                break;
            default:
                System.out.println(getUsage());
                System.out.println(getDescription());
                throw new InvalidArgumentException("doctor category is invalid.");
        }
    }
    if (command.equals(Command.CONFIGURATION) || command.equals(Command.ALL)) {
        ConfigurationCommand configurationCommand = new ConfigurationCommand(mMetaClient, System.out);
        configurationCommand.run();
    }
    if (command.equals(Command.STORAGE) || command.equals(Command.ALL)) {
        StorageCommand storageCommand = new StorageCommand(mBlockClient, System.out);
        storageCommand.run();
    }
    return 0;
}
Also used : InvalidArgumentException(alluxio.exception.status.InvalidArgumentException) ConfigurationCommand(alluxio.cli.fsadmin.doctor.ConfigurationCommand) ConfigurationCommand(alluxio.cli.fsadmin.doctor.ConfigurationCommand) StorageCommand(alluxio.cli.fsadmin.doctor.StorageCommand) StorageCommand(alluxio.cli.fsadmin.doctor.StorageCommand)

Aggregations

ConfigurationCommand (alluxio.cli.fsadmin.doctor.ConfigurationCommand)1 StorageCommand (alluxio.cli.fsadmin.doctor.StorageCommand)1 InvalidArgumentException (alluxio.exception.status.InvalidArgumentException)1