Search in sources :

Example 1 with VolumeServiceException

use of com.zimbra.cs.volume.VolumeServiceException in project zm-mailbox by Zimbra.

the class CreateVolume method redo.

@Override
public void redo() throws Exception {
    VolumeManager mgr = VolumeManager.getInstance();
    try {
        Volume vol = mgr.getVolume(id);
        if (vol != null) {
            mLog.info("Volume already exists id=%d", id);
            return;
        }
    } catch (VolumeServiceException e) {
        if (e.getCode() != VolumeServiceException.NO_SUCH_VOLUME) {
            throw e;
        }
    }
    try {
        Volume volume = Volume.builder().setId(id).setType(type).setName(name).setPath(rootPath, false).setMboxGroupBits(mboxGroupBits).setMboxBit(mboxBits).setFileGroupBits(fileGroupBits).setFileBits(fileBits).setCompressBlobs(compressBlobs).setCompressionThreshold(compressionThreshold).build();
        mgr.create(volume, getUnloggedReplay());
    } catch (VolumeServiceException e) {
        if (e.getCode() == VolumeServiceException.ALREADY_EXISTS) {
            mLog.info("Volume already exists id=%d", id);
        } else {
            throw e;
        }
    }
}
Also used : VolumeServiceException(com.zimbra.cs.volume.VolumeServiceException) VolumeManager(com.zimbra.cs.volume.VolumeManager) Volume(com.zimbra.cs.volume.Volume)

Example 2 with VolumeServiceException

use of com.zimbra.cs.volume.VolumeServiceException in project zm-mailbox by Zimbra.

the class DeleteVolume method redo.

@Override
public void redo() throws Exception {
    VolumeManager mgr = VolumeManager.getInstance();
    try {
        // make sure it exists
        mgr.getVolume(mId);
        mgr.delete(mId, getUnloggedReplay());
    } catch (VolumeServiceException e) {
        if (e.getCode() != VolumeServiceException.NO_SUCH_VOLUME) {
            throw e;
        }
    }
}
Also used : VolumeServiceException(com.zimbra.cs.volume.VolumeServiceException) VolumeManager(com.zimbra.cs.volume.VolumeManager)

Aggregations

VolumeManager (com.zimbra.cs.volume.VolumeManager)2 VolumeServiceException (com.zimbra.cs.volume.VolumeServiceException)2 Volume (com.zimbra.cs.volume.Volume)1