Skip to content

Commit ebc3f00

Browse files
Merge pull request #1 from NetApp/feature-CSTACKEX-24
Initial primary storage pool plugin skeleton
2 parents 6089c16 + 1199d55 commit ebc3f00

File tree

8 files changed

+523
-0
lines changed

8 files changed

+523
-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: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
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+
package org.apache.cloudstack.storage.driver;
20+
21+
import com.cloud.agent.api.to.DataStoreTO;
22+
import com.cloud.agent.api.to.DataTO;
23+
import com.cloud.host.Host;
24+
import com.cloud.storage.Storage;
25+
import com.cloud.storage.StoragePool;
26+
import com.cloud.storage.Volume;
27+
import com.cloud.utils.Pair;
28+
import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
29+
import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
30+
import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
31+
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
32+
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
33+
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreCapabilities;
34+
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
35+
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
36+
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
37+
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
38+
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
39+
import org.apache.cloudstack.storage.command.CommandResult;
40+
import org.apache.logging.log4j.LogManager;
41+
import org.apache.logging.log4j.Logger;
42+
import org.springframework.stereotype.Component;
43+
44+
import java.util.HashMap;
45+
import java.util.Map;
46+
47+
@Component
48+
public class OntapPrimaryDatastoreDriver implements PrimaryDataStoreDriver {
49+
50+
private static final Logger s_logger = (Logger)LogManager.getLogger(OntapPrimaryDatastoreDriver.class);
51+
@Override
52+
public Map<String, String> getCapabilities() {
53+
s_logger.trace("OntapPrimaryDatastoreDriver: getCapabilities: Called");
54+
Map<String, String> mapCapabilities = new HashMap<>();
55+
56+
mapCapabilities.put(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString(), Boolean.TRUE.toString());
57+
mapCapabilities.put(DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_SNAPSHOT.toString(), Boolean.TRUE.toString());
58+
59+
return mapCapabilities;
60+
}
61+
62+
@Override
63+
public DataTO getTO(DataObject data) {
64+
return null;
65+
}
66+
67+
@Override
68+
public DataStoreTO getStoreTO(DataStore store) {
69+
return null;
70+
}
71+
72+
@Override
73+
public void createAsync(DataStore store, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
74+
75+
s_logger.trace("OntapPrimaryDatastoreDriver: createAsync: Store: "+store+", data: "+data);
76+
}
77+
78+
@Override
79+
public void deleteAsync(DataStore store, DataObject data, AsyncCompletionCallback<CommandResult> callback) {
80+
81+
}
82+
83+
@Override
84+
public void copyAsync(DataObject srcData, DataObject destData, AsyncCompletionCallback<CopyCommandResult> callback) {
85+
86+
}
87+
88+
@Override
89+
public void copyAsync(DataObject srcData, DataObject destData, Host destHost, AsyncCompletionCallback<CopyCommandResult> callback) {
90+
91+
}
92+
93+
@Override
94+
public boolean canCopy(DataObject srcData, DataObject destData) {
95+
return false;
96+
}
97+
98+
@Override
99+
public void resize(DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
100+
101+
}
102+
103+
@Override
104+
public ChapInfo getChapInfo(DataObject dataObject) {
105+
return null;
106+
}
107+
108+
@Override
109+
public boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore) {
110+
return true;
111+
}
112+
113+
@Override
114+
public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore) {
115+
116+
}
117+
118+
@Override
119+
public long getDataObjectSizeIncludingHypervisorSnapshotReserve(DataObject dataObject, StoragePool storagePool) {
120+
return 0;
121+
}
122+
123+
@Override
124+
public long getBytesRequiredForTemplate(TemplateInfo templateInfo, StoragePool storagePool) {
125+
return 0;
126+
}
127+
128+
@Override
129+
public long getUsedBytes(StoragePool storagePool) {
130+
return 0;
131+
}
132+
133+
@Override
134+
public long getUsedIops(StoragePool storagePool) {
135+
return 0;
136+
}
137+
138+
@Override
139+
public void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CreateCmdResult> callback) {
140+
141+
}
142+
143+
@Override
144+
public void revertSnapshot(SnapshotInfo snapshotOnImageStore, SnapshotInfo snapshotOnPrimaryStore, AsyncCompletionCallback<CommandResult> callback) {
145+
146+
}
147+
148+
@Override
149+
public void handleQualityOfServiceForVolumeMigration(VolumeInfo volumeInfo, QualityOfServiceState qualityOfServiceState) {
150+
151+
}
152+
153+
@Override
154+
public boolean canProvideStorageStats() {
155+
return true;
156+
}
157+
158+
@Override
159+
public Pair<Long, Long> getStorageStats(StoragePool storagePool) {
160+
return null;
161+
}
162+
163+
@Override
164+
public boolean canProvideVolumeStats() {
165+
return true;
166+
}
167+
168+
@Override
169+
public Pair<Long, Long> getVolumeStats(StoragePool storagePool, String volumeId) {
170+
return null;
171+
}
172+
173+
@Override
174+
public boolean canHostAccessStoragePool(Host host, StoragePool pool) {
175+
return true;
176+
}
177+
178+
@Override
179+
public boolean isVmInfoNeeded() {
180+
return true;
181+
}
182+
183+
@Override
184+
public void provideVmInfo(long vmId, long volumeId) {
185+
186+
}
187+
188+
@Override
189+
public boolean isVmTagsNeeded(String tagKey) {
190+
return true;
191+
}
192+
193+
@Override
194+
public void provideVmTags(long vmId, long volumeId, String tagValue) {
195+
196+
}
197+
198+
@Override
199+
public boolean isStorageSupportHA(Storage.StoragePoolType type) {
200+
return true;
201+
}
202+
203+
@Override
204+
public void detachVolumeFromAllStorageNodes(Volume volume) {
205+
206+
}
207+
}

0 commit comments

Comments
 (0)