Search in sources :

Example 1 with MQResponse

use of com.pspace.ifs.ksan.mq.MQResponse in project ksan by infinistor.

the class DiskMonitor method startStopDisk.

private MQResponse startStopDisk(DISKPOOL dskPool, JsonOutput jo) {
    MQResponse res;
    if (jo.status.equalsIgnoreCase("Good")) {
        System.out.println("Start Disk>>" + jo);
        dskPool.setDiskStatus(jo.serverid, jo.id, DiskStatus.GOOD);
    } else if (jo.status.equalsIgnoreCase("Stop")) {
        System.out.println("Stop Disk>>" + jo);
        dskPool.setDiskStatus(jo.serverid, jo.id, DiskStatus.STOPPED);
    }
    res = new MQResponse(MQResponseType.SUCCESS, "", "", 0);
    obmCache.displayDiskPoolList();
    return res;
}
Also used : MQResponse(com.pspace.ifs.ksan.mq.MQResponse)

Example 2 with MQResponse

use of com.pspace.ifs.ksan.mq.MQResponse in project ksan by infinistor.

the class DiskMonitor method addRemoveDiskPool.

private MQResponse addRemoveDiskPool(String action, JsonOutput jo, String msg) {
    MQResponse res;
    // System.out.println("action >>" + action);
    if (action.equalsIgnoreCase(KEYS.ADD.label)) {
        DISKPOOL dskPool1 = new DISKPOOL(jo.id, jo.diskPoolName);
        /*JSONObject jsonObject;
            JSONObject jsonDskObject;
            JSONArray jsonDisk;
            try {
                jsonObject = (JSONObject)parser.parse(msg);
                jsonDisk = (JSONArray)jsonObject.get("Disks");
                for(int idx=0; idx < jsonDisk.size(); idx++){
                    jsonDskObject = (JSONObject)jsonDisk.get(idx);
                    SERVER srv = new SERVER();
                }
            } catch (ParseException ex) {
                Logger.getLogger(DiskMonitor.class.getName()).log(Level.SEVERE, null, ex);
            }*/
        this.obmCache.setDiskPoolInCache(dskPool1);
        this.obmCache.displayDiskPoolList();
    } else if (action.equalsIgnoreCase(KEYS.REMOVE.label)) {
        if (!(jo.id.isEmpty() && jo.diskPoolName.isEmpty()))
            this.obmCache.removeDiskPoolFromCache(jo.id);
        this.obmCache.displayDiskPoolList();
    }
    res = new MQResponse(MQResponseType.SUCCESS, "", "", 0);
    return res;
}
Also used : MQResponse(com.pspace.ifs.ksan.mq.MQResponse)

Example 3 with MQResponse

use of com.pspace.ifs.ksan.mq.MQResponse in project ksan by infinistor.

the class DiskMonitor method updateDiskPool.

private MQResponse updateDiskPool(DISKPOOL dskPool, JsonOutput jo, String msg) {
    MQResponse res;
    JSONObject dsk;
    // DISKPOOL dskPool1 = obmCache.getDiskPoolFromCache(jo.id);
    JSONArray dskArray = decodeJsonArray(msg, "Disks");
    Iterator it = dskArray.iterator();
    while (it.hasNext()) {
        dsk = (JSONObject) it.next();
        String diskId = (String) dsk.get("Id");
        String serverId = (String) dsk.get("ServerId");
        String dskPoolId = (String) dsk.get("DiskPoolId");
        String mpath = (String) dsk.get("Path");
        // dskPool1.
        System.out.format("DISK to add: { diskid : %s serverId : %s dskPoolId : %s mpath : %s}", diskId, serverId, dskPoolId, mpath);
    }
    res = new MQResponse(MQResponseType.SUCCESS, "", "", 0);
    return res;
}
Also used : JSONObject(org.json.simple.JSONObject) JSONArray(org.json.simple.JSONArray) Iterator(java.util.Iterator) MQResponse(com.pspace.ifs.ksan.mq.MQResponse)

Example 4 with MQResponse

use of com.pspace.ifs.ksan.mq.MQResponse in project ksan by infinistor.

the class DiskMonitor method addRemoveDisk.

private MQResponse addRemoveDisk(DISKPOOL dskPool, JsonOutput jo) {
    MQResponse res;
    try {
        if (jo.action.equalsIgnoreCase(KEYS.ADD.label)) {
            dskPool.getServerById(jo.serverid).addDisk(jo.mpath, jo.diskid, 0, DiskStatus.STOPPED);
        } else if (jo.action.equalsIgnoreCase(KEYS.REMOVE.label)) {
            dskPool.getServerById(jo.serverid).removeDisk(jo.mpath, jo.diskid);
        }
    } catch (ResourceNotFoundException ex) {
        Logger.getLogger(DiskMonitor.class.getName()).log(Level.SEVERE, null, ex);
    }
    res = new MQResponse(MQResponseType.SUCCESS, "", "", 0);
    obmCache.displayDiskPoolList();
    return res;
}
Also used : MQResponse(com.pspace.ifs.ksan.mq.MQResponse) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)

Example 5 with MQResponse

use of com.pspace.ifs.ksan.mq.MQResponse in project ksan by infinistor.

the class DiskMonitor method volumeMGNT.

private MQResponse volumeMGNT(DISKPOOL dskPool, JsonOutput jo, String msg) {
    MQResponse res;
    System.out.println("[volumeMNT : 345] " + msg);
    res = new MQResponse(MQResponseType.SUCCESS, "", "", 0);
    return res;
}
Also used : MQResponse(com.pspace.ifs.ksan.mq.MQResponse)

Aggregations

MQResponse (com.pspace.ifs.ksan.mq.MQResponse)8 ResourceNotFoundException (com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)2 Iterator (java.util.Iterator)1 JSONArray (org.json.simple.JSONArray)1 JSONObject (org.json.simple.JSONObject)1