Commit 19fcf137 authored by lichenchong's avatar lichenchong
Browse files

1. Sync protocol buffer definition from kinetic-protocol repository. Now

the version is 2.0.2, add Limits in get log API for admin client.
2. Delete simulator.build.info, move the properties to simulator
configuration, the fields of simulator/protocol version and hash code
will be gotten from simulator configuration.
parent e012f899
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -5,8 +5,8 @@ BASE_DIR=`cd "$BASE_DIR"; pwd`

PROTO_REPO_URL=https://github.com/Seagate/Kinetic-Protocol.git
PROTO_FILE=$BASE_DIR/kinetic-common/src/main/java/com/seagate/kinetic/proto/kinetic.proto
CLONE_DIR=$BASE_DIR/bin/Kinetic-ProtocoL
PROTO_COMMIT_HASH=bdfe223648ca13df2db0dabe328980025b8278e4
CLONE_DIR=$BASE_DIR/bin/Kinetic-Protocol
PROTO_RELEASE_VERSION=2.0.2

function syncFromProtoRepo(){
    if [ -d "$CLONE_DIR" ]; then
@@ -14,10 +14,10 @@ function syncFromProtoRepo(){
    fi

    if [ $# -eq 0 ]; then
        echo "Clone protocol file from github, the commit hash is: $PROTO_COMMIT_HASH"
        echo "Clone protocol file from github, the proto release version is: $PROTO_RELEASE_VERSION"
        git clone $PROTO_REPO_URL $CLONE_DIR
        cd $CLONE_DIR
        git checkout $PROTO_COMMIT_HASH
        git checkout $PROTO_RELEASE_VERSION
    fi

    cp $CLONE_DIR/kinetic.proto $PROTO_FILE
+13 −8
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ public class KineticAdminCLI {
    private static final String CONFIGURATION = "configuration";
    private static final String MESSAGES = "message";
    private static final String STATISTICS = "statistic";
    private static final String LIMITS = "limits";
    private static final int DEFAULT_SSL_PORT = 8443;
    private static final String DEFAULT_HOST = "localhost";
    private static final long CLUSTERVERSION = 0;
@@ -193,6 +194,7 @@ public class KineticAdminCLI {
            getLog.addType(Type.CONFIGURATION);
            getLog.addType(Type.MESSAGES);
            getLog.addType(Type.STATISTICS);
            getLog.addType(Type.LIMITS);

        } else if (type.equalsIgnoreCase(UTILIZATION)) {
            getLog.addType(Type.UTILIZATIONS);
@@ -206,9 +208,11 @@ public class KineticAdminCLI {
            getLog.addType(Type.MESSAGES);
        } else if (type.equalsIgnoreCase(STATISTICS)) {
            getLog.addType(Type.STATISTICS);
        } else if (type.equalsIgnoreCase(LIMITS)) {
            getLog.addType(Type.LIMITS);
        }else {
            throw new IllegalArgumentException(
                    "Type should be utilization, capacity, temperature, configuration, message, statistic or all");
                    "Type should be utilization, capacity, temperature, configuration, message, statistic, limits or all");
        }
        return kineticClient.request(km);
    }
@@ -282,7 +286,7 @@ public class KineticAdminCLI {
        sb.append("kineticAdmin -h|-help\n");
        sb.append("kineticAdmin -setup [-host <ip|hostname>] [-tlsport <tlsport>] [-clversion <clusterversion>] [-pin <pin>] [-newclversion <newclusterversion>] [-setpin <setpin>] [-erase <true|false>]\n");
        sb.append("kineticAdmin -security <file> [-host <ip|hostname>] [-tlsport <tlsport>] [-clversion <clusterversion>]\n");
        sb.append("kineticAdmin -getlog [-host <ip|hostname>] [-tlsport <tlsport>] [-clversion <clusterversion>] [-type <utilization|temperature|capacity|configuration|message|statistic|all>]\n");
        sb.append("kineticAdmin -getlog [-host <ip|hostname>] [-tlsport <tlsport>] [-clversion <clusterversion>] [-type <utilization|temperature|capacity|configuration|message|statistic|limits|all>]\n");
        sb.append("kineticAdmin -firmware <file> [-host <ip|hostname>] [-tlsport <tlsport>] [-clversion <clusterversion>] [-pin <pin>]");
        System.out.println(sb.toString());
    }
@@ -518,9 +522,10 @@ public class KineticAdminCLI {
                && !logType.equalsIgnoreCase(CONFIGURATION)
                && !logType.equalsIgnoreCase(MESSAGES)
                && !logType.equalsIgnoreCase(STATISTICS)
                && !logType.equalsIgnoreCase(LIMITS)
                && !logType.equalsIgnoreCase(ALL)) {
            throw new IllegalArgumentException(
                    "Type should be utilization, capacity, temperature, configuration, message, statistic or all");
                    "Type should be utilization, capacity, temperature, configuration, message, statistic, limits or all");
        }
    }

+5 −0
Original line number Diff line number Diff line
@@ -375,6 +375,7 @@ public class DefaultAdminClient implements KineticAdminClient {
        getLog.addType(Type.STATISTICS);
        getLog.addType(Type.TEMPERATURES);
        getLog.addType(Type.UTILIZATIONS);
        getLog.addType(Type.LIMITS);

        KineticMessage kmresp = getLog(km);

@@ -441,6 +442,10 @@ public class DefaultAdminClient implements KineticAdminClient {
                getLog.addType(Type.STATISTICS);
                break;
                
            case LIMITS:
                getLog.addType(Type.LIMITS);
                break;

            default:
                ;
            }
+59 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import kinetic.admin.Interface;
import kinetic.admin.KineticAdminClient;
import kinetic.admin.KineticLog;
import kinetic.admin.KineticLogType;
import kinetic.admin.Limits;
import kinetic.admin.MessageType;
import kinetic.admin.Statistics;
import kinetic.admin.Temperature;
@@ -196,6 +197,9 @@ public class DefaultKineticLog implements KineticLog {
            case MESSAGES:
                types[i] = KineticLogType.MESSAGES;
                break;
            case LIMITS:
                types[i] = KineticLogType.LIMITS;
                break;
            default:
                ;

@@ -401,4 +405,59 @@ public class DefaultKineticLog implements KineticLog {

        return statisticOfList;
    }

    @Override
    public Limits getLimits() throws KineticException {
        validate(response);

        com.seagate.kinetic.proto.Kinetic.Message.GetLog.Limits limits = response
                .getCommand().getBody().getGetLog().getLimits();

        if (null == response.getCommand().getBody().getGetLog().getLimits()) {
            throw new KineticException(
                    "Response message error: limits is null.");
        }

        Limits LimitsInfo = new Limits();

        if (limits.hasMaxKeySize()) {
            LimitsInfo.setMaxKeySize(limits.getMaxKeySize());
        }

        if (limits.hasMaxValueSize()) {
            LimitsInfo.setMaxValueSize(limits.getMaxValueSize());
        }

        if (limits.hasMaxVersionSize()) {
            LimitsInfo.setMaxVersionSize(limits.getMaxVersionSize());
        }

        if (limits.hasMaxTagSize()) {
            LimitsInfo.setMaxTagSize(limits.getMaxTagSize());
        }

        if (limits.hasMaxConnections()) {
            LimitsInfo.setMaxConnections(limits.getMaxConnections());
        }

        if (limits.hasMaxOutstandingReadRequests()) {
            LimitsInfo.setMaxOutstandingReadRequests(limits
                    .getMaxOutstandingReadRequests());
        }

        if (limits.hasMaxOutstandingWriteRequests()) {
            LimitsInfo.setMaxOutstandingWriteRequests(limits
                    .getMaxOutstandingWriteRequests());
        }

        if (limits.hasMaxMessageSize()) {
            LimitsInfo.setMaxMessageSize(limits.getMaxMessageSize());
        }

        if (limits.hasMaxKeyRangeCount()) {
            LimitsInfo.setMaxKeyRangeCount(limits.getMaxKeyRangeCount());
        }

        return LimitsInfo;
    }
}
+14 −1
Original line number Diff line number Diff line
@@ -115,4 +115,17 @@ public interface KineticLog {
	 */
	public KineticLogType[] getContainedLogTypes() throws KineticException;
	
	   /**
     * 
     * Get the limits information of the drive
     * <p>
     * 
     * @return the limits information from the drive.
     * 
     * @throws KineticException
     *             if any internal error occurred.
     * @see Limits
     */
    public Limits getLimits() throws KineticException;

}
Loading