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