diff --git a/plugins/storage/volume/ontap/pom.xml b/plugins/storage/volume/ontap/pom.xml index decfb29743da..d538d555cb10 100644 --- a/plugins/storage/volume/ontap/pom.xml +++ b/plugins/storage/volume/ontap/pom.xml @@ -27,6 +27,25 @@ 4.22.0.0-SNAPSHOT ../../../pom.xml + + 2021.0.7 + 11.0 + 20230227 + 1.6.2 + 3.8.1 + 2.22.2 + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + org.apache.cloudstack @@ -36,18 +55,52 @@ org.json json - 20230227 + ${json.version} + + + org.springframework.cloud + spring-cloud-commons + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + org.springframework.security + spring-security-crypto + + + + + io.github.openfeign + feign-httpclient + ${openfeign.version} org.apache.cloudstack cloud-engine-storage-volume ${project.version} + + io.swagger + swagger-annotations + ${swagger-annotations.version} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 11 + 11 + + maven-surefire-plugin + ${maven-surefire-plugin.version} true diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/FeignConfiguration.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/FeignConfiguration.java new file mode 100644 index 000000000000..576c2dd1c1b4 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/FeignConfiguration.java @@ -0,0 +1,112 @@ +/* + * 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; + + +import feign.RequestInterceptor; +import feign.RequestTemplate; +import feign.Retryer; +import org.springframework.cloud.commons.httpclient.ApacheHttpClientFactory; +import org.apache.http.conn.ConnectionKeepAliveStrategy; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.TrustAllStrategy; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.ssl.SSLContexts; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import feign.Client; +import feign.httpclient.ApacheHttpClient; +import javax.net.ssl.SSLContext; +import java.util.concurrent.TimeUnit; + +@Configuration +public class FeignConfiguration { + private static Logger logger = LogManager.getLogger(FeignConfiguration.class); + + private int retryMaxAttempt = 3; + + private int retryMaxInterval = 5; + + private String ontapFeignMaxConnection = "80"; + + private String ontapFeignMaxConnectionPerRoute = "20"; + + @Bean + public Client client(ApacheHttpClientFactory httpClientFactory) { + + int maxConn; + int maxConnPerRoute; + try { + maxConn = Integer.parseInt(this.ontapFeignMaxConnection); + } catch (Exception e) { + logger.error("ontapFeignClient: encounter exception while parse the max connection from env. setting default value"); + maxConn = 20; + } + try { + maxConnPerRoute = Integer.parseInt(this.ontapFeignMaxConnectionPerRoute); + } catch (Exception e) { + logger.error("ontapFeignClient: encounter exception while parse the max connection per route from env. setting default value"); + maxConnPerRoute = 2; + } + // Disable Keep Alive for Http Connection + logger.debug("ontapFeignClient: Setting the feign client config values as max connection: {}, max connections per route: {}", maxConn, maxConnPerRoute); + ConnectionKeepAliveStrategy keepAliveStrategy = (response, context) -> 0; + CloseableHttpClient httpClient = httpClientFactory.createBuilder() + .setMaxConnTotal(maxConn) + .setMaxConnPerRoute(maxConnPerRoute) + .setKeepAliveStrategy(keepAliveStrategy) + .setSSLSocketFactory(getSSLSocketFactory()) + .setConnectionTimeToLive(60, TimeUnit.SECONDS) + .build(); + return new ApacheHttpClient(httpClient); + } + + private SSLConnectionSocketFactory getSSLSocketFactory() { + try { + // The TrustAllStrategy is a strategy used in SSL context configuration that accepts any certificate + SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, new TrustAllStrategy()).build(); + return new SSLConnectionSocketFactory(sslContext, new NoopHostnameVerifier()); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + + @Bean + public RequestInterceptor requestInterceptor() { + return new RequestInterceptor() { + @Override + public void apply(RequestTemplate template) { + logger.info("Feign Request URL: {}", template.url()); + logger.info("HTTP Method: {}", template.method()); + logger.info("Headers: {}", template.headers()); + logger.info("Body: {}", template.requestBody().asString()); + } + }; + } + + @Bean + public Retryer feignRetryer() { + return new Retryer.Default(1000L, retryMaxInterval * 1000L, retryMaxAttempt); + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/VolumeFeignClient.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/VolumeFeignClient.java new file mode 100644 index 000000000000..41f740c7d746 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/VolumeFeignClient.java @@ -0,0 +1,60 @@ +/* + * 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.FeignConfiguration; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; + + +@FeignClient(name = "VolumeClient", url = "https://{clusterIP}/api/storage/volumes", configuration = FeignConfiguration.class) +public interface VolumeFeignClient { + + @DeleteMapping("/storage/volumes/{id}") + void deleteVolume(@RequestHeader("Authorization") String authHeader, + @PathVariable("id") String volumeId); + + @PostMapping("/api/storage/volumes") + org.apache.cloudstack.storage.feign.model.response.JobResponseDTO createVolumeWithJob( + @RequestHeader("Authorization") String authHeader, + @RequestBody org.apache.cloudstack.storage.feign.model.request.VolumeRequestDTO request + ); + + @GetMapping("/api/storage/volumes/{uuid}") + org.apache.cloudstack.storage.feign.model.response.VolumeDetailsResponseDTO getVolumeDetails( + @RequestHeader("Authorization") String authHeader, + @PathVariable("uuid") String uuid + ); + + @PatchMapping("/api/storage/volumes/{uuid}") + org.apache.cloudstack.storage.feign.model.response.JobResponseDTO updateVolumeRebalancing( + @RequestHeader("accept") String acceptHeader, + @PathVariable("uuid") String uuid, + @RequestBody org.apache.cloudstack.storage.feign.model.request.VolumeRequestDTO request + ); + + +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Aggregate.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Aggregate.java new file mode 100644 index 000000000000..296cd2a2e4f7 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Aggregate.java @@ -0,0 +1,107 @@ +/* + * 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.google.gson.annotations.SerializedName; + +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Aggregate { + + @SerializedName("name") + private String name = null; + + @Override + public int hashCode() { + return Objects.hash(getName(), getUuid()); + } + + @SerializedName("uuid") + private String uuid = null; + + public Aggregate name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + **/ + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Aggregate uuid(String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * + * @return uuid + **/ + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Aggregate diskAggregates = (Aggregate) o; + return Objects.equals(this.name, diskAggregates.name) && + Objects.equals(this.uuid, diskAggregates.uuid); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + @Override + public String toString() { + return "DiskAggregates [name=" + name + ", uuid=" + uuid + "]"; + } + +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/AntiRansomware.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/AntiRansomware.java new file mode 100644 index 000000000000..21748dcd53ec --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/AntiRansomware.java @@ -0,0 +1,34 @@ +/* + * 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.JsonProperty; + +public class AntiRansomware { + @JsonProperty("state") + private String state; + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } +} 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 new file mode 100644 index 000000000000..489ecb3d4087 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/ExportPolicy.java @@ -0,0 +1,45 @@ +/* + * 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 java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ExportPolicy { + private String name; + private long id; + public String getName() { return name; } + public void setName(String name) { this.name = name; } + public long getId() { return id; } + public void setId(long id) { this.id = id; } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) return false; + ExportPolicy that = (ExportPolicy) o; + return getId() == that.getId(); + } + + @Override + public int hashCode() { + return Objects.hashCode(getId()); + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Nas.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Nas.java new file mode 100644 index 000000000000..5fdd1f772f0f --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Nas.java @@ -0,0 +1,49 @@ +/* + * 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 Nas { + @JsonProperty("path") + private String path; + + @JsonProperty("export_policy") + private ExportPolicy exportPolicy; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public ExportPolicy getExportPolicy() { + return exportPolicy; + } + + public void setExportPolicy(ExportPolicy exportPolicy) { + this.exportPolicy = exportPolicy; + } + + +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Policy.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Policy.java new file mode 100644 index 000000000000..82ba149bd040 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Policy.java @@ -0,0 +1,58 @@ +/* + * 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 java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Policy { + private int minThroughputIops; + private int minThroughputMbps; + private int maxThroughputIops; + private int maxThroughputMbps; + private String uuid; + private String name; + public int getMinThroughputIops() { return minThroughputIops; } + public void setMinThroughputIops(int minThroughputIops) { this.minThroughputIops = minThroughputIops; } + public int getMinThroughputMbps() { return minThroughputMbps; } + public void setMinThroughputMbps(int minThroughputMbps) { this.minThroughputMbps = minThroughputMbps; } + public int getMaxThroughputIops() { return maxThroughputIops; } + public void setMaxThroughputIops(int maxThroughputIops) { this.maxThroughputIops = maxThroughputIops; } + public int getMaxThroughputMbps() { return maxThroughputMbps; } + public void setMaxThroughputMbps(int maxThroughputMbps) { this.maxThroughputMbps = maxThroughputMbps; } + public String getUuid() { return uuid; } + public void setUuid(String uuid) { this.uuid = uuid; } + public String getName() { return name; } + public void setName(String name) { this.name = name; } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) return false; + Policy policy = (Policy) o; + return Objects.equals(getUuid(), policy.getUuid()); + } + + @Override + public int hashCode() { + return Objects.hashCode(getUuid()); + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Qos.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Qos.java new file mode 100644 index 000000000000..ccc230c6ea53 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Qos.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 Qos { + @JsonProperty("policy") + private Policy policy; + + public Policy getPolicy() { + return policy; + } + + public void setPolicy(Policy policy) { + this.policy = policy; + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Svm.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Svm.java new file mode 100644 index 000000000000..b4d5943eefda --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Svm.java @@ -0,0 +1,138 @@ +/* + * 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.List; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Svm { + @JsonProperty("uuid") + @SerializedName("uuid") + private String uuid = null; + + @JsonProperty("name") + @SerializedName("name") + private String name = null; + + @JsonProperty("iscsi.enabled") + @SerializedName("iscsi.enabled") + private Boolean iscsiEnabled = null; + + @JsonProperty("fcp.enabled") + @SerializedName("fcp.enabled") + private Boolean fcpEnabled = null; + + @JsonProperty("nfs.enabled") + @SerializedName("nfs.enabled") + private Boolean nfsEnabled = null; + + @JsonProperty("aggregates") + @SerializedName("aggregates") + private List aggregates = null; + + @JsonProperty("aggregates_delegated") + @SerializedName("aggregates_delegated") + private Boolean aggregatesDelegated = null; + + @JsonProperty("state.value") + @SerializedName("state.value") + private String state = null; + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Boolean getIscsiEnabled() { + return iscsiEnabled; + } + + public void setIscsiEnabled(Boolean iscsiEnabled) { + this.iscsiEnabled = iscsiEnabled; + } + + public Boolean getFcpEnabled() { + return fcpEnabled; + } + + public void setFcpEnabled(Boolean fcpEnabled) { + this.fcpEnabled = fcpEnabled; + } + + public Boolean getNfsEnabled() { + return nfsEnabled; + } + + public void setNfsEnabled(Boolean nfsEnabled) { + this.nfsEnabled = nfsEnabled; + } + + public List getAggregates() { + return aggregates; + } + + public void setAggregates(List aggregates) { + this.aggregates = aggregates; + } + + public Boolean getAggregatesDelegated() { + return aggregatesDelegated; + } + + public void setAggregatesDelegated(Boolean aggregatesDelegated) { + this.aggregatesDelegated = aggregatesDelegated; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) return false; + Svm svm = (Svm) o; + return Objects.equals(getUuid(), svm.getUuid()); + } + + @Override + public int hashCode() { + return Objects.hashCode(getUuid()); + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Volume.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Volume.java new file mode 100644 index 000000000000..73d11312bc0e --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/Volume.java @@ -0,0 +1,125 @@ +/* + * 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.Objects; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Volume { + @JsonProperty("uuid") + private String uuid; + + @JsonProperty("name") + private String name; + + @JsonProperty("state") + private String state; + + @JsonProperty("nas") + private Nas nas; + + @JsonProperty("svm") + private Svm svm; + + @JsonProperty("qos") + private Qos qos; + + @JsonProperty("space") + private VolumeSpace space; + + @JsonProperty("anti_ransomware") + private AntiRansomware antiRansomware; + + // Getters and setters + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public Nas getNas() { + return nas; + } + + public void setNas(Nas nas) { + this.nas = nas; + } + + public Svm getSvm() { + return svm; + } + + public void setSvm(Svm svm) { + this.svm = svm; + } + + public Qos getQos() { + return qos; + } + + public void setQos(Qos qos) { + this.qos = qos; + } + + public VolumeSpace getSpace() { + return space; + } + + public void setSpace(VolumeSpace space) { + this.space = space; + } + + public AntiRansomware getAntiRansomware() { + return antiRansomware; + } + + public void setAntiRansomware(AntiRansomware antiRansomware) { + this.antiRansomware = antiRansomware; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) return false; + Volume volume = (Volume) o; + return Objects.equals(uuid, volume.uuid); + } + + @Override + public int hashCode() { + return Objects.hashCode(uuid); + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/VolumeQosPolicy.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/VolumeQosPolicy.java new file mode 100644 index 000000000000..313edac55314 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/VolumeQosPolicy.java @@ -0,0 +1,87 @@ +/* + * 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; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class VolumeQosPolicy { + @JsonProperty("max_throughput_iops") + @SerializedName("max_throughput_iops") + private Integer maxThroughputIops = null; + + @JsonProperty("max_throughput_mbps") + @SerializedName("max_throughput_mbps") + private Integer maxThroughputMbps = null; + + @JsonProperty("min_throughput_iops") + @SerializedName("min_throughput_iops") + private Integer minThroughputIops = null; + + @JsonProperty("name") + @SerializedName("name") + private String name = null; + + @JsonProperty("uuid") + @SerializedName("uuid") + private String uuid = null; + + public Integer getMaxThroughputIops() { + return maxThroughputIops; + } + + public void setMaxThroughputIops(Integer maxThroughputIops) { + this.maxThroughputIops = maxThroughputIops; + } + + public Integer getMaxThroughputMbps() { + return maxThroughputMbps; + } + + public void setMaxThroughputMbps(Integer maxThroughputMbps) { + this.maxThroughputMbps = maxThroughputMbps; + } + + public Integer getMinThroughputIops() { + return minThroughputIops; + } + + public void setMinThroughputIops(Integer minThroughputIops) { + this.minThroughputIops = minThroughputIops; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/VolumeSpace.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/VolumeSpace.java new file mode 100644 index 000000000000..067997fcd440 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/VolumeSpace.java @@ -0,0 +1,59 @@ +/* + * 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 VolumeSpace { + @JsonProperty("size") + private long size; + + @JsonProperty("available") + private long available; + + @JsonProperty("used") + private long used; + + public long getSize() { + return size; + } + + public void setSize(long size) { + this.size = size; + } + + public long getAvailable() { + return available; + } + + public void setAvailable(long available) { + this.available = available; + } + + public long getUsed() { + return used; + } + + public void setUsed(long used) { + this.used = used; + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/VolumeSpaceLogicalSpace.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/VolumeSpaceLogicalSpace.java new file mode 100644 index 000000000000..b27840bf3c3d --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/VolumeSpaceLogicalSpace.java @@ -0,0 +1,52 @@ +/* + * 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; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class VolumeSpaceLogicalSpace { + + @JsonProperty("available") + @SerializedName("available") + private Long available = null; + + @JsonProperty("used") + @SerializedName("used") + private Double used = null; + + public Long getAvailable() { + return available; + } + + public void setAvailable(Long available) { + this.available = available; + } + + public Double getUsed() { + return used; + } + + public void setUsed(Double used) { + this.used = used; + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/request/VolumeRequestDTO.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/request/VolumeRequestDTO.java new file mode 100644 index 000000000000..7f758211fe86 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/request/VolumeRequestDTO.java @@ -0,0 +1,47 @@ +/* + * 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.request; + +import java.util.List; + +public class VolumeRequestDTO { + private String name; + private List aggregates; + private SvmDTO svm; + + // getters and setters + public String getName() { return name; } + public void setName(String name) { this.name = name; } + public List getAggregates() { return aggregates; } + public void setAggregates(List aggregates) { this.aggregates = aggregates; } + public SvmDTO getSvm() { return svm; } + public void setSvm(SvmDTO svm) { this.svm = svm; } + + public static class AggregateDTO { + private String name; + public String getName() { return name; } + public void setName(String name) { this.name = name; } + } + + public static class SvmDTO { + private String name; + 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/response/JobResponseDTO.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/JobResponseDTO.java new file mode 100644 index 000000000000..b90806c63420 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/JobResponseDTO.java @@ -0,0 +1,46 @@ +/* + * 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.response; + +public class JobResponseDTO { + private Job job; + public Job getJob() { return job; } + public void setJob(Job job) { this.job = job; } + + public static class Job { + private String uuid; + private Links links; + public String getUuid() { return uuid; } + public void setUuid(String uuid) { this.uuid = uuid; } + public Links getLinks() { return links; } + public void setLinks(Links links) { this.links = links; } + } + + public static class Links { + private Self self; + public Self getSelf() { return self; } + public void setSelf(Self self) { this.self = self; } + } + + public static class Self { + private String href; + public String getHref() { return href; } + public void setHref(String href) { this.href = href; } + } +} diff --git a/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/VolumeDetailsResponseDTO.java b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/VolumeDetailsResponseDTO.java new file mode 100644 index 000000000000..e7016dbc6801 --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/response/VolumeDetailsResponseDTO.java @@ -0,0 +1,73 @@ +/* + * 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.response; + + +import org.apache.cloudstack.storage.feign.model.Aggregate; +import org.apache.cloudstack.storage.feign.model.Nas; +import org.apache.cloudstack.storage.feign.model.Qos; + +import java.util.List; + +public class VolumeDetailsResponseDTO { + private String uuid; + private String createTime; + private String name; + private long size; + private String state; + private String style; + private List aggregates; + private Nas nas; + private Qos qos; + private Svm svm; + private String antiRansomwareState; + + // getters and setters + public String getUuid() { return uuid; } + public void setUuid(String uuid) { this.uuid = uuid; } + public String getCreateTime() { return createTime; } + public void setCreateTime(String createTime) { this.createTime = createTime; } + public String getName() { return name; } + public void setName(String name) { this.name = name; } + public long getSize() { return size; } + public void setSize(long size) { this.size = size; } + public String getState() { return state; } + public void setState(String state) { this.state = state; } + public String getStyle() { return style; } + public void setStyle(String style) { this.style = style; } + public List getAggregates() { return aggregates; } + public void setAggregates(List aggregates) { this.aggregates = aggregates; } + public Nas getNas() { return nas; } + public void setNas(Nas nas) { this.nas = nas; } + public Qos getQos() { return qos; } + public void setQos(Qos qos) { this.qos = qos; } + public Svm getSvm() { return svm; } + public void setSvm(Svm svm) { this.svm = svm; } + public String getAntiRansomwareState() { return antiRansomwareState; } + public void setAntiRansomwareState(String antiRansomwareState) { this.antiRansomwareState = antiRansomwareState; } + + public static class Svm { + private String name; + private String uuid; + public String getName() { return name; } + public void setName(String name) { this.name = name; } + public String getUuid() { return uuid; } + public void setUuid(String uuid) { this.uuid = uuid; } + } +} diff --git a/plugins/storage/volume/ontap/src/main/resources/META-INF/cloudstack/storage-volume-ontap/logback-spring.xml b/plugins/storage/volume/ontap/src/main/resources/META-INF/cloudstack/storage-volume-ontap/logback-spring.xml new file mode 100644 index 000000000000..15872c82a64e --- /dev/null +++ b/plugins/storage/volume/ontap/src/main/resources/META-INF/cloudstack/storage-volume-ontap/logback-spring.xml @@ -0,0 +1,45 @@ + + + + + + + logs/feign-requests.log + + logs/feign-requests.%d{yyyy-MM-dd}.log + 30 + + + %d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n + + + + + + + + + + + + + +