Skip to content

Commit a718746

Browse files
authored
server: fix checking disk offering access for snapshot volume (#3791)
Fixes #3783 As reported in the issue, creating volumes from pure snapshot fails with NPE. This is due to order of calls where disk offering access is checked before checking disk offering value. This PR fixes the same. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 75aa6e3 commit a718746

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,6 @@ public VolumeVO allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationExcept
673673
zoneId = snapshotCheck.getDataCenterId();
674674
}
675675

676-
_configMgr.checkDiskOfferingAccess(null, diskOffering, _dcDao.findById(zoneId));
677-
678676
if (diskOffering == null) { // Pure snapshot is being used to create volume.
679677
diskOfferingId = snapshotCheck.getDiskOfferingId();
680678
diskOffering = _diskOfferingDao.findById(diskOfferingId);
@@ -689,6 +687,8 @@ public VolumeVO allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationExcept
689687
}
690688
}
691689

690+
_configMgr.checkDiskOfferingAccess(null, diskOffering, _dcDao.findById(zoneId));
691+
692692
// check snapshot permissions
693693
_accountMgr.checkAccess(caller, null, true, snapshotCheck);
694694

0 commit comments

Comments
 (0)