合并,解决冲突

glusterfs-api
chenlw 9 years ago
commit 355b6e47a4

@ -26,6 +26,7 @@ public class Brick {
/** volume已使用大小 */ /** volume已使用大小 */
private double usedSize; private double usedSize;
/** ip */ /** ip */
private String ip; private String ip;
@ -88,4 +89,5 @@ public class Brick {
this.path = path; this.path = path;
} }
} }

@ -1,4 +1,3 @@
package com.platform.glusterfs; package com.platform.glusterfs;
import java.util.ArrayList; import java.util.ArrayList;
@ -6,10 +5,10 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.junit.Test; import org.junit.Test;
import com.platform.entities.FolderNode; import com.platform.entities.FolderNode;
import com.platform.utils.Constant; import com.platform.utils.Constant;
import com.platform.utils.FileOperateHelper; import com.platform.utils.FileOperateHelper;
import com.platform.utils.GanymedSSH;
/** /**
* <> GFS * <> GFS
@ -58,7 +57,6 @@ public class GetTreeData {
return fileNode; return fileNode;
} }
/** /**
* <> * <>
* <> * <>

@ -114,6 +114,9 @@ public class SetVolume {
return -2; return -2;
} }
log.info("stop "+volumeName+" successed!"); log.info("stop "+volumeName+" successed!");
if (null == mountPoints) {
return -2;
}
for(String mountPoint:mountPoints){ for(String mountPoint:mountPoints){
if (mountPoint != null) { if (mountPoint != null) {
String command = "umount -l " + mountPoint; String command = "umount -l " + mountPoint;

@ -129,30 +129,40 @@ public class VolumeInfo {
String str[] = line.split(":"); String str[] = line.split(":");
volStatus = str[1].replaceAll(" ", ""); volStatus = str[1].replaceAll(" ", "");
} }
return volStatus; return volStatus;
} }
public Double getVolumeAllSize(String volumeName) { public Double getVolumeAllSize(String volumeName) {
log.info("get volume allSize"); log.info("get volume allSize");
Double allSize = null; Double allSize = null;
/*
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, * ======= // waiting for testing... public Double
Constant.rootPasswd, Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $2}'"); * getVolumeAllSize(String volumeName) { log.info("get volume allSize");
* Double allSize = null;
*
* >>>>>>> origin/AlexKie String command = "echo \"" +
* Constant.rootPasswd + "\" |sudo -S df -h|grep " + volumeName +
* "|awk '{print $2}'"; RunCommand runCommand = new RunCommand();
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
* HEAD
*/
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $2}'");
// System.out.println(reStrings); // System.out.println(reStrings);
if (reStrings == null) { if(reStrings==null){
log.error("1801 get result is null"); log.error("1801 get result is null");
return null; return null;
} }
if (reStrings.size() == 0) { if(reStrings.size()==0){
log.error("1802 get result is nothing"); log.error("1802 get result is nothing");
return null; return null;
} }
/* char flag = reStrings.get(0).trim().toCharArray()[0];
* char flag = reStrings.get(0).trim().toCharArray()[0]; if (flag < 48 if (flag < 48 || flag > 57) {
* || flag > 57) { log.error("1803 get result string wrong"); return log.error("1803 get result string wrong");
* null; } return null;
*/ }
for (Iterator it = reStrings.iterator(); it.hasNext();) { for (Iterator it = reStrings.iterator(); it.hasNext();) {
String line = (String) it.next(); String line = (String) it.next();
String str[] = line.split("[^0-9]"); String str[] = line.split("[^0-9]");
@ -166,7 +176,6 @@ public class VolumeInfo {
log.info("get volume used size"); log.info("get volume used size");
Double usedSize = null; Double usedSize = null;
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
Constant.rootPasswd, Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $3}'"); Constant.rootPasswd, Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $3}'");
// System.out.println(reStrings); // System.out.println(reStrings);

@ -29,4 +29,5 @@ public class Constant {
* volume 线 * volume 线
*/ */
public final static int update_dataInfo_sleep_time = 3000; public final static int update_dataInfo_sleep_time = 3000;
} }

@ -62,7 +62,7 @@ public class GanymedSSH {
Session sess = null; Session sess = null;
try { try {
conn = getOpenedConnection(host, username, password, port);
sess = conn.openSession(); sess = conn.openSession();
// 执锟斤拷cmd // 执锟斤拷cmd
sess.execCommand(cmd); sess.execCommand(cmd);

Loading…
Cancel
Save