Search in sources :

Example 1 with VolumeManager

use of com.zimbra.cs.volume.VolumeManager 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 VolumeManager

use of com.zimbra.cs.volume.VolumeManager 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)

Example 3 with VolumeManager

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

the class GetCurrentVolumes method handle.

private GetCurrentVolumesResponse handle(@SuppressWarnings("unused") GetCurrentVolumesRequest req, Map<String, Object> ctx) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(ctx);
    checkRight(zsc, ctx, Provisioning.getInstance().getLocalServer(), Admin.R_manageVolume);
    GetCurrentVolumesResponse resp = new GetCurrentVolumesResponse();
    VolumeManager mgr = VolumeManager.getInstance();
    Volume msgVol = mgr.getCurrentMessageVolume();
    if (msgVol != null) {
        resp.addVolume(new GetCurrentVolumesResponse.CurrentVolumeInfo(msgVol.getId(), msgVol.getType()));
    }
    Volume secondaryMsgVol = mgr.getCurrentSecondaryMessageVolume();
    if (secondaryMsgVol != null) {
        resp.addVolume(new GetCurrentVolumesResponse.CurrentVolumeInfo(secondaryMsgVol.getId(), secondaryMsgVol.getType()));
    }
    Volume indexVol = mgr.getCurrentIndexVolume();
    if (indexVol != null) {
        resp.addVolume(new GetCurrentVolumesResponse.CurrentVolumeInfo(indexVol.getId(), indexVol.getType()));
    }
    return resp;
}
Also used : VolumeManager(com.zimbra.cs.volume.VolumeManager) Volume(com.zimbra.cs.volume.Volume) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) GetCurrentVolumesResponse(com.zimbra.soap.admin.message.GetCurrentVolumesResponse)

Example 4 with VolumeManager

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

the class BlobDeduper method updateMetadata.

private Volume updateMetadata(short volumeId, VolumeMetadata metadata) throws ServiceException {
    VolumeManager mgr = VolumeManager.getInstance();
    Volume.Builder builder = Volume.builder(mgr.getVolume(volumeId));
    builder.setMetadata(metadata);
    return mgr.update(builder.build());
}
Also used : VolumeManager(com.zimbra.cs.volume.VolumeManager) Volume(com.zimbra.cs.volume.Volume)

Example 5 with VolumeManager

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

the class TestDocumentServer method cleanUp.

private void cleanUp() throws Exception {
    // Restore volume compression settings.
    VolumeManager mgr = VolumeManager.getInstance();
    Volume current = mgr.getCurrentMessageVolume();
    Volume vol = Volume.builder(current).setCompressBlobs(mOriginalCompressBlobs).setCompressionThreshold(mOriginalCompressionThreshold).build();
    mgr.update(vol);
}
Also used : VolumeManager(com.zimbra.cs.volume.VolumeManager) Volume(com.zimbra.cs.volume.Volume)

Aggregations

VolumeManager (com.zimbra.cs.volume.VolumeManager)9 Volume (com.zimbra.cs.volume.Volume)7 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)3 StoreManager (com.zimbra.cs.store.StoreManager)2 VolumeServiceException (com.zimbra.cs.volume.VolumeServiceException)2 Mailbox (com.zimbra.cs.mailbox.Mailbox)1 WikiItem (com.zimbra.cs.mailbox.WikiItem)1 DeleteVolumeResponse (com.zimbra.soap.admin.message.DeleteVolumeResponse)1 GetCurrentVolumesResponse (com.zimbra.soap.admin.message.GetCurrentVolumesResponse)1 ModifyVolumeResponse (com.zimbra.soap.admin.message.ModifyVolumeResponse)1 VolumeInfo (com.zimbra.soap.admin.type.VolumeInfo)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Test (org.junit.Test)1