Skip to content

Commit dcbc73e

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
vm instance creation test2
1 parent 75e3a31 commit dcbc73e

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
3737
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
3838
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreCapabilities;
39+
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
3940
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
4041
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
4142
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
@@ -45,6 +46,7 @@
4546
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
4647
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
4748
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
49+
import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
4850
import org.apache.cloudstack.storage.feign.model.OntapStorage;
4951
import org.apache.cloudstack.storage.provider.StorageProviderFactory;
5052
import org.apache.cloudstack.storage.service.StorageStrategy;
@@ -84,7 +86,30 @@ public DataTO getTO(DataObject data) {
8486

8587
@Override
8688
public DataStoreTO getStoreTO(DataStore store) {
87-
return null;
89+
// Load storage pool details from database (includes "mountpoint" added during pool creation)
90+
Map<String, String> poolDetails = storagePoolDetailsDao.listDetailsKeyPairs(store.getId());
91+
92+
// Set details on the store before creating PrimaryDataStoreTO
93+
// This ensures PrimaryDataStoreTO constructor gets the details from database
94+
PrimaryDataStore primaryStore = (PrimaryDataStore) store;
95+
if (poolDetails != null && !poolDetails.isEmpty()) {
96+
// Merge existing details (if any) with database details
97+
Map<String, String> existingDetails = primaryStore.getDetails();
98+
if (existingDetails == null) {
99+
primaryStore.setDetails(poolDetails);
100+
} else {
101+
// Merge: database details take precedence
102+
Map<String, String> mergedDetails = new HashMap<>(existingDetails);
103+
mergedDetails.putAll(poolDetails);
104+
primaryStore.setDetails(mergedDetails);
105+
}
106+
}
107+
108+
// Now create PrimaryDataStoreTO - it will get details from primaryStore.getDetails()
109+
PrimaryDataStoreTO storeTO = new PrimaryDataStoreTO(primaryStore);
110+
111+
s_logger.debug("OntapPrimaryDatastoreDriver: getStoreTO: Created PrimaryDataStoreTO with details from storage_pool_details table");
112+
return storeTO;
88113
}
89114

90115
@Override

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ public DataStore initialize(Map<String, Object> dsInfos) {
243243
throw new CloudRuntimeException("ONTAP details validation failed, cannot create primary storage");
244244
}
245245

246+
// Add mountpoint detail for ManagedNFS - required by KVM agent's ManagedNfsStorageAdaptor
247+
// The 'mountpoint' key is used by connectPhysicalDisk() to mount NFS export
248+
details.put("mountpoint", path);
249+
246250
// Set parameters for primary data store
247251
parameters.setPort(Constants.ONTAP_PORT);
248252
parameters.setHost(host);

0 commit comments

Comments
 (0)