Skip to content

Commit

Permalink
ZCS-11428 Modify Volumes SOAP API to support S3 volume type.
Browse files Browse the repository at this point in the history
- Introduced external volume info DTO
- Honoring store_type column while creating volume
- Modified create/delete/getAllvolumes/getVolume/modifyVolume API's to support S3 volume type

Co-authored-by: Rakeshkumar More <[email protected]>
  • Loading branch information
2 people authored and silentsakky committed Aug 9, 2022
1 parent 451e8e8 commit 6e01a80
Show file tree
Hide file tree
Showing 18 changed files with 953 additions and 121 deletions.
17 changes: 13 additions & 4 deletions common/src/java/com/zimbra/common/soap/AdminConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ public final class AdminConstants {
public static final QName MODIFY_OUTGOING_FILTER_RULES_RESPONSE = QName.get(E_MODIFY_OUTGOING_FILTER_RULES_RESPONSE, NAMESPACE);
public static final QName CONTACT_BACKUP_REQUEST = QName.get(E_CONTACT_BACKUP_REQUEST, NAMESPACE);
public static final QName CONTACT_BACKUP_RESPONSE = QName.get(E_CONTACT_BACKUP_RESPONSE, NAMESPACE);

//HAB
public static final String E_HAB_ORG_UNIT_REQUEST = "HABOrgUnitRequest";
public static final String E_HAB_ORG_UNIT_RESPONSE = "HABOrgUnitResponse";
Expand Down Expand Up @@ -1176,6 +1176,7 @@ public final class AdminConstants {
public static final String E_NI = "ni";
public static final String E_NUM_OF_PAGES = "numpages";
public static final String E_VOLUME = "volume";
public static final String E_VOLUME_EXT = "volumeExternalInfo";
public static final String E_PROGRESS = "progress";
public static final String E_SOAP_URL = "soapURL";
public static final String E_ADMIN_SOAP_URL = "adminSoapURL";
Expand Down Expand Up @@ -1301,7 +1302,15 @@ public final class AdminConstants {
public static final String A_VOLUME_FBITS = "fbits";
public static final String A_VOLUME_COMPRESS_BLOBS = "compressBlobs";
public static final String A_VOLUME_COMPRESSION_THRESHOLD = "compressionThreshold";
public static final String A_VOLUME_IS_CURRENT = "isCurrent";
public static final String A_VOLUME_CURRENT = "current";
public static final String A_VOLUME_STORE_TYPE = "storeType";
public static final String A_VOLUME_STORAGE_TYPE = "storageType";
public static final String A_VOLUME_VOLUME_PREFIX = "volumePrefix";
public static final String A_VOLUME_STORE_PROVIDER = "storeProvider";
public static final String A_VOLUME_GLB_BUCKET_CONFIG_ID = "globalBucketConfigId";
public static final String A_VOLUME_USE_IN_FREQ_ACCESS = "useInFrequentAccess";
public static final String A_VOLUME_USE_IN_FREQ_ACCESS_THRESHOLD = "useInFrequentAccessThreshold";
public static final String A_VOLUME_USE_INTELLIGENT_TIERING = "useIntelligentTiering";

// Blob consistency check
public static final String E_MISSING_BLOBS = "missingBlobs";
Expand Down Expand Up @@ -1351,7 +1360,7 @@ public final class AdminConstants {
public static final String A_QUOTA_USED = "used";
public static final String A_QUOTA_LIMIT = "limit";
public static final String A_EFFECTIVE_QUOTA = "effectiveQuota";

public static final String E_TEMPLATE = "template";
public static final String E_TEST = "test";
public static final String A_DEST = "dest";
Expand Down Expand Up @@ -1560,7 +1569,7 @@ public final class AdminConstants {
public static final String A_FORCE_DELETE = "forceDelete";
public static final String E_MEMBERS = "members";
public static final String A_CASCADE_DELETE = "cascadeDelete";

// address list
public static final String E_CREATE_ADDRESS_LIST_REQUEST = "CreateAddressListRequest";
public static final String E_CREATE_ADDRESS_LIST_RESPONSE = "CreateAddressListResponse";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2011, 2012, 2013, 2014, 2016 Synacor, Inc.
* Copyright (C) 2011, 2012, 2013, 2014, 2016, 2022 Synacor, Inc.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software Foundation,
Expand All @@ -24,6 +24,7 @@

import com.zimbra.common.soap.AdminConstants;
import com.zimbra.soap.admin.type.VolumeInfo;
import com.zimbra.soap.admin.type.VolumeExternalInfo;

/**
* @zm-api-command-auth-required true
Expand All @@ -38,7 +39,7 @@ public class CreateVolumeRequest {
* @zm-api-field-description Volume information
*/
@XmlElement(name=AdminConstants.E_VOLUME, required=true)
private VolumeInfo volume;
private VolumeInfo volumeInfo;

/**
* no-argument constructor wanted by JAXB
Expand All @@ -48,9 +49,9 @@ private CreateVolumeRequest() {
this((VolumeInfo)null);
}

public CreateVolumeRequest(VolumeInfo volume) {
this.volume = volume;
public CreateVolumeRequest(VolumeInfo volumeInfo) {
this.volumeInfo = volumeInfo;
}

public VolumeInfo getVolume() { return volume; }
public VolumeInfo getVolumeInfo() { return volumeInfo; }
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2011, 2012, 2013, 2014, 2016 Synacor, Inc.
* Copyright (C) 2011, 2012, 2013, 2014, 2016, 2022 Synacor, Inc.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software Foundation,
Expand Down Expand Up @@ -55,5 +55,4 @@ public DeleteVolumeRequest(short value) {
public short getId() {
return id;
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2011, 2012, 2013, 2014, 2016 Synacor, Inc.
* Copyright (C) 2011, 2012, 2013, 2014, 2016, 2022 Synacor, Inc.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software Foundation,
Expand Down Expand Up @@ -43,7 +43,7 @@ public class ModifyVolumeRequest {
* @zm-api-field-description Volume information
*/
@XmlElement(name=AdminConstants.E_VOLUME, required=true)
private VolumeInfo volume;
private VolumeInfo volumeInfo;

/**
* no-argument constructor wanted by JAXB
Expand All @@ -53,11 +53,11 @@ private ModifyVolumeRequest() {
this((short)-1, (VolumeInfo)null);
}

public ModifyVolumeRequest(short id, VolumeInfo volume) {
public ModifyVolumeRequest(short id, VolumeInfo volumeInfo) {
this.id = id;
this.volume = volume;
this.volumeInfo = volumeInfo;
}

public short getId() { return id; }
public VolumeInfo getVolume() { return volume; }
public VolumeInfo getVolumeInfo() { return volumeInfo; }
}
112 changes: 112 additions & 0 deletions soap/src/java/com/zimbra/soap/admin/type/VolumeExternalInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2022 Synacor, Inc.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software Foundation,
* version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <https://www.gnu.org/licenses/>.
* ***** END LICENSE BLOCK *****
*/

package com.zimbra.soap.admin.type;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;

import com.zimbra.common.soap.AdminConstants;

@XmlAccessorType(XmlAccessType.NONE)
public class VolumeExternalInfo {

/**
* @zm-api-field-description Set to 1 for Internal and 2 for External.
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_STORAGE_TYPE /* storageType */, required=false)
private String storageType = "S3";

/**
* @zm-api-field-description Prefix for bucket location e.g. server1_primary
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_VOLUME_PREFIX /* volumePrefix */, required=false)
private String volumePrefix = "";

/**
* @zm-api-field-description Specifies global bucket configuration Id
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_GLB_BUCKET_CONFIG_ID /* globalBucketConfigId */, required=true)
private String globalBucketConfigId = "";

/**
* @zm-api-field-description Specifies frequent access enabled or not
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_USE_IN_FREQ_ACCESS /* useInFrequentAccess */, required=false)
private boolean useInFrequentAccess = false;

/**
* @zm-api-field-description Specifies threshold value of useInFrequentAccess
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_USE_IN_FREQ_ACCESS_THRESHOLD /* useInFrequentAccessThreshold */, required=false)
private int useInFrequentAccessThreshold = 65536;

/**
* @zm-api-field-description Specifies intelligent tiering enabled or not
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_USE_INTELLIGENT_TIERING /* useIntelligentTiering */, required=false)
private boolean useIntelligentTiering = false;

