Search in sources :

Example 6 with MQResponse

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

the class DiskMonitor method updateDiskSpace.

private MQResponse updateDiskSpace(DISKPOOL dskPool, JsonOutput jo) {
    MQResponse res;
    DISK dsk;
    try {
        // System.out.println("objetc>>" + jo);
        dsk = dskPool.getDisk("", jo.diskid);
        dsk.setSpace(jo.totalSpace, jo.usedSpace, jo.reservedSpace);
        dsk.setInode(jo.totalInode, jo.usedInode);
        res = new MQResponse(MQResponseType.SUCCESS, "", "", 0);
    // obmCache.displayDiskPoolList();
    } catch (ResourceNotFoundException ex) {
        Logger.getLogger(DiskMonitor.class.getName()).log(Level.SEVERE, null, ex);
        res = new MQResponse(MQResponseType.ERROR, "disk not exist", "", 0);
    }
    return res;
}
Also used : MQResponse(com.pspace.ifs.ksan.mq.MQResponse) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)

Example 7 with MQResponse

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

the class DiskMonitor method addRemoveServer.

/*private MQResponse updateDiskSpace(DISKPOOL dskPool, JsonOutput jo) {
       MQResponse res;
       try{
           dskPool.getServerById(jo.serverid)
                  .setDiskSpace(jo.diskid, jo.fr, jo.freeInode);
           res = new MQResponse(MQResponseType.SUCCESS, "", "", 0);
       } catch(ResourceNotFoundException ex){
           System.out.println(ex);
           res = new MQResponse(MQResponseType.ERROR, -1, ex.getMessage(), 0);
       }
       return res;
    }*/
private MQResponse addRemoveServer(DISKPOOL dskPool, JsonOutput jo) {
    MQResponse res;
    if (jo.action.equalsIgnoreCase(KEYS.ADD.label)) {
        dskPool.addServer(jo.serverid, jo.IPaddr, jo.hostname, jo.rack);
    } else if (jo.action.equalsIgnoreCase(KEYS.REMOVE.label)) {
        dskPool.removeServer(jo.serverid);
    }
    res = new MQResponse(MQResponseType.SUCCESS, "", "", 0);
    return res;
}
Also used : MQResponse(com.pspace.ifs.ksan.mq.MQResponse)

Example 8 with MQResponse

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

the class DiskMonitor method updateDiskMode.

private MQResponse updateDiskMode(DISKPOOL dskPool, JsonOutput jo) {
    MQResponse res;
    if (jo.mode.equalsIgnoreCase(KEYS.RW.label)) {
        dskPool.setDiskMode(jo.serverid, jo.id, DiskMode.READWRITE);
    } else if (jo.mode.equalsIgnoreCase(KEYS.RO.label)) {
        dskPool.setDiskMode(jo.serverid, jo.id, DiskMode.READONLY);
    }
    res = new MQResponse(MQResponseType.SUCCESS, "", "", 0);
    obmCache.displayDiskPoolList();
    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