Skip to content

Commit 4c8c8d9

Browse files
Jain, RajivJain, Rajiv
authored andcommitted
Initial primary storage pool plugin skeleton
1 parent 3159fa7 commit 4c8c8d9

File tree

8 files changed

+468
-0
lines changed

8 files changed

+468
-0
lines changed

client/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@
121121
<artifactId>cloud-plugin-storage-volume-adaptive</artifactId>
122122
<version>${project.version}</version>
123123
</dependency>
124+
<dependency>
125+
<groupId>org.apache.cloudstack</groupId>
126+
<artifactId>cloud-plugin-storage-volume-ontap</artifactId>
127+
<version>${project.version}</version>
128+
</dependency>
124129
<dependency>
125130
<groupId>org.apache.cloudstack</groupId>
126131
<artifactId>cloud-plugin-storage-volume-solidfire</artifactId>

plugins/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
<module>storage/volume/default</module>
130130
<module>storage/volume/nexenta</module>
131131
<module>storage/volume/sample</module>
132+
<module>storage/volume/ontap</module>
132133
<module>storage/volume/solidfire</module>
133134
<module>storage/volume/scaleio</module>
134135
<module>storage/volume/linstor</module>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21+
<modelVersion>4.0.0</modelVersion>
22+
<artifactId>cloud-plugin-storage-volume-ontap</artifactId>
23+
<name>Apache CloudStack Plugin - Storage Volume ONTAP Provider</name>
24+
<parent>
25+
<groupId>org.apache.cloudstack</groupId>
26+
<artifactId>cloudstack-plugins</artifactId>
27+
<version>4.22.0.0-SNAPSHOT</version>
28+
<relativePath>../../../pom.xml</relativePath>
29+
</parent>
30+
<dependencies>
31+
<dependency>
32+
<groupId>org.apache.cloudstack</groupId>
33+
<artifactId>cloud-plugin-storage-volume-default</artifactId>
34+
<version>${project.version}</version>
35+
</dependency>
36+
<dependency>
37+
<groupId>org.json</groupId>
38+
<artifactId>json</artifactId>
39+
<version>20230227</version>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.apache.cloudstack</groupId>
43+
<artifactId>cloud-engine-storage-volume</artifactId>
44+
<version>${project.version}</version>
45+
</dependency>
46+
</dependencies>
47+
<build>
48+
<plugins>
49+
<plugin>
50+
<artifactId>maven-surefire-plugin</artifactId>
51+
<configuration>
52+
<skipTests>true</skipTests>
53+
</configuration>
54+
<executions>
55+
<execution>
56+
<phase>integration-test</phase>
57+
<goals>
58+
<goal>test</goal>
59+
</goals>
60+
</execution>
61+
</executions>
62+
</plugin>
63+
</plugins>
64+
</build>
65+
</project>
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
package org.apache.cloudstack.storage.driver;
2+
3+
4+
import com.cloud.agent.api.to.DataStoreTO;
5+
import com.cloud.agent.api.to.DataTO;
6+
import com.cloud.host.Host;
7+
import com.cloud.storage.Storage;
8+
import com.cloud.storage.StoragePool;
9+
import com.cloud.storage.Volume;
10+
import com.cloud.utils.Pair;
11+
import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
12+
import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
13+
import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
14+
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
15+
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
16+
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreCapabilities;
17+
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
18+
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
19+
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
20+
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
21+
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
22+
import org.apache.cloudstack.storage.command.CommandResult;
23+
import org.apache.logging.log4j.LogManager;
24+
import org.apache.logging.log4j.Logger;
25+
import org.springframework.stereotype.Component;
26+
27+
import java.util.HashMap;
28+
import java.util.Map;
29+
30+
@Component
31+
public class OntapPrimaryDatastoreDriver implements PrimaryDataStoreDriver {
32+
33+
private static final Logger s_logger = (Logger)LogManager.getLogger(OntapPrimaryDatastoreDriver.class);
34+
@Override
35+
public Map<String, String> getCapabilities() {
36+
s_logger.trace("OntapPrimaryDatastoreDriver: getCapabilities: Called");
37+
Map<String, String> mapCapabilities = new HashMap<>();
38+
39+
mapCapabilities.put(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString(), Boolean.TRUE.toString());
40+
mapCapabilities.put(DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_SNAPSHOT.toString(), Boolean.TRUE.toString());
41+
42+
return mapCapabilities;
43+
}
44+
45+
@Override
46+
public DataTO getTO(DataObject data) {
47+
return null;
48+
}
49+
50+
@Override
51+
public DataStoreTO getStoreTO(DataStore store) {
52+
return null;
53+
}
54+
55+
@Override
56+
public void createAsync(DataStore store, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
57+
58+
s_logger.trace("OntapPrimaryDatastoreDriver: createAsync: Store: "+store+", data: "+data);
59+
}
60+
61+
@Override
62+
public void deleteAsync(DataStore store, DataObject data, AsyncCompletionCallback<CommandResult> callback) {
63+
64+
}
65+
66+
@Override
67+
public void copyAsync(DataObject srcData, DataObject destData, AsyncCompletionCallback<CopyCommandResult> callback) {
68+
69+
}
70+
71+
@Override
72+
public void copyAsync(DataObject srcData, DataObject destData, Host destHost, AsyncCompletionCallback<CopyCommandResult> callback) {
73+
74+
}
75+
76+
@Override
77+
public boolean canCopy(DataObject srcData, DataObject destData) {
78+
return false;
79+
}
80+
81+
@Override
82+
public void resize(DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
83+
84+
}
85+
86+
@Override
87+
public ChapInfo getChapInfo(DataObject dataObject) {
88+
return null;
89+
}
90+
91+
@Override
92+
public boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore) {
93+
return true;
94+
}
95+
96+
@Override
97+
public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore) {
98+
99+
}
100+
101+
@Override
102+
public long getDataObjectSizeIncludingHypervisorSnapshotReserve(DataObject dataObject, StoragePool storagePool) {
103+
return 0;
104+
}
105+
106+
@Override
107+
public long getBytesRequiredForTemplate(TemplateInfo templateInfo, StoragePool storagePool) {
108+
return 0;
109+
}
110+
111+
@Override
112+
public long getUsedBytes(StoragePool storagePool) {
113+
return 0;
114+
}
115+
116+
@Override
117+
public long getUsedIops(StoragePool storagePool) {
118+
return 0;
119+
}
120+
121+
@Override
122+
public void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CreateCmdResult> callback) {
123+
124+
}
125+
126+
@Override
127+
public void revertSnapshot(SnapshotInfo snapshotOnImageStore, SnapshotInfo snapshotOnPrimaryStore, AsyncCompletionCallback<CommandResult> callback) {
128+
129+
}
130+
131+
@Override
132+
public void handleQualityOfServiceForVolumeMigration(VolumeInfo volumeInfo, QualityOfServiceState qualityOfServiceState) {
133+
134+
}
135+
136+
@Override
137+
public boolean canProvideStorageStats() {
138+
return true;
139+
}
140+
141+
@Override
142+
public Pair<Long, Long> getStorageStats(StoragePool storagePool) {
143+
return null;
144+
}
145+
146+
@Override
147+
public boolean canProvideVolumeStats() {
148+
return true;
149+
}
150+
151+
@Override
152+
public Pair<Long, Long> getVolumeStats(StoragePool storagePool, String volumeId) {
153+
return null;
154+
}
155+
156+
@Override
157+
public boolean canHostAccessStoragePool(Host host, StoragePool pool) {
158+
return true;
159+
}
160+
161+
@Override
162+
public boolean isVmInfoNeeded() {
163+
return true;
164+
}
165+
166+
@Override
167+
public void provideVmInfo(long vmId, long volumeId) {
168+
169+
}
170+
171+
@Override
172+
public boolean isVmTagsNeeded(String tagKey) {
173+
return true;
174+
}
175+
176+
@Override
177+
public void provideVmTags(long vmId, long volumeId, String tagValue) {
178+
179+
}
180+
181+
@Override
182+
public boolean isStorageSupportHA(Storage.StoragePoolType type) {
183+
return true;
184+
}
185+
186+
@Override
187+
public void detachVolumeFromAllStorageNodes(Volume volume) {
188+
189+
}
190+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package org.apache.cloudstack.storage.lifecycle;
2+
3+
4+
import com.cloud.agent.api.StoragePoolInfo;
5+
import com.cloud.hypervisor.Hypervisor;
6+
import com.cloud.storage.StoragePool;
7+
import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
8+
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
9+
import org.apache.cloudstack.engine.subsystem.api.storage.HostScope;
10+
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle;
11+
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
12+
import org.apache.logging.log4j.LogManager;
13+
import org.apache.logging.log4j.Logger;
14+
import java.util.Map;
15+
16+
public class OntapPrimaryDatastoreLifecycle implements PrimaryDataStoreLifeCycle {
17+
18+
private static final Logger s_logger = (Logger)LogManager.getLogger(OntapPrimaryDatastoreLifecycle.class);
19+
20+
/**
21+
* Creates primary storage on NetApp storage
22+
* @param dsInfos
23+
* @return
24+
*/
25+
@Override
26+
public DataStore initialize(Map<String, Object> dsInfos) {
27+
28+
return null;
29+
30+
}
31+
32+
@Override
33+
public boolean attachCluster(DataStore store, ClusterScope scope) {
34+
return false;
35+
}
36+
37+
@Override
38+
public boolean attachHost(DataStore store, HostScope scope, StoragePoolInfo existingInfo) {
39+
return false;
40+
}
41+
42+
@Override
43+
public boolean attachZone(DataStore dataStore, ZoneScope scope, Hypervisor.HypervisorType hypervisorType) {
44+
return false;
45+
}
46+
47+
@Override
48+
public boolean maintain(DataStore store) {
49+
return true;
50+
}
51+
52+
@Override
53+
public boolean cancelMaintain(DataStore store) {
54+
return true;
55+
}
56+
57+
@Override
58+
public boolean deleteDataStore(DataStore store) {
59+
return true;
60+
}
61+
62+
@Override
63+
public boolean migrateToObjectStore(DataStore store) {
64+
return true;
65+
}
66+
67+
@Override
68+
public void updateStoragePool(StoragePool storagePool, Map<String, String> details) {
69+
70+
}
71+
72+
@Override
73+
public void enableStoragePool(DataStore store) {
74+
75+
}
76+
77+
@Override
78+
public void disableStoragePool(DataStore store) {
79+
80+
}
81+
82+
@Override
83+
public void changeStoragePoolScopeToZone(DataStore store, ClusterScope clusterScope, Hypervisor.HypervisorType hypervisorType) {
84+
85+
}
86+
87+
@Override
88+
public void changeStoragePoolScopeToCluster(DataStore store, ClusterScope clusterScope, Hypervisor.HypervisorType hypervisorType) {
89+
90+
}
91+
}

0 commit comments

Comments
 (0)