public void setStorageType(String value) {
storageType = value;
}

public String getStorageType() {
return storageType;
}

public void setVolumePrefix(String value) {
volumePrefix = value;
}

public String getVolumePrefix() {
return volumePrefix;
}

public void setGlobalBucketConfigurationId(String value) {
globalBucketConfigId = value;
}

public String getGlobalBucketConfigurationId() {
return globalBucketConfigId;
}

public void setUseInFrequentAccess(boolean value) {
useInFrequentAccess = value;
}

public boolean isUseInFrequentAccess() {
return useInFrequentAccess;
}

public void setUseIntelligentTiering(boolean value) {
useIntelligentTiering = value;
}

public boolean isUseIntelligentTiering() {
return useIntelligentTiering;
}

public void setUseInFrequentAccessThreshold(int value) {
useInFrequentAccessThreshold = value;
}

public int getUseInFrequentAccessThreshold() {
return useInFrequentAccessThreshold;
}
}
60 changes: 42 additions & 18 deletions soap/src/java/com/zimbra/soap/admin/type/VolumeInfo.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2011, 2012, 2013, 2014, 2016 Synacor, Inc.
* Copyright (C) 2011, 2012, 2013, 2014, 2016, 2022 Synacor, Inc.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software Foundation,
Expand All @@ -20,9 +20,9 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;

