Skip to content

Commit 758e8e2

Browse files
Locharla, SandeepRajiv Jain
authored andcommitted
Create & Delete, Enable & Disable, Enter & Cancel maintenance of Primary StoragePool with ONTAP storage
Co-authored-by: Sandeep Locharla <Sandeep.Locharla@netapp.com> Co-authored-by: Rajiv Jain <Rajiv.Jain@netapp.com> Co-authored-by: Piyush Srivastava piyush5@netapp.com Co-authored-by: Surya Gupta suryag@netapp.com
1 parent ea40967 commit 758e8e2

20 files changed

Lines changed: 431 additions & 2747 deletions

File tree

plugins/storage/volume/ontap/pom.xml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
3737
<jackson-databind.version>2.13.4</jackson-databind.version>
3838
<assertj.version>3.24.2</assertj.version>
39+
<junit-jupiter.version>5.8.1</junit-jupiter.version>
40+
<mockito.version>3.12.4</mockito.version>
41+
<mockito-junit-jupiter.version>5.2.0</mockito-junit-jupiter.version>
3942
</properties>
4043
<dependencyManagement>
4144
<dependencies>
@@ -84,16 +87,6 @@
8487
<artifactId>cloud-engine-storage-volume</artifactId>
8588
<version>${project.version}</version>
8689
</dependency>
87-
<dependency>
88-
<groupId>org.apache.cloudstack</groupId>
89-
<artifactId>cloud-engine-storage-snapshot</artifactId>
90-
<version>${project.version}</version>
91-
</dependency>
92-
<dependency>
93-
<groupId>org.apache.cloudstack</groupId>
94-
<artifactId>cloud-server</artifactId>
95-
<version>${project.version}</version>
96-
</dependency>
9790
<dependency>
9891
<groupId>io.swagger</groupId>
9992
<artifactId>swagger-annotations</artifactId>
@@ -103,29 +96,29 @@
10396
<dependency>
10497
<groupId>org.junit.jupiter</groupId>
10598
<artifactId>junit-jupiter-engine</artifactId>
106-
<version>5.8.1</version>
99+
<version>${junit-jupiter.version}</version>
107100
<scope>test</scope>
108101
</dependency>
109102

110103
<!-- Mockito -->
111104
<dependency>
112105
<groupId>org.mockito</groupId>
113106
<artifactId>mockito-core</artifactId>
114-
<version>3.12.4</version>
107+
<version>${mockito.version}</version>
115108
<scope>test</scope>
116109
</dependency>
117110
<dependency>
118111
<groupId>org.mockito</groupId>
119112
<artifactId>mockito-junit-jupiter</artifactId>
120-
<version>5.2.0</version>
113+
<version>${mockito-junit-jupiter.version}</version>
121114
<scope>test</scope>
122115
</dependency>
123116

124117
<!-- Mockito Inline (for static method mocking) -->
125118
<dependency>
126119
<groupId>org.mockito</groupId>
127120
<artifactId>mockito-inline</artifactId>
128-
<version>3.12.4</version>
121+
<version>${mockito.version}</version>
129122
<scope>test</scope>
130123
</dependency>
131124
<dependency>

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java

Lines changed: 18 additions & 883 deletions
Large diffs are not rendered by default.

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/NASFeignClient.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121

