Skip to content

Commit 028058f

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
vm instance creation test17
1 parent b5d3a93 commit 028058f

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,6 +1608,11 @@ private Map<String, String> getDetails(VolumeInfo volumeInfo, DataStore dataStor
16081608
details.put(DiskTO.PROTOCOL_TYPE, (volume.getPoolType() != null) ? volume.getPoolType().toString() : null);
16091609
details.put(StorageManager.STORAGE_POOL_DISK_WAIT.toString(), String.valueOf(StorageManager.STORAGE_POOL_DISK_WAIT.valueIn(storagePool.getId())));
16101610

1611+
// ManagedNFS enhancement: provide UUID explicitly for libvirt storage pool XML if adaptor wants it.
1612+
if (volume.getPoolType() == Storage.StoragePoolType.ManagedNFS) {
1613+
details.put(DiskTO.UUID, volume.getUuid());
1614+
}
1615+
16111616
if (volume.getPoolId() != null) {
16121617
StoragePoolVO poolVO = _storagePoolDao.findById(volume.getPoolId());
16131618
if (poolVO.getParent() != 0L) {

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/ManagedNfsStorageAdaptor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ public KVMPhysicalDisk createPhysicalDisk(String volumeUuid, KVMStoragePool pool
9898
*/
9999
@Override
100100
public boolean connectPhysicalDisk(String volumeUuid, KVMStoragePool pool, Map<String, String> details, boolean isVMMigrate) {
101+
logger.info(String.format("ManagedNFS connectPhysicalDisk invoked: volumeUuid=%s sourceHost=%s mountPoint=%s uuidDetail=%s", volumeUuid,
102+
(pool != null ? pool.getSourceHost() : "null"),
103+
(details != null ? details.get(com.cloud.agent.api.to.DiskTO.MOUNT_POINT) : "null"),
104+
(details != null ? details.get(com.cloud.agent.api.to.DiskTO.UUID) : "null")));
101105

102106
StoragePool sp = null;
103107
Connect conn = null;
@@ -111,6 +115,7 @@ public boolean connectPhysicalDisk(String volumeUuid, KVMStoragePool pool, Map<S
111115

112116
targetPath = "/mnt" + volumeUuid;
113117
spd = new LibvirtStoragePoolDef(PoolType.NETFS, volumeUuid, details.get(DiskTO.UUID), pool.getSourceHost(), details.get(DiskTO.MOUNT_POINT), targetPath);
118+
logger.debug("ManagedNFS creating libvirt storage pool XML: host=" + pool.getSourceHost() + " dir=" + details.get(DiskTO.MOUNT_POINT) + " target=" + targetPath);
114119
_storageLayer.mkdir(targetPath);
115120

116121
logger.debug(spd.toString());

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ private String createCloudStackVolumeForTypeVolume(DataStore dataStore, DataObje
145145
if (storagePool.getPath() != null) {
146146
volume.set_iScsiName(storagePool.getPath());
147147
}
148-
// For ManagedNfsStorageAdaptor the volume name (uuid) is used and qcow2 is created without extension necessity.
149-
volume.setPath(volumeUuid); // no extension; adaptor creates qcow2 libvirt volume with this name
150-
volume.setFormat(Storage.ImageFormat.QCOW2);
148+
// Defer physical file creation and path assignment until attach/connectPhysicalDisk.
149+
// Leave path null so managed attach flow on KVM triggers ManagedNfsStorageAdaptor.
150+
volume.setFormat(Storage.ImageFormat.QCOW2); // Format known in advance
151151
volume.setPoolId(dataStore.getId());
152152
volumeDao.update(volume.getId(), volume);
153153
s_logger.info("ONTAP ManagedNFS volume registered: uuid={} path={} format=QCOW2", volumeUuid, volumeUuid);

0 commit comments

Comments
 (0)