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;
}
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;
}
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;
}
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());
}
}
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);
}
}
}
Aggregations