import com.zimbra.common.soap.AdminConstants;
import com.zimbra.soap.type.ZmBoolean;

@XmlAccessorType(XmlAccessType.NONE)
public final class VolumeInfo {
Expand All @@ -38,14 +38,14 @@ public final class VolumeInfo {
* @zm-api-field-tag volume-name
* @zm-api-field-description Name or description of volume
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_NAME /* name */, required=false)
@XmlAttribute(name=AdminConstants.A_VOLUME_NAME /* name */, required=true)
private String name;

/**
* @zm-api-field-tag volume-root-path
* @zm-api-field-description Absolute path to root of volume, e.g. /opt/zimbra/store
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_ROOTPATH /* rootpath */, required=false)
@XmlAttribute(name=AdminConstants.A_VOLUME_ROOTPATH /* rootpath */, required=true)
private String rootPath;

/**
Expand All @@ -57,23 +57,23 @@ public final class VolumeInfo {
* <tr> <td> <b>10</b> </td> <td> index volume </td> </tr>
* </table>
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_TYPE /* type */, required=false)
@XmlAttribute(name=AdminConstants.A_VOLUME_TYPE /* type */, required=true)
private short type = -1;

/**
* @zm-api-field-tag compress-blobs
* @zm-api-field-description Specifies whether blobs in this volume are compressed
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_COMPRESS_BLOBS /* compressBlobs */, required=false)
private ZmBoolean compressBlobs;
private boolean compressBlobs = false;

/**
* @zm-api-field-tag compression-threshold
* @zm-api-field-description Long value that specifies the maximum uncompressed file size, in bytes, of blobs
* that will not be compressed (in other words blobs larger than this threshold are compressed)
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_COMPRESSION_THRESHOLD /* compressionThreshold */, required=false)
private long compressionThreshold = -1;
private long compressionThreshold = 4096;

/**
* @zm-api-field-description mgbits
Expand Down Expand Up @@ -102,8 +102,20 @@ public final class VolumeInfo {
/**
* @zm-api-field-description Set if the volume is current.
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_IS_CURRENT /* isCurrent */, required=false)
private ZmBoolean current;
@XmlAttribute(name=AdminConstants.A_VOLUME_CURRENT /* current */, required=false)
private boolean current = false;

/**
* @zm-api-field-description Set to 1 for internal volumes and 2 for external volumes
*/
@XmlAttribute(name=AdminConstants.A_VOLUME_STORE_TYPE /* storeType */, required=false)
private short storeType = 1;

/**
* @zm-api-field-description Volume external information
*/
@XmlElement(name=AdminConstants.E_VOLUME_EXT /* volumeExternalInfo */, required=false)
private VolumeExternalInfo volumeExternalInfo;

public void setId(short value) {
id = value;
Expand Down Expand Up @@ -138,15 +150,11 @@ public short getType() {
}

public void setCompressBlobs(Boolean value) {
compressBlobs = ZmBoolean.fromBool(value);
compressBlobs = value;
}

public boolean isCompressBlobs() {
return ZmBoolean.toBool(compressBlobs, false);
}

public Boolean getCompressBlobs() {
return ZmBoolean.toBool(compressBlobs);
return compressBlobs;
}

public void setCompressionThreshold(long value) {
Expand Down Expand Up @@ -190,10 +198,26 @@ public short getFbits() {
}

public void setCurrent(boolean value) {
current = ZmBoolean.fromBool(value);
current = value;
}

public boolean isCurrent() {
return current;
}

public void setVolumeExternalInfo(VolumeExternalInfo value) {
volumeExternalInfo = value;
}

public VolumeExternalInfo getVolumeExternalInfo() {
return volumeExternalInfo;
}

public void setStoreType(short value) {
storeType = value;
}

public Boolean isCurrent() {
return ZmBoolean.toBool(current);
public short getStoreType() {
return storeType;
}
}
Loading

0 comments on commit 6e01a80

Please sign in to comment.