From 3a861ce929914b1ca708eedd9d47a76ed67e6427 Mon Sep 17 00:00:00 2001 From: "Gupta, Surya" Date: Fri, 17 Oct 2025 14:45:02 +0530 Subject: [PATCH 1/3] CSTACKEX-30 SAN Feign Client --- .../storage/feign/client/SANFeignClient.java | 91 +++++ .../storage/feign/model/ExportPolicy.java | 2 +- .../storage/feign/model/FileInfo.java | 2 +- .../storage/feign/model/Igroup.java | 255 ++++++++++++++ .../storage/feign/model/Initiator.java | 36 ++ .../cloudstack/storage/feign/model/Lun.java | 316 ++++++++++++++++++ .../storage/feign/model/LunMap.java | 132 ++++++++ .../storage/feign/model/LunSpace.java | 95 ++++++ 8 files changed, 927 insertions(+), 2 deletions(-) create mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/SANFeignClient.java create mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Igroup.java create mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Initiator.java create mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Lun.java create mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunMap.java create mode 100644 plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunSpace.java diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/SANFeignClient.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/SANFeignClient.java new file mode 100644 index 000000000000..325823f8515c --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/SANFeignClient.java @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.feign.client; + +import org.apache.cloudstack.storage.feign.model.Igroup; +import org.apache.cloudstack.storage.feign.model.Lun; +import org.apache.cloudstack.storage.feign.FeignConfiguration; +import org.apache.cloudstack.storage.feign.model.LunMap; +import org.apache.cloudstack.storage.feign.model.response.OntapResponse; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.context.annotation.Lazy; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestHeader; + +import java.net.URI; + +@Lazy +@FeignClient(name = "SANClient", url = "", configuration = FeignConfiguration.class ) +public interface SANFeignClient { + + //Lun Operation APIs + @RequestMapping(method = RequestMethod.POST) + OntapResponse createLun(URI baseURL, @RequestHeader("Authorization") String authHeader, @RequestHeader("return_records") boolean value, + @RequestBody Lun lun); + + //this method to get all luns and also filtered luns based on query params as a part of URL + @RequestMapping(method = RequestMethod.GET) + OntapResponse getLunResponse(URI baseURL, @RequestHeader("Authorization") String authHeader); + + @RequestMapping(method = RequestMethod.GET, value = "/{uuid}") + Lun getLunByUUID(URI baseURL, @RequestHeader("Authorization") String authHeader, @PathVariable(name="uuid", required=true) String uuid); + + @RequestMapping(method = RequestMethod.PATCH, value = "/{uuid}") + void updateLun(URI uri, @RequestHeader("Authorization") String authHeader, @PathVariable(name="uuid", required=true) String uuid, + @RequestBody Lun lun); + + @RequestMapping(method = RequestMethod.DELETE, value = "/{uuid}") + void deleteLun(URI baseURL, @RequestHeader("Authorization") String authHeader, @PathVariable(name="uuid", required=true) String uuid); + + + //iGroup Operation APIs + + @RequestMapping(method = RequestMethod.POST) + OntapResponse createIgroup(URI uri, @RequestHeader("Authorization") String header, @RequestHeader("return_records") boolean value, + @RequestBody Igroup igroupRequest); + + //this method to get all igroups and also filtered igroups based on query params as a part of URL + @RequestMapping(method = RequestMethod.GET) + OntapResponse getIgroupResponse(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "uuid", required = true) String uuid); + @RequestMapping(method = RequestMethod.GET, value = "/{uuid}") + Igroup getIgroupByUUID(URI baseURL, @RequestHeader("Authorization") String header, @PathVariable(name = "uuid", required = true) String uuid); + @RequestMapping(method = RequestMethod.DELETE, value = "/{uuid}") + void deleteIgroup(URI baseUri, @RequestHeader("Authorization") String authHeader, @PathVariable(name = "uuid", required = true) String uuid); + + @RequestMapping(method = RequestMethod.POST, value = "/{uuid}/igroups") + OntapResponse addNestedIgroups(URI uri, @RequestHeader("Authorization") String header, @PathVariable(name = "uuid", required = true) String uuid, + @RequestBody Igroup igroupNestedRequest, @RequestHeader(value="return_records", defaultValue = "true") boolean value); + + + //Lun Maps Operation APIs + + @RequestMapping(method = RequestMethod.POST) + OntapResponse createLunMap(URI baseURL, @RequestHeader("Authorization") String authHeader, @RequestBody LunMap lunMap); + + @RequestMapping(method = RequestMethod.GET) + OntapResponse getLunMapResponse(URI baseURL, @RequestHeader("Authorization") String authHeader); + + @RequestMapping(method = RequestMethod.GET, value = "/{lun.uuid}/{igroup.uuid}") + void deleteLunMap(URI baseURL, @RequestHeader("Authorization") String authHeader, @PathVariable(name="lun.uuid", required=true) String uuid, + @PathVariable(name="igroup.uuid", required=true) String igroupUUID); + +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java index be78639844b3..ab0ed0b9e356 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java @@ -96,7 +96,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash( id, name, rules, svm); + return Objects.hash( id, name); } diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java index b67704435a9e..973e957ada63 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java @@ -255,7 +255,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(bytesUsed, creationTime, fillEnabled, isEmpty, isSnapshot, isVmAligned, modifiedTime, name, overwriteEnabled, path, size, target, type, uniqueBytes, unixPermissions); + return Objects.hash(name, path); } diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Igroup.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Igroup.java new file mode 100644 index 000000000000..3ddde89f9184 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Igroup.java @@ -0,0 +1,255 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cloudstack.storage.feign.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Igroup { + @JsonProperty("delete_on_unmap") + private Boolean deleteOnUnmap = null; + @JsonProperty("initiators") + private List initiators = null; + @JsonProperty("lun_maps") + private List lunMaps = null; + @JsonProperty("os_type") + private OsTypeEnum osType = null; + + @JsonProperty("parent_igroups") + private List parentIgroups = null; + + @JsonProperty("igroups") + private List igroups = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("protocol") + private ProtocolEnum protocol = ProtocolEnum.mixed; + @JsonProperty("svm") + private Svm svm = null; + @JsonProperty("uuid") + private String uuid = null; + + public enum OsTypeEnum { + hyper_v("hyper_v"), + + linux("linux"), + + vmware("vmware"), + + windows("windows"), + + xen("xen"); + + private String value; + + OsTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OsTypeEnum fromValue(String text) { + for (OsTypeEnum b : OsTypeEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + public List getParentIgroups() { + return parentIgroups; + } + + public void setParentIgroups(List parentIgroups) { + this.parentIgroups = parentIgroups; + } + + public Igroup igroups(List igroups) { + this.igroups = igroups; + return this; + } + + public List getIgroups() { + return igroups; + } + + public void setIgroups(List igroups) { + this.igroups = igroups; + } + + public enum ProtocolEnum { + iscsi("iscsi"), + + mixed("mixed"); + + private String value; + + ProtocolEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ProtocolEnum fromValue(String text) { + for (ProtocolEnum b : ProtocolEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + public Igroup deleteOnUnmap(Boolean deleteOnUnmap) { + this.deleteOnUnmap = deleteOnUnmap; + return this; + } + + public Boolean isDeleteOnUnmap() { + return deleteOnUnmap; + } + + public void setDeleteOnUnmap(Boolean deleteOnUnmap) { + this.deleteOnUnmap = deleteOnUnmap; + } + + public Igroup initiators(List initiators) { + this.initiators = initiators; + return this; + } + public List getInitiators() { + return initiators; + } + + public void setInitiators(List initiators) { + this.initiators = initiators; + } + + public Igroup lunMaps(List lunMaps) { + this.lunMaps = lunMaps; + return this; + } + public List getLunMaps() { + return lunMaps; + } + + public void setLunMaps(List lunMaps) { + this.lunMaps = lunMaps; + } + + public Igroup name(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + public Igroup osType(OsTypeEnum osType) { + this.osType = osType; + return this; + } + public OsTypeEnum getOsType() { + return osType; + } + + public void setOsType(OsTypeEnum osType) { + this.osType = osType; + } + + public Igroup protocol(ProtocolEnum protocol) { + this.protocol = protocol; + return this; + } + + public ProtocolEnum getProtocol() { + return protocol; + } + + public void setProtocol(ProtocolEnum protocol) { + this.protocol = protocol; + } + + public Igroup svm(Svm svm) { + this.svm = svm; + return this; + } + public Svm getSvm() { + return svm; + } + + public void setSvm(Svm svm) { + this.svm = svm; + } + + public String getUuid() { + return uuid; + } + + @Override + public int hashCode() { + return Objects.hash(name, uuid); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Igroup other = (Igroup) obj; + return Objects.equals(name, other.name) && Objects.equals(uuid, other.uuid); + } + + @Override + public String toString() { + return "Igroup [deleteOnUnmap=" + deleteOnUnmap + ", initiators=" + initiators + ", lunMaps=" + lunMaps + + ", name=" + name + ", replication=" + ", osType=" + osType + ", parentIgroups=" + + parentIgroups + ", igroups=" + igroups + ", protocol=" + protocol + ", svm=" + svm + ", uuid=" + uuid + + ", portset=" + "]"; + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Initiator.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Initiator.java new file mode 100644 index 000000000000..dc290bdc2fc9 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Initiator.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cloudstack.storage.feign.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Initiator { + @JsonProperty("name") + private String name = null; + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Lun.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Lun.java new file mode 100644 index 000000000000..b586a0dccb4b --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Lun.java @@ -0,0 +1,316 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cloudstack.storage.feign.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.util.List; +import java.util.Objects; + +/** + * A LUN is the logical representation of storage in a storage area network (SAN).<br/> In ONTAP, a LUN is located within a volume. Optionally, it can be located within a qtree in a volume.<br/> A LUN can be created to a specified size using thin or thick provisioning. A LUN can then be renamed, resized, cloned, and moved to a different volume. LUNs support the assignment of a quality of service (QoS) policy for performance management or a QoS policy can be assigned to the volume containing the LUN. See the LUN object model to learn more about each of the properties supported by the LUN REST API.<br/> A LUN must be mapped to an initiator group to grant access to the initiator group's initiators (client hosts). Initiators can then access the LUN and perform I/O over a Fibre Channel (FC) fabric using the Fibre Channel Protocol or a TCP/IP network using iSCSI. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Lun { + + @JsonProperty("auto_delete") + private Boolean autoDelete = null; + + /** + * The class of LUN.<br/> Optional in POST. + */ + public enum PropertyClassEnum { + REGULAR("regular"), + + PROTOCOL_ENDPOINT("protocol_endpoint"), + + VVOL("vvol"); + + private String value; + + PropertyClassEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static PropertyClassEnum fromValue(String value) { + for (PropertyClassEnum b : PropertyClassEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + } + + @JsonProperty("class") + private PropertyClassEnum propertyClass = null; + + @JsonProperty("enabled") + private Boolean enabled = null; + + @JsonProperty("lun_maps") + private List lunMaps = null; + + @JsonProperty("name") + private String name = null; + + /** + * The operating system type of the LUN.<br/> Required in POST when creating a LUN that is not a clone of another. Disallowed in POST when creating a LUN clone. + */ + public enum OsTypeEnum { + AIX("aix"), + + HPUX("hpux"), + + HYPER_V("hyper_v"), + + LINUX("linux"), + + NETWARE("netware"), + + OPENVMS("openvms"), + + SOLARIS("solaris"), + + SOLARIS_EFI("solaris_efi"), + + VMWARE("vmware"), + + WINDOWS("windows"), + + WINDOWS_2008("windows_2008"), + + WINDOWS_GPT("windows_gpt"), + + XEN("xen"); + + private String value; + + OsTypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OsTypeEnum fromValue(String value) { + for (OsTypeEnum b : OsTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + } + + @JsonProperty("os_type") + private OsTypeEnum osType = null; + + @JsonProperty("serial_number") + private String serialNumber = null; + + @JsonProperty("space") + private LunSpace space = null; + + @JsonProperty("svm") + private Svm svm = null; + + @JsonProperty("uuid") + private String uuid = null; + + public Lun autoDelete(Boolean autoDelete) { + this.autoDelete = autoDelete; + return this; + } + + public Boolean isAutoDelete() { + return autoDelete; + } + + public void setAutoDelete(Boolean autoDelete) { + this.autoDelete = autoDelete; + } + + public Lun propertyClass(PropertyClassEnum propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + public PropertyClassEnum getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(PropertyClassEnum propertyClass) { + this.propertyClass = propertyClass; + } + + public Lun enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + public Boolean isEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public List getLunMaps() { + return lunMaps; + } + + public void setLunMaps(List lunMaps) { + this.lunMaps = lunMaps; + } + + public Lun name(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Lun osType(OsTypeEnum osType) { + this.osType = osType; + return this; + } + + public OsTypeEnum getOsType() { + return osType; + } + + public void setOsType(OsTypeEnum osType) { + this.osType = osType; + } + + public String getSerialNumber() { + return serialNumber; + } + + public Lun space(LunSpace space) { + this.space = space; + return this; + } + + public LunSpace getSpace() { + return space; + } + + public void setSpace(LunSpace space) { + this.space = space; + } + + public Lun svm(Svm svm) { + this.svm = svm; + return this; + } + + public Svm getSvm() { + return svm; + } + + public void setSvm(Svm svm) { + this.svm = svm; + } + + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Lun lun = (Lun) o; + return Objects.equals(this.name, lun.name) && Objects.equals(this.uuid, lun.uuid); + } + + @Override + public int hashCode() { + return Objects.hash(name, uuid); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Lun {\n"); + sb.append(" autoDelete: ").append(toIndentedString(autoDelete)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" lunMaps: ").append(toIndentedString(lunMaps)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" osType: ").append(toIndentedString(osType)).append("\n"); + sb.append(" serialNumber: ").append(toIndentedString(serialNumber)).append("\n"); + sb.append(" space: ").append(toIndentedString(space)).append("\n"); + sb.append(" svm: ").append(toIndentedString(svm)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunMap.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunMap.java new file mode 100644 index 000000000000..a592a2909a93 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunMap.java @@ -0,0 +1,132 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +package org.apache.cloudstack.storage.feign.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.gson.annotations.SerializedName; + +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class LunMap { + @JsonProperty("igroup") + private Igroup igroup = null; + @JsonProperty("logical_unit_number") + private Integer logicalUnitNumber = null; + @JsonProperty("lun") + private Lun lun = null; + @JsonProperty("svm") + @SerializedName("svm") + private Svm svm = null; + + public LunMap igroup (Igroup igroup) { + this.igroup = igroup; + return this; + } + + public Igroup getIgroup () { + return igroup; + } + + public void setIgroup (Igroup igroup) { + this.igroup = igroup; + } + + public LunMap logicalUnitNumber (Integer logicalUnitNumber) { + this.logicalUnitNumber = logicalUnitNumber; + return this; + } + + public Integer getLogicalUnitNumber () { + return logicalUnitNumber; + } + + public void setLogicalUnitNumber (Integer logicalUnitNumber) { + this.logicalUnitNumber = logicalUnitNumber; + } + + public LunMap lun (Lun lun) { + this.lun = lun; + return this; + } + + public Lun getLun () { + return lun; + } + + public void setLun (Lun lun) { + this.lun = lun; + } + + public LunMap svm (Svm svm) { + this.svm = svm; + return this; + } + + public Svm getSvm () { + return svm; + } + + public void setSvm (Svm svm) { + this.svm = svm; + } + + + @Override + public boolean equals (Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LunMap lunMap = (LunMap) o; + return Objects.equals(this.igroup, lunMap.igroup) && + Objects.equals(this.logicalUnitNumber, lunMap.logicalUnitNumber) && + Objects.equals(this.lun, lunMap.lun) && + Objects.equals(this.svm, lunMap.svm); + } + + @Override + public int hashCode () { + return Objects.hash(igroup, logicalUnitNumber, lun, svm); + } + + @Override + public String toString () { + StringBuilder sb = new StringBuilder(); + sb.append("class LunMap {\n"); + sb.append(" igroup: ").append(toIndentedString(igroup)).append("\n"); + sb.append(" logicalUnitNumber: ").append(toIndentedString(logicalUnitNumber)).append("\n"); + sb.append(" lun: ").append(toIndentedString(lun)).append("\n"); + sb.append(" svm: ").append(toIndentedString(svm)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + private String toIndentedString (Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunSpace.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunSpace.java new file mode 100644 index 000000000000..8acfceb2046c --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunSpace.java @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +package org.apache.cloudstack.storage.feign.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The storage space related properties of the LUN. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class LunSpace { + + @JsonProperty("scsi_thin_provisioning_support_enabled") + private Boolean scsiThinProvisioningSupportEnabled = null; + + @JsonProperty("size") + private Long size = null; + + @JsonProperty("used") + private Long used = null; + @JsonProperty("physical_used") + private Long physicalUsed = null; + + public LunSpace scsiThinProvisioningSupportEnabled(Boolean scsiThinProvisioningSupportEnabled) { + this.scsiThinProvisioningSupportEnabled = scsiThinProvisioningSupportEnabled; + return this; + } + + public Boolean isScsiThinProvisioningSupportEnabled() { + return scsiThinProvisioningSupportEnabled; + } + + public void setScsiThinProvisioningSupportEnabled(Boolean scsiThinProvisioningSupportEnabled) { + this.scsiThinProvisioningSupportEnabled = scsiThinProvisioningSupportEnabled; + } + + public LunSpace size(Long size) { + this.size = size; + return this; + } + + public Long getSize() { + return size; + } + + public void setSize(Long size) { + this.size = size; + } + + public Long getUsed() { + return used; + } + + public Long getPhysicalUsed() { + return physicalUsed; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LunSpace {\n"); + sb.append(" scsiThinProvisioningSupportEnabled: ").append(toIndentedString(scsiThinProvisioningSupportEnabled)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" used: ").append(toIndentedString(used)).append("\n"); + sb.append(" physicalUsed: ").append(toIndentedString(physicalUsed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} From 26b300c2b5a0baf8efe52bd60d325fcf63c00228 Mon Sep 17 00:00:00 2001 From: "Gupta, Surya" Date: Fri, 17 Oct 2025 15:16:45 +0530 Subject: [PATCH 2/3] CSTACKEX-30 Fixed check style issues --- .../storage/feign/model/LunMap.java | 23 ------------------- .../storage/feign/model/LunSpace.java | 4 ++-- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunMap.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunMap.java index a592a2909a93..4804a71e406d 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunMap.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunMap.java @@ -24,8 +24,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.google.gson.annotations.SerializedName; -import java.util.Objects; - @JsonInclude(JsonInclude.Include.NON_NULL) public class LunMap { @JsonProperty("igroup") @@ -90,27 +88,6 @@ public void setSvm (Svm svm) { this.svm = svm; } - - @Override - public boolean equals (Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - LunMap lunMap = (LunMap) o; - return Objects.equals(this.igroup, lunMap.igroup) && - Objects.equals(this.logicalUnitNumber, lunMap.logicalUnitNumber) && - Objects.equals(this.lun, lunMap.lun) && - Objects.equals(this.svm, lunMap.svm); - } - - @Override - public int hashCode () { - return Objects.hash(igroup, logicalUnitNumber, lun, svm); - } - @Override public String toString () { StringBuilder sb = new StringBuilder(); diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunSpace.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunSpace.java index 8acfceb2046c..d0956cd5366f 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunSpace.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/LunSpace.java @@ -69,9 +69,9 @@ public void setSize(Long size) { public Long getUsed() { return used; } - + public Long getPhysicalUsed() { - return physicalUsed; + return physicalUsed; } @Override From b08d9ec5b0b90b2f28ad0f90b1ff5a5e77b0bf72 Mon Sep 17 00:00:00 2001 From: "Gupta, Surya" Date: Wed, 22 Oct 2025 12:57:25 +0530 Subject: [PATCH 3/3] CSTACKEX-30 Fixed review comments --- .../cloudstack/storage/feign/model/Lun.java | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Lun.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Lun.java index b586a0dccb4b..d8f66106dd5c 100644 --- a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Lun.java +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Lun.java @@ -40,11 +40,7 @@ public class Lun { * The class of LUN.<br/> Optional in POST. */ public enum PropertyClassEnum { - REGULAR("regular"), - - PROTOCOL_ENDPOINT("protocol_endpoint"), - - VVOL("vvol"); + REGULAR("regular"); private String value; @@ -89,30 +85,14 @@ public static PropertyClassEnum fromValue(String value) { * The operating system type of the LUN.<br/> Required in POST when creating a LUN that is not a clone of another. Disallowed in POST when creating a LUN clone. */ public enum OsTypeEnum { - AIX("aix"), - - HPUX("hpux"), - HYPER_V("hyper_v"), LINUX("linux"), - NETWARE("netware"), - - OPENVMS("openvms"), - - SOLARIS("solaris"), - - SOLARIS_EFI("solaris_efi"), - VMWARE("vmware"), WINDOWS("windows"), - WINDOWS_2008("windows_2008"), - - WINDOWS_GPT("windows_gpt"), - XEN("xen"); private String value;