@@ -147,23 +147,30 @@ private String createCloudStackVolumeForTypeVolume(DataStore dataStore, DataObje
147147 // CRITICAL: Set poolType at VOLUME level
148148 // This tells KVM to use LibvirtStorageAdaptor (NFS) instead of IscsiAdmStorageAdaptor
149149 volume .setPoolType (Storage .StoragePoolType .NetworkFilesystem );
150- // For managed NFS with subdirectories, set path to point to file INSIDE the subdirectory
151- // Path format: ROOT-17_5d11c615.../5d11c615...
152- // Full path on KVM will be: /mnt/{pool-uuid}/ROOT-17_5d11c615.../5d11c615....qcow2
153- // The subdirectory already exists (created by ONTAP), qemu-img will create the file inside
150+ // For managed NFS with subdirectories, point to file INSIDE the subdirectory
151+ // Path format: subdirectory/uuid (e.g., ROOT-20_85969d09.../85969d09...)
154152 String volumePath = subdirectoryName + "/" + volumeUuid ;
155153 volume .setPath (volumePath );
154+ // CRITICAL FIX: Also update the volume NAME to the full path
155+ // This is what KVM LibvirtStorageAdaptor uses when creating the physical disk
156+ // Without this, KVM uses just the original volume name (ROOT-20) instead of the path
157+ volume .setName (volumePath );
156158 // Set _iScsiName to subdirectory path for managed storage tracking
157- // This field is used during cleanup operations
158159 volume .set_iScsiName (subdirectoryName );
159160 volume .setFolder (volumeUuid ); // Store UUID in folder field
160161 volume .setPoolId (dataStore .getId ());
161162 volumeDao .update (volume .getId (), volume );
162- // Re-read from database to confirm the path was saved correctly
163+ // Re-read from database to verify the changes
163164 VolumeVO updatedVolume = volumeDao .findById (volume .getId ());
164- s_logger .info ("createCloudStackVolumeForTypeVolume: NFS subdirectory '{}' created on ONTAP" , subdirectoryName );
165- s_logger .info ("createCloudStackVolumeForTypeVolume: Volume {} - Path set to: {}, _iScsiName: {}, Folder: {}, PoolType: {}" , updatedVolume .getName (), updatedVolume .getPath (), updatedVolume .get_iScsiName (), updatedVolume .getFolder (), updatedVolume .getPoolType ());
166- return null ; // Return null - hypervisor will create the qcow2 file inside the subdirectory
165+ s_logger .info ("=== ONTAP NFS Volume Configuration ===" );
166+ s_logger .info ("Subdirectory created: {}" , subdirectoryName );
167+ s_logger .info ("Volume Name: {} (THIS IS WHAT KVM USES)" , updatedVolume .getName ());
168+ s_logger .info ("Volume Path: {}" , updatedVolume .getPath ());
169+ s_logger .info ("Volume _iScsiName: {}" , updatedVolume .get_iScsiName ());
170+ s_logger .info ("Volume Folder: {}" , updatedVolume .getFolder ());
171+ s_logger .info ("Volume PoolType: {}" , updatedVolume .getPoolType ());
172+ s_logger .info ("======================================" );
173+ return null ; // Return null - hypervisor will create qcow2 file inside subdirectory
167174 }
168175 // For iSCSI and other protocols, use ONTAP REST API
169176 StorageStrategy storageStrategy = getStrategyByStoragePoolDetails (details );
0 commit comments