HDDS-114. Ozone Datanode mbean registration fails for StorageLocation.

Contributed by Elek, Marton.
This commit is contained in:
Anu Engineer 2018-05-29 13:23:58 -07:00
parent 30284d020d
commit 24169062e5
3 changed files with 71 additions and 25 deletions

View File

@ -23,6 +23,8 @@ import org.apache.hadoop.hdds.protocol.proto.
StorageContainerDatanodeProtocolProtos.StorageReportProto;
import org.apache.hadoop.hdds.protocol.proto.
StorageContainerDatanodeProtocolProtos.StorageTypeProto;
import org.apache.hadoop.ozone.container.common.interfaces
.StorageLocationReportMXBean;
import java.io.IOException;
@ -30,7 +32,8 @@ import java.io.IOException;
* Storage location stats of datanodes that provide back store for containers.
*
*/
public class StorageLocationReport {
public final class StorageLocationReport implements
StorageLocationReportMXBean {
private final String id;
private final boolean failed;
@ -76,6 +79,11 @@ public class StorageLocationReport {
return storageLocation;
}
@Override
public String getStorageTypeName() {
return storageType.name();
}
public StorageType getStorageType() {
return storageType;
}
@ -204,76 +212,76 @@ public class StorageLocationReport {
/**
* Sets the storageId.
*
* @param id storageId
* @param idValue storageId
* @return StorageLocationReport.Builder
*/
public Builder setId(String id) {
this.id = id;
public Builder setId(String idValue) {
this.id = idValue;
return this;
}
/**
* Sets whether the volume failed or not.
*
* @param failed whether volume failed or not
* @param failedValue whether volume failed or not
* @return StorageLocationReport.Builder
*/
public Builder setFailed(boolean failed) {
this.failed = failed;
public Builder setFailed(boolean failedValue) {
this.failed = failedValue;
return this;
}
/**
* Sets the capacity of volume.
*
* @param capacity capacity
* @param capacityValue capacity
* @return StorageLocationReport.Builder
*/
public Builder setCapacity(long capacity) {
this.capacity = capacity;
public Builder setCapacity(long capacityValue) {
this.capacity = capacityValue;
return this;
}
/**
* Sets the scmUsed Value.
*
* @param scmUsed storage space used by scm
* @param scmUsedValue storage space used by scm
* @return StorageLocationReport.Builder
*/
public Builder setScmUsed(long scmUsed) {
this.scmUsed = scmUsed;
public Builder setScmUsed(long scmUsedValue) {
this.scmUsed = scmUsedValue;
return this;
}
/**
* Sets the remaining free space value.
*
* @param remaining remaining free space
* @param remainingValue remaining free space
* @return StorageLocationReport.Builder
*/
public Builder setRemaining(long remaining) {
this.remaining = remaining;
public Builder setRemaining(long remainingValue) {
this.remaining = remainingValue;
return this;
}
/**
* Sets the storageType.
*
* @param storageType type of the storage used
* @param storageTypeValue type of the storage used
* @return StorageLocationReport.Builder
*/
public Builder setStorageType(StorageType storageType) {
this.storageType = storageType;
public Builder setStorageType(StorageType storageTypeValue) {
this.storageType = storageTypeValue;
return this;
}
/**
* Sets the storageLocation.
*
* @param storageLocation location of the volume
* @param storageLocationValue location of the volume
* @return StorageLocationReport.Builder
*/
public Builder setStorageLocation(String storageLocation) {
this.storageLocation = storageLocation;
public Builder setStorageLocation(String storageLocationValue) {
this.storageLocation = storageLocationValue;
return this;
}

View File

@ -17,8 +17,6 @@
*/
package org.apache.hadoop.ozone.container.common.interfaces;
import org.apache.hadoop.ozone.container.common.impl.StorageLocationReport;
import java.io.IOException;
/**
@ -31,6 +29,6 @@ public interface ContainerLocationManagerMXBean {
*
* @return storage location usage report.
*/
StorageLocationReport[] getLocationReport() throws IOException;
StorageLocationReportMXBean[] getLocationReport() throws IOException;
}

View File

@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.ozone.container.common.interfaces;
/**
* Contract to define properties available on the JMX interface.
*/
public interface StorageLocationReportMXBean {
String getId();
boolean isFailed();
long getCapacity();
long getScmUsed();
long getRemaining();
String getStorageLocation();
String getStorageTypeName();
}