daily commit

glusterfs-api
lily 8 years ago
parent db144df2df
commit a7d7f55c54

@ -5,6 +5,7 @@ import java.util.List;
import org.apache.log4j.Logger;
import org.hamcrest.core.Is;
import org.junit.Test;
import com.platform.utils.Constant;
import com.platform.utils.Support;
@ -63,5 +64,10 @@ public class SetCluster {
log.info("detach failed!");
return 0;
}
@Test
public void test_probePeer(){
System.out.println(probePeer("192.168.191.23"));
}
}

@ -53,6 +53,7 @@ public class SetVolume {
command = "gluster volume create " + volumeName + " " + type + " " + count + " " + commandarg + "force";
}
// command=command+"& gluster volume start "+volumeName;
// 执行命令
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(command);
@ -77,7 +78,7 @@ public class SetVolume {
if (reStrings3.size() == 0 || reStrings.get(0).contains("GlusterFS is already mounted")) {
log.info("mount point successed!");
String addRecord = "echo \"" + volumeName + ":" + mountPoint + "\" >> " + Constant.MountRecord;
Constant.ganymedSSH.execCmdNoWaitAcquiescent(addRecord);
List<String> reStrings1=Constant.ganymedSSH.execCmdWaitAcquiescent(addRecord);
return 1;
}
}
@ -483,16 +484,16 @@ public class SetVolume {
return 1;
}
@Test
// @Test
public void test_deleteVolume(){
System.out.println(deleteVolume("lili_test1"));
System.out.println(deleteVolume("lili_test"));
}
// @Test
@Test
public void test_createVolume(){
List<String> bricksToCreate = new ArrayList<String>();
bricksToCreate.add("192.168.0.110:/lili_test1");
bricksToCreate.add("192.168.0.116:/lili_test1");
System.out.println(createVolume("lili_test1", 0, "distributed", bricksToCreate, "/home/lili_test1_point"));
bricksToCreate.add("192.168.191.22:/lili_test");
bricksToCreate.add("192.168.191.23:/lili_test");
System.out.println(createVolume("lili_test", 0, "distributed", bricksToCreate, "/home/lili_test_point"));
}
public static void main(String[] args) {
SetVolume setVolume = new SetVolume();

@ -4,6 +4,8 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.log4j.Logger;
@ -92,7 +94,7 @@ public class ShowData {
/**
* folder
* -2-1folderfolder
* -2-1folder-3folder
* @param folderPath
* @return
* @see [##]
@ -110,6 +112,12 @@ public class ShowData {
log.error(folderPath+" is not exists");
return -1;
}
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(reStrings.get(1));
if (!isNum.matches()) {
log.error(reStrings.get(0) + " is unexpect");
return -3L;
}
long size = Long.valueOf(reStrings.get(0));

@ -156,7 +156,7 @@ public class VolumeInfo {
/**
* volumeName
* volumeName-1-2 volumeName
* volumeName-1-2 -3volumeName
* @param volumeName
* @return
* @see [##]
@ -176,13 +176,19 @@ public class VolumeInfo {
log.error("1801 " + volumeName + " is not exists!");
return -1L;
}
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(reStrings.get(1));
if (!isNum.matches()) {
log.error("1803 " + reStrings.get(0) + " is unexpect");
return -3L;
}
allSize = Long.parseLong(reStrings.get(0));
return allSize;
}
/**
* volumeName
* volumeName-1-2 volumeName
* volumeName-1-2 -3,volumeName
* @param volumeName
* @return
* @see [##]
@ -207,6 +213,12 @@ public class VolumeInfo {
log.error("1902 " + volumeName + " is not exists!");
return -1L;
}
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(reStrings.get(1));
if (!isNum.matches()) {
log.error("1903 " + reStrings.get(0) + " is unexpect");
return -3L;
}
usedSize = Long.parseLong(reStrings.get(0));
return usedSize;
}

@ -6,8 +6,8 @@ import java.util.List;
public class Constant {
public static String rootUser = "root";
public static String rootPasswd = "root";
public static String hostIp = "192.168.0.116";
// public static String hostIp = "192.168.1.105";
// public static String hostIp = "192.168.0.116";
public static String hostIp = "192.168.191.22";
public static int port = 22;
public static String glusterPeerStatus = "gluster peer status";
public static String glusterVolumeInfo = "gluster volume info ";

Loading…
Cancel
Save