HDDS-114. Ozone Datanode mbean registration fails for StorageLocation.
Contributed by Elek, Marton.
This commit is contained in:
parent
30284d020d
commit
24169062e5
|
@ -23,6 +23,8 @@ import org.apache.hadoop.hdds.protocol.proto.
|
||||||
StorageContainerDatanodeProtocolProtos.StorageReportProto;
|
StorageContainerDatanodeProtocolProtos.StorageReportProto;
|
||||||
import org.apache.hadoop.hdds.protocol.proto.
|
import org.apache.hadoop.hdds.protocol.proto.
|
||||||
StorageContainerDatanodeProtocolProtos.StorageTypeProto;
|
StorageContainerDatanodeProtocolProtos.StorageTypeProto;
|
||||||
|
import org.apache.hadoop.ozone.container.common.interfaces
|
||||||
|
.StorageLocationReportMXBean;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -30,7 +32,8 @@ import java.io.IOException;
|
||||||
* Storage location stats of datanodes that provide back store for containers.
|
* 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 String id;
|
||||||
private final boolean failed;
|
private final boolean failed;
|
||||||
|
@ -76,6 +79,11 @@ public class StorageLocationReport {
|
||||||
return storageLocation;
|
return storageLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getStorageTypeName() {
|
||||||
|
return storageType.name();
|
||||||
|
}
|
||||||
|
|
||||||
public StorageType getStorageType() {
|
public StorageType getStorageType() {
|
||||||
return storageType;
|
return storageType;
|
||||||
}
|
}
|
||||||
|
@ -204,76 +212,76 @@ public class StorageLocationReport {
|
||||||
/**
|
/**
|
||||||
* Sets the storageId.
|
* Sets the storageId.
|
||||||
*
|
*
|
||||||
* @param id storageId
|
* @param idValue storageId
|
||||||
* @return StorageLocationReport.Builder
|
* @return StorageLocationReport.Builder
|
||||||
*/
|
*/
|
||||||
public Builder setId(String id) {
|
public Builder setId(String idValue) {
|
||||||
this.id = id;
|
this.id = idValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the volume failed or not.
|
* Sets whether the volume failed or not.
|
||||||
*
|
*
|
||||||
* @param failed whether volume failed or not
|
* @param failedValue whether volume failed or not
|
||||||
* @return StorageLocationReport.Builder
|
* @return StorageLocationReport.Builder
|
||||||
*/
|
*/
|
||||||
public Builder setFailed(boolean failed) {
|
public Builder setFailed(boolean failedValue) {
|
||||||
this.failed = failed;
|
this.failed = failedValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the capacity of volume.
|
* Sets the capacity of volume.
|
||||||
*
|
*
|
||||||
* @param capacity capacity
|
* @param capacityValue capacity
|
||||||
* @return StorageLocationReport.Builder
|
* @return StorageLocationReport.Builder
|
||||||
*/
|
*/
|
||||||
public Builder setCapacity(long capacity) {
|
public Builder setCapacity(long capacityValue) {
|
||||||
this.capacity = capacity;
|
this.capacity = capacityValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Sets the scmUsed Value.
|
* Sets the scmUsed Value.
|
||||||
*
|
*
|
||||||
* @param scmUsed storage space used by scm
|
* @param scmUsedValue storage space used by scm
|
||||||
* @return StorageLocationReport.Builder
|
* @return StorageLocationReport.Builder
|
||||||
*/
|
*/
|
||||||
public Builder setScmUsed(long scmUsed) {
|
public Builder setScmUsed(long scmUsedValue) {
|
||||||
this.scmUsed = scmUsed;
|
this.scmUsed = scmUsedValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the remaining free space value.
|
* Sets the remaining free space value.
|
||||||
*
|
*
|
||||||
* @param remaining remaining free space
|
* @param remainingValue remaining free space
|
||||||
* @return StorageLocationReport.Builder
|
* @return StorageLocationReport.Builder
|
||||||
*/
|
*/
|
||||||
public Builder setRemaining(long remaining) {
|
public Builder setRemaining(long remainingValue) {
|
||||||
this.remaining = remaining;
|
this.remaining = remainingValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the storageType.
|
* Sets the storageType.
|
||||||
*
|
*
|
||||||
* @param storageType type of the storage used
|
* @param storageTypeValue type of the storage used
|
||||||
* @return StorageLocationReport.Builder
|
* @return StorageLocationReport.Builder
|
||||||
*/
|
*/
|
||||||
public Builder setStorageType(StorageType storageType) {
|
public Builder setStorageType(StorageType storageTypeValue) {
|
||||||
this.storageType = storageType;
|
this.storageType = storageTypeValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the storageLocation.
|
* Sets the storageLocation.
|
||||||
*
|
*
|
||||||
* @param storageLocation location of the volume
|
* @param storageLocationValue location of the volume
|
||||||
* @return StorageLocationReport.Builder
|
* @return StorageLocationReport.Builder
|
||||||
*/
|
*/
|
||||||
public Builder setStorageLocation(String storageLocation) {
|
public Builder setStorageLocation(String storageLocationValue) {
|
||||||
this.storageLocation = storageLocation;
|
this.storageLocation = storageLocationValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.ozone.container.common.interfaces;
|
package org.apache.hadoop.ozone.container.common.interfaces;
|
||||||
|
|
||||||
import org.apache.hadoop.ozone.container.common.impl.StorageLocationReport;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,6 +29,6 @@ public interface ContainerLocationManagerMXBean {
|
||||||
*
|
*
|
||||||
* @return storage location usage report.
|
* @return storage location usage report.
|
||||||
*/
|
*/
|
||||||
StorageLocationReport[] getLocationReport() throws IOException;
|
StorageLocationReportMXBean[] getLocationReport() throws IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue