From 529525fe5dec5d9ead5aab6bd39029ea1a63762b Mon Sep 17 00:00:00 2001 From: Dhandapani Date: Thu, 7 Jul 2011 21:27:15 +0530 Subject: VolumeOptions data model change --- .../management/server/utils/ServerUtil.java | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/com.gluster.storage.management.server') diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/ServerUtil.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/ServerUtil.java index 2e78b57b..e8073765 100644 --- a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/ServerUtil.java +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/ServerUtil.java @@ -20,20 +20,17 @@ */ package com.gluster.storage.management.server.utils; -import java.io.BufferedReader; import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.net.InetAddress; -import java.net.Socket; +import java.io.ByteArrayOutputStream; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.ServletContext; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import org.springframework.beans.factory.annotation.Autowired; @@ -44,6 +41,8 @@ import com.gluster.storage.management.core.exceptions.ConnectionException; import com.gluster.storage.management.core.exceptions.GlusterRuntimeException; import com.gluster.storage.management.core.model.Server; import com.gluster.storage.management.core.model.Status; +import com.gluster.storage.management.core.model.VolumeOption; +import com.gluster.storage.management.core.model.VolumeOptions; import com.gluster.storage.management.core.response.GenericResponse; import com.gluster.storage.management.core.utils.ProcessResult; import com.gluster.storage.management.core.utils.ProcessUtil; @@ -86,7 +85,7 @@ public class ServerUtil { */ public void fetchServerDetails(Server server) { // fetch standard server details like cpu, disk, memory details - Object response = executeOnServer(true, server.getName(), "get_server_details.py --only-data-disks", Server.class); + Object response = executeOnServer(true, server.getName(), "get_server_details.py", Server.class); if (response instanceof Status) { throw new GlusterRuntimeException(((Status)response).getMessage()); } @@ -225,10 +224,13 @@ public class ServerUtil { } public static void main(String args[]) throws Exception { - ServerUtil su = new ServerUtil(); - su.setSshUtil(new SshUtil()); - // Object result = new ServerUtil().executeOnServer(true, "serverName", "ls -lrt", String.class); - // System.out.println(result); + //String diskStr = "devserver110.1.10.18.8.4.4eth000:50:56:82:00:1d1000ETHERNETyesnone10.1.12.41255.255.255.010.1.12.120.02010.52343751267.6015625ONLINEsddVMware Virtual diskUNINITIALIZEDfalsefalsepci10240sdd1UNINITIALIZEDfalsefalse10236sdaVMware Virtual diskUNINITIALIZEDfalsefalsepci102402019sda1345d880e-822a-4e46-a518-75cc48b1869fINITIALIZEDtruefalseext3/boot12511sda2UNINITIALIZEDfalsefalseswap125sda3f94a0b2a-5ebc-4c13-a618-0328af97a31eINITIALIZEDtruefalseext3/99852008sdbVMware Virtual disk97ee7ea3-d235-424c-bdda-f5b697f204a2READYtruetruepciext31.0/export/sdb1024427sdcVMware Virtual disk87679044-6395-42fb-a80d-41c3b648f248READYtruetruepciext31.0/export/sdc8192602"; + String diskStr = ""; + //diskStr = ""; + VolumeOptions disk = (VolumeOptions)new ServerUtil().unmarshal(VolumeOptions.class, diskStr, false); + System.out.println(disk.size()); + for(VolumeOption option : disk.getOptions()) { + System.out.println(option.toString()); + } } - } -- cgit