Search in sources :

Example 16 with ResourceNotFoundException

use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.

the class DiskAllocation method allocDisk.

public int allocDisk(Metadata md, String dskPoolId, int replicaCount, int algorithm) throws IOException, AllServiceOfflineException {
    DISK primaryDisk;
    DISK replicaDisk;
    DISKPOOL dskPool;
    try {
        logger.debug("disk pool id : {}", dskPoolId);
        dskPool = getDiskPool(dskPoolId);
        if (dskPool == null) {
            logger.error("there is no diskpool in the system!");
            throw new ResourceNotFoundException("there is no diskpool in the system!");
        }
        SERVER primary = this.allocPrimaryServer(algorithm, dskPool);
        primaryDisk = primary.getNextDisk();
        primaryDisk.setOSDIP(primary.getName());
        md.setPrimaryDisk(primaryDisk);
        md.setReplicaCount(replicaCount);
        if (replicaCount == 1) {
            return 0;
        }
        try {
            replicaDisk = this.allocReplicaDisk(dskPool, primary);
            md.setReplicaDISK(replicaDisk);
        } catch (ResourceNotFoundException e) {
            // replicaDisk = new DISK();
            logger.error("Replica disk not allocated!");
        // System.out.println(">>Replica disk not allocated!");
        }
    } catch (ResourceNotFoundException e) {
        logger.error(e.getMessage());
        // "No disk in the system!"
        throw new IOException(e.getMessage());
    }
    return 0;
}
Also used : IOException(java.io.IOException) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)

Example 17 with ResourceNotFoundException

use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException 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 18 with ResourceNotFoundException

use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException 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 19 with ResourceNotFoundException

use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.

the class MysqlDataRepository method selectSingleObjectInternal.

private synchronized Metadata selectSingleObjectInternal(String diskPoolId, String objId, String versionId) throws ResourceNotFoundException {
    try {
        this.pstSelectOneWithVersionId.clearParameters();
        this.pstSelectOneWithVersionId.setString(1, objId);
        this.pstSelectOneWithVersionId.setString(2, versionId);
        ResultSet rs = this.pstSelectOneWithVersionId.executeQuery();
        return getSelectObjectResult(diskPoolId, rs);
    } catch (SQLException ex) {
        System.out.println(" error : " + ex.getMessage());
        this.ex_message(ex);
        throw new ResourceNotFoundException("path not found in the db : " + ex.getMessage());
    }
}
Also used : ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)

Example 20 with ResourceNotFoundException

use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.

the class S3Request method putBucketVersioning.

protected void putBucketVersioning(String bucket, String status) throws GWException {
    try {
        setObjManager();
        objManager.putBucketVersioning(bucket, status);
    } catch (ResourceNotFoundException e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.NO_SUCH_BUCKET, s3Parameter);
    } catch (Exception e) {
        PrintStack.logging(logger, e);
        throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
    } finally {
        try {
            releaseObjManager();
        } catch (Exception e) {
            PrintStack.logging(logger, e);
            throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
        }
    }
}
Also used : GWException(com.pspace.ifs.ksan.gw.exception.GWException) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException) GWException(com.pspace.ifs.ksan.gw.exception.GWException) ResourceAlreadyExistException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceAlreadyExistException) XMLStreamException(javax.xml.stream.XMLStreamException) ResourceNotFoundException(com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException)

Aggregations

ResourceNotFoundException (com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException)36 ResourceAlreadyExistException (com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceAlreadyExistException)11 SQLException (java.sql.SQLException)11 GWException (com.pspace.ifs.ksan.gw.exception.GWException)10 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)8 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)8 Metadata (com.pspace.ifs.ksan.objmanager.Metadata)8 XMLStreamException (javax.xml.stream.XMLStreamException)8 IOException (java.io.IOException)6 InvalidParameterException (java.security.InvalidParameterException)5 Document (org.bson.Document)5 AllServiceOfflineException (com.pspace.ifs.ksan.objmanager.ObjManagerException.AllServiceOfflineException)4 Iterator (java.util.Iterator)4 Bucket (com.pspace.ifs.ksan.objmanager.Bucket)3 ArrayList (java.util.ArrayList)3 FindIterable (com.mongodb.client.FindIterable)2 MQResponse (com.pspace.ifs.ksan.mq.MQResponse)2 ObjManager (com.pspace.ifs.ksan.objmanager.ObjManager)2 ObjManagerUtil (com.pspace.ifs.ksan.objmanager.ObjManagerUtil)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2