2222
import feign.QueryMap;
2323
import org.apache.cloudstack.storage.feign.model.ExportPolicy;
24-
import org.apache.cloudstack.storage.feign.model.FileClone;
2524
import org.apache.cloudstack.storage.feign.model.FileInfo;
26-
import org.apache.cloudstack.storage.feign.model.response.JobResponse;
2725
import org.apache.cloudstack.storage.feign.model.response.OntapResponse;
2826
import feign.Headers;
2927
import feign.Param;
@@ -34,7 +32,7 @@
3432
public interface NASFeignClient {
3533

3634
// File Operations
37-
@RequestLine("GET /api/storage/volumes/{volumeUuid}/files/{path}?return_metadata=true")
35+
@RequestLine("GET /api/storage/volumes/{volumeUuid}/files/{path}")
3836
@Headers({"Authorization: {authHeader}"})
3937
OntapResponse<FileInfo> getFileResponse(@Param("authHeader") String authHeader,
4038
@Param("volumeUuid") String volumeUUID,
@@ -60,11 +58,6 @@ void createFile(@Param("authHeader") String authHeader,
6058
@Param("path") String filePath,
6159
FileInfo file);
6260

63-
@RequestLine("POST /api/storage/file/clone")
64-
@Headers({"Authorization: {authHeader}"})
65-
JobResponse cloneFile(@Param("authHeader") String authHeader,
66-
FileClone fileClone);
67-
6861
// Export Policy Operations
6962
@RequestLine("POST /api/protocols/nfs/export-policies")
7063
@Headers({"Authorization: {authHeader}"})

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/client/SANFeignClient.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,12 @@
2323
import org.apache.cloudstack.storage.feign.model.IscsiService;
2424
import org.apache.cloudstack.storage.feign.model.Lun;
2525
import org.apache.cloudstack.storage.feign.model.LunMap;
26-
import org.apache.cloudstack.storage.feign.model.LunRestoreRequest;
27-
import org.apache.cloudstack.storage.feign.model.response.JobResponse;
2826
import org.apache.cloudstack.storage.feign.model.response.OntapResponse;
2927
import feign.Headers;
3028
import feign.Param;
3129
import feign.RequestLine;
3230
import java.util.Map;
3331

34-
//TODO: Proper URLs should be added in the RequestLine annotations below
3532
public interface SANFeignClient {
3633
// iSCSI Service APIs
3734
@RequestLine("GET /api/protocols/san/iscsi/services")
@@ -91,24 +88,4 @@ public interface SANFeignClient {
9188
void deleteLunMap(@Param("authHeader") String authHeader,
9289
@Param("lunUuid") String lunUUID,
9390
@Param("igroupUuid") String igroupUUID);
94-
95-
// LUN Restore API
96-
/**
97-
* Restores a LUN from a FlexVolume snapshot.
98-
*
99-
* <p>ONTAP REST: {@code POST /api/storage/luns/{lun.uuid}/restore}</p>
100-
*
101-
* <p>This API restores the LUN data from a specified snapshot to a destination path.
102-
* The LUN must exist and the snapshot must contain the LUN data.</p>
103-
*
104-
* @param authHeader Basic auth header
105-
* @param lunUuid UUID of the LUN to restore
106-
* @param request Request body with snapshot name and destination path
107-
* @return JobResponse containing the async job reference
108-
*/
109-
@RequestLine("POST /api/storage/luns/{lunUuid}/restore")
110-
@Headers({"Authorization: {authHeader}", "Content-Type: application/json"})
111-
JobResponse restoreLun(@Param("authHeader") String authHeader,
112-
@Param("lunUuid") String lunUuid,
113-
LunRestoreRequest request);
11491
}

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/FileInfo.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.fasterxml.jackson.annotation.JsonProperty;
2626
import com.fasterxml.jackson.annotation.JsonValue;
2727

28+
import java.time.OffsetDateTime;
2829
import java.util.Objects;
2930

3031
/**
@@ -35,6 +36,8 @@
3536
public class FileInfo {
3637
@JsonProperty("bytes_used")
3738
private Long bytesUsed = null;
39+
@JsonProperty("creation_time")
40+
private OffsetDateTime creationTime = null;
3841
@JsonProperty("fill_enabled")
3942
private Boolean fillEnabled = null;
4043
@JsonProperty("is_empty")
@@ -43,6 +46,8 @@ public class FileInfo {
4346
private Boolean isSnapshot = null;
4447
@JsonProperty("is_vm_aligned")
4548
private Boolean isVmAligned = null;
49+
@JsonProperty("modified_time")
50+
private OffsetDateTime modifiedTime = null;
4651
@JsonProperty("name")
4752
private String name = null;
4853
@JsonProperty("overwrite_enabled")
@@ -105,6 +110,10 @@ public Long getBytesUsed() {
105110
return bytesUsed;
106111
}
107112

113+
public OffsetDateTime getCreationTime() {
114+
return creationTime;
115+
}
116+
108117
public FileInfo fillEnabled(Boolean fillEnabled) {
109118
this.fillEnabled = fillEnabled;
110119
return this;
@@ -140,6 +149,11 @@ public Boolean isIsVmAligned() {
140149
return isVmAligned;
141150
}
142151

152+
153+
public OffsetDateTime getModifiedTime() {
154+
return modifiedTime;
155+
}
156+
143157
public FileInfo name(String name) {
144158
this.name = name;
145159
return this;
@@ -252,10 +266,12 @@ public String toString() {
252266
StringBuilder sb = new StringBuilder();
253267
sb.append("class FileInfo {\n");
254268
sb.append(" bytesUsed: ").append(toIndentedString(bytesUsed)).append("\n");
269+
sb.append(" creationTime: ").append(toIndentedString(creationTime)).append("\n");
255270
sb.append(" fillEnabled: ").append(toIndentedString(fillEnabled)).append("\n");
256271
sb.append(" isEmpty: ").append(toIndentedString(isEmpty)).append("\n");
257272
sb.append(" isSnapshot: ").append(toIndentedString(isSnapshot)).append("\n");
258273
sb.append(" isVmAligned: ").append(toIndentedString(isVmAligned)).append("\n");
274+
sb.append(" modifiedTime: ").append(toIndentedString(modifiedTime)).append("\n");
259275
sb.append(" name: ").append(toIndentedString(name)).append("\n");
260276
sb.append(" overwriteEnabled: ").append(toIndentedString(overwriteEnabled)).append("\n");
261277
sb.append(" path: ").append(toIndentedString(path)).append("\n");

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/feign/model/OntapStorage.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@
2424
public class OntapStorage {
2525
private final String username;
2626
private final String password;
27-
private final String storageIP;
27+
private final String managementLIF;
2828
private final String svmName;
2929
private final Long size;
3030
private final ProtocolType protocolType;
31+
private final Boolean isDisaggregated;
3132

32-
public OntapStorage(String username, String password, String storageIP, String svmName, Long size, ProtocolType protocolType) {
33+
public OntapStorage(String username, String password, String managementLIF, String svmName, Long size, ProtocolType protocolType, Boolean isDisaggregated) {
3334
this.username = username;
3435
this.password = password;
35-
this.storageIP = storageIP;
36+
this.managementLIF = managementLIF;
3637
this.svmName = svmName;
3738
this.size = size;
3839
this.protocolType = protocolType;
40+
this.isDisaggregated = isDisaggregated;
3941
}
4042

4143
public String getUsername() {
@@ -46,9 +48,13 @@ public String getPassword() {
4648
return password;
4749
}
4850

49-
public String getStorageIP() { return storageIP; }
51+
public String getManagementLIF() {
52+
return managementLIF;
53+
}
5054

51-
public String getSvmName() { return svmName; }
55+
public String getSvmName() {
56+
return svmName;
57+
}
5258

5359
public Long getSize() {
5460
return size;
@@ -57,4 +63,8 @@ public Long getSize() {
5763
public ProtocolType getProtocol() {
5864
return protocolType;
5965
}
66+
67+
public Boolean getIsDisaggregated() {
68+
return isDisaggregated;
69+
}
6070
}

0 commit comments

Comments
 (0)