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