Commit 2ccfa3c3 authored by chiaming2000's avatar chiaming2000
Browse files

Sync protocol buffer definition from kinetic-protocol repository.

Heartbeat monitor changes (display format) will follow shortly.
parent cf7fc25d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ PROTO_DIR=$BASE_DIR/kinetic-common/src/main/java/com/seagate/kinetic/proto/
PROTO_FILE=$BASE_DIR/kinetic-common/src/main/java/com/seagate/kinetic/proto/kinetic.proto
CLONE_DIR=$BASE_DIR/bin/Kinetic-ProtocoL
PROTO_COMPILE_DIR=$BASE_DIR/kinetic-common/src/main/java/
PROTO_COMMIT_HASH=9c6b4a180a70f8488c5d8ec8e8a6464c4ff63f84
PROTO_COMMIT_HASH=bdfe223648ca13df2db0dabe328980025b8278e4

function syncFromProtoRepo(){
    if [ -d "$CLONE_DIR" ]; then
+4 −4
Original line number Diff line number Diff line
@@ -120,12 +120,12 @@ public class DefaultKineticLog implements KineticLog {

        Capacity capacInfo = new Capacity();

        if (capacity.hasTotal()) {
            capacInfo.setTotal(capacity.getTotal());
        if (capacity.hasNominalCapacityInBytes()) {
            capacInfo.setTotal(capacity.getNominalCapacityInBytes());
        }

        if (capacity.hasRemaining()) {
            capacInfo.setRemaining(capacity.getRemaining());
        if (capacity.hasPortionFull()) {
            capacInfo.setRemaining(capacity.getPortionFull());
        }

        return capacInfo;
+3 −3
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ public class Capacity {
	private long total;

	// remaining capacity of hard disk
	private long remaining;
	private float remaining;

	public long getTotal() {
		return total;
@@ -32,11 +32,11 @@ public class Capacity {
		this.total = total;
	}

	public long getRemaining() {
	public float getRemaining() {
		return remaining;
	}

	public void setRemaining(long remaining) {
	public void setRemaining(float remaining) {
		this.remaining = remaining;
	}
}
+13 −13
Original line number Diff line number Diff line
@@ -39,9 +39,9 @@ public abstract class CapacityUtil {
    private final static Logger logger = Logger.getLogger(CapacityUtil.class
            .getName());

    private static DecimalFormat format = new DecimalFormat("########.00");
    //private static DecimalFormat format = new DecimalFormat("########.00");

    private static long MB = 1000000;
    //private static long MB = 1000000;

    public static Capacity getCapacity() {

@@ -50,14 +50,14 @@ public abstract class CapacityUtil {
        try {
            File file = new File("/");

            long total = (long)Double.parseDouble(format.format(file
                    .getTotalSpace() / MB));
            long total = file.getTotalSpace();

            long remaining = (long) Double.parseDouble(format.format(file
                    .getFreeSpace() / MB));
            float remaining = (float) file.getFreeSpace();
            
            capacity = Capacity.newBuilder().setTotal(total)
                    .setRemaining(remaining).build();
            float portionFull = (remaining/total);

            capacity = Capacity.newBuilder().setNominalCapacityInBytes(total)
                    .setPortionFull(portionFull).build();

        } catch (Exception e) {

@@ -71,16 +71,16 @@ public abstract class CapacityUtil {
}

class CapacityGenerator {
    private static final Random random = new Random();
    private static final long TB = 1024 * 1024; // Unit: MB
    //private static final Random random = new Random();
    private static final long TB = 1024 * 1024 * 1024 * 1024; // Unit: bytes

    public static Capacity generate() {
        long total = 4 * TB;
        long remaining = total * random.nextLong();
        float remaining = (float) 0.5;

        Capacity capacity = null;
        capacity = Capacity.newBuilder().setTotal(total)
                .setRemaining(remaining).build();
        capacity = Capacity.newBuilder().setNominalCapacityInBytes((total))
                .setPortionFull(remaining).build();

        return capacity;
    }
+4 −4
Original line number Diff line number Diff line
@@ -1406,7 +1406,7 @@ public class KineticAdminTest extends IntegrationTestCase {
        assertTrue(respond1.getCommand().getStatus().getCode()
                .equals(Status.StatusCode.SUCCESS));
        assertTrue(0 <= respond1.getCommand().getBody().getGetLog()
                .getCapacity().getTotal());
                .getCapacity().getNominalCapacityInBytes());
    }

    @Test
@@ -1451,7 +1451,7 @@ public class KineticAdminTest extends IntegrationTestCase {
        assertEquals("EN0", respond3.getCommand().getBody().getGetLog()
                .getUtilizationList().get(1).getName());
        assertTrue(0 <= respond3.getCommand().getBody().getGetLog()
                .getCapacity().getTotal());
                .getCapacity().getNominalCapacityInBytes());
        assertTrue(0 < respond3.getCommand().getBody().getGetLog()
                .getTemperatureList().get(0).getMaximum());
    }
@@ -1473,7 +1473,7 @@ public class KineticAdminTest extends IntegrationTestCase {
        assertTrue(respond4.getCommand().getStatus().getCode()
                .equals(Status.StatusCode.SUCCESS));
        assertTrue(0 <= respond4.getCommand().getBody().getGetLog()
                .getCapacity().getTotal());
                .getCapacity().getNominalCapacityInBytes());
        assertTrue(0 <= respond4.getCommand().getBody().getGetLog()
                .getTemperatureList().get(0).getMaximum());
        assertTrue(0 <= respond4.getCommand().getBody().getGetLog()
@@ -1531,7 +1531,7 @@ public class KineticAdminTest extends IntegrationTestCase {
        assertEquals("EN0", respond6.getCommand().getBody().getGetLog()
                .getUtilizationList().get(1).getName());
        assertTrue(0 <= respond6.getCommand().getBody().getGetLog()
                .getCapacity().getTotal());
                .getCapacity().getNominalCapacityInBytes());
    }

    /**