From 1a74542ee3c344fb92d5702e27b3aa81c8e0b810 Mon Sep 17 00:00:00 2001 From: "Srivastava, Piyush" Date: Tue, 5 May 2026 10:37:41 +0530 Subject: [PATCH] bugfix/CSTACKEX-138: Fix volume attach for ONTAP plugin --- .../main/java/com/cloud/storage/VolumeApiServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java index 6872d2070d66..e24d862bb62f 100644 --- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java @@ -4847,6 +4847,11 @@ private VolumeVO sendAttachVolumeCommand(UserVmVO vm, VolumeVO volumeToAttach, L throw new CloudRuntimeException(e.getMessage()); } + + // Reload volume from DB after grantAccess — managed storage drivers (e.g. ONTAP) + // may update the volume's path and iScsiName during grantAccess, so the local + // volumeToAttach object can be stale. + volumeToAttach = _volsDao.findById(volumeToAttach.getId()); } if (sendCommand) {