mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
server: fix null pointer on powerflex attach volume edge case (#7498)
This PR fixes a null pointer edge case where a PowerFlex volume is attached to a VM. In this edge case, a VM has been created, started, stopped, and then reimaged. VM has a last host ID but the newly attached volume does not yet have a storage pool assigned, it will be assigned on the VM start. However, we assume that if the VM's host is not null, we need to try to revoke access to the volume for the host. Since there is no storage pool yet for the volume, we hit a null pointer when checking to see if the volume's pool is PowerFlex. This was affecting all storage types, I could reproduce it with local storage, since the null pointer is at the check for pool's type. Co-authored-by: Marcus Sorensen <mls@apple.com>
This commit is contained in:
parent
bdd5363314
commit
3cb4c801fb
@ -4260,7 +4260,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
||||
_volsDao.update(volumeToAttach.getId(), volumeToAttach);
|
||||
}
|
||||
|
||||
if (host != null && volumeToAttachStoragePool.getPoolType() == Storage.StoragePoolType.PowerFlex) {
|
||||
if (host != null && volumeToAttachStoragePool != null && volumeToAttachStoragePool.getPoolType() == Storage.StoragePoolType.PowerFlex) {
|
||||
// Unmap the volume on PowerFlex/ScaleIO pool for stopped VM
|
||||
volService.revokeAccess(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user