|
|
|
@ -15,7 +15,7 @@ import com.platform.glusterfs.ClusterInfo;
|
|
|
|
|
import com.platform.glusterfs.GetTreeData;
|
|
|
|
|
import com.platform.glusterfs.VolumeInfo;
|
|
|
|
|
|
|
|
|
|
public class ThreadVolume extends Thread implements Runnable{
|
|
|
|
|
public class ThreadVolume extends Thread {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 挂载点路径 -- 暂时无用的
|
|
|
|
@ -31,7 +31,11 @@ public class ThreadVolume extends Thread implements Runnable{
|
|
|
|
|
// TODO Auto-generated constructor stub
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ThreadVolume(String path) {
|
|
|
|
|
public ThreadVolume(String name) {
|
|
|
|
|
setName(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ThreadVolume(String name, String path) {
|
|
|
|
|
if (null != path && !"".equals(path.trim())) {
|
|
|
|
|
ThreadVolume.pointPath = path;
|
|
|
|
|
}
|
|
|
|
@ -44,6 +48,27 @@ public class ThreadVolume extends Thread implements Runnable{
|
|
|
|
|
public void run() {
|
|
|
|
|
super.run();
|
|
|
|
|
while (true) {
|
|
|
|
|
try {
|
|
|
|
|
getVolumeMsg();
|
|
|
|
|
Thread.sleep(Constant.get_volume_sleep_time);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
new CustomException(
|
|
|
|
|
Custom4exception.threadVolume_Thread_Except, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String getPointPath() {
|
|
|
|
|
return pointPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void setPointPath(String pointPath) {
|
|
|
|
|
ThreadVolume.pointPath = pointPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void getVolumeMsg() {
|
|
|
|
|
List<FolderNode> folderlist = new ArrayList<FolderNode>();
|
|
|
|
|
List<VolumeEntity> volumeList = new ArrayList<VolumeEntity>();
|
|
|
|
|
// brick状态 map集合
|
|
|
|
@ -56,21 +81,33 @@ public class ThreadVolume extends Thread implements Runnable{
|
|
|
|
|
try {
|
|
|
|
|
VolumeEntity volume = new VolumeEntity();
|
|
|
|
|
volume.setName(volumeName);
|
|
|
|
|
List<String> path = volumeInfo.getVolumeMountPoint(volumeName);
|
|
|
|
|
List<String> path = volumeInfo
|
|
|
|
|
.getVolumeMountPoint(volumeName);
|
|
|
|
|
// 默认加载第一个路径
|
|
|
|
|
if (null != path && path.size() > 0) {
|
|
|
|
|
volume.setPath(path.get(0));
|
|
|
|
|
}
|
|
|
|
|
volume.setAllSize(volumeInfo.getVolumeAvailableSize(volumeName)+volumeInfo.getVolumeUseSize(volumeName));
|
|
|
|
|
volume.setStatus(volumeInfo.getVolumeStatus(volumeName));
|
|
|
|
|
volume.setAllSize(volumeInfo
|
|
|
|
|
.getVolumeAvailableSize(volumeName)
|
|
|
|
|
+ volumeInfo.getVolumeUseSize(volumeName));
|
|
|
|
|
// 状态Started,Stopped,Created
|
|
|
|
|
String status = volumeInfo.getVolumeStatus(volumeName);
|
|
|
|
|
if ("Started".equals(status)) {
|
|
|
|
|
volume.setStatus(true);
|
|
|
|
|
} else {
|
|
|
|
|
volume.setStatus(false);
|
|
|
|
|
}
|
|
|
|
|
volume.setUsedSize(volumeInfo.getVolumeUseSize(volumeName));
|
|
|
|
|
volume.setType(volumeInfo.getVolumeType(volumeName));
|
|
|
|
|
// TODO 查询brick--
|
|
|
|
|
// 返回 ip:path
|
|
|
|
|
List<String> brickStrs = volumeInfo.getVolumeBricks(volumeName);
|
|
|
|
|
List<String> brickStrs = volumeInfo
|
|
|
|
|
.getVolumeBricks(volumeName);
|
|
|
|
|
// brick已用大小:
|
|
|
|
|
Map<String, Double> usedSize = volumeInfo.getVolumebricksDataSize(volumeName);
|
|
|
|
|
Map<String, Double> availableSize = volumeInfo.getVolumebricksAvailableSize(volumeName);
|
|
|
|
|
Map<String, Double> usedSize = volumeInfo
|
|
|
|
|
.getVolumebricksDataSize(volumeName);
|
|
|
|
|
Map<String, Double> availableSize = volumeInfo
|
|
|
|
|
.getVolumebricksAvailableSize(volumeName);
|
|
|
|
|
|
|
|
|
|
List<Brick> brickList = new ArrayList<Brick>();
|
|
|
|
|
for (String brickIpPath : brickStrs) {
|
|
|
|
@ -80,12 +117,12 @@ public class ThreadVolume extends Thread implements Runnable{
|
|
|
|
|
String brickpath = ipAndpath[1];
|
|
|
|
|
// iP , path ,
|
|
|
|
|
b.setIp(brickip);
|
|
|
|
|
if(brickStatusMap==null || brickStatusMap.size()==0){
|
|
|
|
|
if (brickStatusMap == null
|
|
|
|
|
|| brickStatusMap.size() == 0) {
|
|
|
|
|
b.setStatus(false);
|
|
|
|
|
} else if (brickStatusMap.containsKey(brickip)) {
|
|
|
|
|
b.setStatus(true);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
b.setStatus(false);
|
|
|
|
|
}
|
|
|
|
|
b.setPath(brickpath);
|
|
|
|
@ -95,7 +132,6 @@ public class ThreadVolume extends Thread implements Runnable{
|
|
|
|
|
}
|
|
|
|
|
volume.setBrick(brickList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 默认加载第一个路径
|
|
|
|
|
if (null != path && path.size() > 0) {
|
|
|
|
|
// 装入 folder:
|
|
|
|
@ -105,29 +141,14 @@ public class ThreadVolume extends Thread implements Runnable{
|
|
|
|
|
}
|
|
|
|
|
volumeList.add(volume);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
new CustomException(Custom4exception.threadVolume_class_Except,e);
|
|
|
|
|
new CustomException(
|
|
|
|
|
Custom4exception.threadVolume_class_Except, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// TODO 更新folder 目录
|
|
|
|
|
CacheTreeData.setFolders(folderlist);
|
|
|
|
|
CacheTreeData.setVolumeList(volumeList);
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(Constant.get_volume_sleep_time);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
new CustomException(Custom4exception.threadVolume_Thread_Except,e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String getPointPath() {
|
|
|
|
|
return pointPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void setPointPath(String pointPath) {
|
|
|
|
|
ThreadVolume.pointPath = pointPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|