Skip to content

Commit b83ce23

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
Pilot commit for NAS support operations
1 parent 25353c2 commit b83ce23

File tree

6 files changed

+336
-21
lines changed

6 files changed

+336
-21
lines changed

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

100644100755
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@
2626
import org.springframework.web.bind.annotation.RequestHeader;
2727
import org.springframework.web.bind.annotation.RequestMapping;
2828
import org.springframework.web.bind.annotation.RequestMethod;
29-
import org.springframework.web.bind.annotation.RequestParam;
29+
import org.springframework.web.bind.annotation.RequestBody;
3030

3131
import java.net.URI;
32-
import java.util.Map;
3332

3433
@FeignClient(name = "SvmClient", url = "https://{clusterIP}/api/svm/svms", configuration = FeignConfiguration.class)
3534
public interface SvmFeignClient {
@@ -41,4 +40,7 @@ public interface SvmFeignClient {
4140
@RequestMapping(method = RequestMethod.GET, value = "/{uuid}")
4241
Svm getSvmByUUID(URI baseURL, @RequestHeader("Authorization") String header);
4342

43+
@RequestMapping(method = RequestMethod.PATCH)
44+
void updateSVM(URI baseURL, @RequestHeader("Authorization") String header, @RequestBody Svm svm);
45+
4446
}

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycle.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class OntapPrimaryDatastoreLifecycle extends BasePrimaryDataStoreLifeCycl
6767
*/
6868
@Override
6969
public DataStore initialize(Map<String, Object> dsInfos) {
70+
s_logger.info("initialize {}", dsInfos);
7071
if (dsInfos == null) {
7172
throw new CloudRuntimeException("Datastore info map is null, cannot create primary storage");
7273
}
@@ -149,7 +150,9 @@ public DataStore initialize(Map<String, Object> dsInfos) {
149150
} else {
150151
throw new CloudRuntimeException("ONTAP details validation failed, cannot create primary storage");
151152
}
153+
String storagePath = url + ":/" + storagePoolName;
152154

155+
parameters.setPath(storagePath);
153156
parameters.setTags(tags);
154157
parameters.setIsTagARule(isTagARule);
155158
parameters.setDetails(details);

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/provider/StorageProviderFactory.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,36 +30,29 @@
3030
import org.apache.logging.log4j.Logger;
3131
import org.springframework.stereotype.Component;
3232

33-
@Component
3433
public class StorageProviderFactory {
35-
private final StorageStrategy storageStrategy;
3634
private static final Logger s_logger = (Logger) LogManager.getLogger(StorageProviderFactory.class);
3735

38-
private StorageProviderFactory(OntapStorage ontapStorage) {
36+
private StorageProviderFactory() {}
37+
38+
public static StorageStrategy getStrategy(OntapStorage ontapStorage) {
3939
ProtocolType protocol = ontapStorage.getProtocol();
40-
s_logger.info("Initializing StorageProviderFactory with protocol: " + protocol);
40+
s_logger.info("Initializing StorageProviderFactory with protocol: {}", protocol);
4141
switch (protocol) {
4242
case NFS:
4343
if(!ontapStorage.getIsDisaggregated()) {
44-
this.storageStrategy = new UnifiedNASStrategy(ontapStorage);
44+
return new UnifiedNASStrategy(ontapStorage);
4545
} else {
4646
throw new CloudRuntimeException("Unsupported configuration: Disaggregated ONTAP is not supported.");
4747
}
48-
break;
4948
case ISCSI:
5049
if (!ontapStorage.getIsDisaggregated()) {
51-
this.storageStrategy = new UnifiedSANStrategy(ontapStorage);
50+
return new UnifiedSANStrategy(ontapStorage);
5251
} else {
5352
throw new CloudRuntimeException("Unsupported configuration: Disaggregated ONTAP is not supported.");
5453
}
55-
break;
5654
default:
57-
this.storageStrategy = null;
58-
throw new CloudRuntimeException("Unsupported protocol: " + protocol);
55+
throw new CloudRuntimeException("Unsupported configuration: " + protocol);
5956
}
6057
}
61-
62-
public static StorageStrategy getStrategy(OntapStorage ontapStorage) {
63-
return new StorageProviderFactory(ontapStorage).storageStrategy;
64-
}
6558
}

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/NASStrategy.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public NASStrategy(OntapStorage ontapStorage) {
2727
}
2828

2929
public abstract String createExportPolicy(String svmName, String policyName);
30+
public abstract boolean deleteExportPolicy(String svmName, String policyName);
31+
public abstract boolean exportPolicyExists(String svmName, String policyName);
3032
public abstract String addExportRule(String policyName, String clientMatch, String[] protocols, String[] roRule, String[] rwRule);
3133
public abstract String assignExportPolicyToVolume(String volumeUuid, String policyName);
3234
public abstract String enableNFS(String svmUuid);

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/StorageStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public abstract class StorageStrategy {
5555
@Inject
5656
private JobFeignClient jobFeignClient;
5757

58-
private final OntapStorage storage;
58+
protected final OntapStorage storage;
5959

6060
private List<Aggregate> aggregates;
6161

0 commit comments

Comments
 (0)