bhouse-nexthop opened a new issue, #14599: URL: https://github.com/apache/cloudstack/issues/14599
### problem `listSnapshots` (e.g. `list snapshots listall=true`) fails with: ``` Cannot invoke "com.cloud.storage.VolumeVO.getRemoved()" because "volumeVO" is null ``` The trigger is a snapshot that still references a volume whose row is no longer in the `volumes` table, however it got there. The `revertable` field of each snapshot in the response is computed through `SnapshotObject.isRevertable()` → `StorageStrategyFactory.getSnapshotStrategy(snapshot, REVERT)`, which asks every `SnapshotStrategy` for `canHandle()`. `CephSnapshotStrategy`, `ScaleIOSnapshotStrategy` and `StorageSystemSnapshotStrategy` do: ```java VolumeVO volumeVO = volumeDao.findByIdIncludingRemoved(volumeId); boolean baseVolumeExists = volumeVO.getRemoved() == null; ``` `findByIdIncludingRemoved()` returns `null` when the row is gone, so `canHandle()` throws. Because every strategy is asked, this happens whatever storage the snapshot is on, and one such snapshot makes the whole list call fail. Other operations that pick a snapshot strategy for that snapshot fail the same way. ### versions 4.22 (also present on `main`). ### The steps to reproduce the bug 1. Have a snapshot whose `volume_id` points to a row that no longer exists in `volumes` (for example after expunged resources were purged, or a manual DB cleanup). 2. Call `listSnapshots listall=true`. 3. The call fails with the error above. ### What to do about it? Treat a missing volume row like a removed volume in those strategies' `canHandle()` and return `CANT_HANDLE`, as `DefaultSnapshotStrategy` already does for a null volume on REVERT. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
