Skip to content

Commit 369d5b5

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
Commit 29
1 parent f128819 commit 369d5b5

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,17 +358,22 @@ public KVMPhysicalDisk createPhysicalDisk(String volumeUuid, KVMStoragePool pool
358358
// We need to:
359359
// 1. Mount the per-volume NFS export (via connectPhysicalDisk)
360360
// 2. Create the qcow2 file on it
361-
361+
// Construct the junction path from volume UUID
362+
// Volume UUID: 1832f014-1d35-497e-9a3e-aa294fe3c060 -> Junction: /cs_vol_1832f014_1d35_497e_9a3e_aa294fe3c060
363+
String volumeUuidWithUnderscores = volumeUuid.replace("-", "_");
364+
String junctionPath = "/cs_vol_" + volumeUuidWithUnderscores;
365+
// Create details map with junction path for connectPhysicalDisk
366+
Map<String, String> details = new HashMap<>();
367+
details.put(DiskTO.MOUNT_POINT, junctionPath);
368+
// Mount the ONTAP volume first (connectPhysicalDisk handles duplicate mount attempts)
369+
boolean mounted = connectPhysicalDisk(volumeUuid, pool, details,false);
370+
if (!mounted) {
371+
throw new CloudRuntimeException("Failed to mount ONTAP volume for: " + volumeUuid);
372+
}
362373
String mountPoint = getMountPointForVolume(volumeUuid);
363374
String diskPath = mountPoint + "/" + volumeUuid;
364375

365376
try {
366-
// The volume should be mounted via connectPhysicalDisk first
367-
// But if not, we can't proceed
368-
if (!isMounted(mountPoint)) {
369-
throw new CloudRuntimeException("ONTAP volume not mounted for: " + volumeUuid +
370-
". Volume must be mounted before creating disk.");
371-
}
372377
// Create qcow2 file using qemu-img
373378
QemuImgFile destFile = new QemuImgFile(diskPath, size, format);
374379
QemuImg qemuImg = new QemuImg(0);

0 commit comments

Comments
 (0)