Skip to content

Commit

Permalink
[linstor] fixes apache#9522: snapshot revert and delete does always n…
Browse files Browse the repository at this point in the history
…ot work

The snapshot strategy uses volume uuids instead of their paths. This commit fixes that.

No backport to 4.18 as the file does not exist there.

Signed-off-by: Michael Wodniok <[email protected]>
  • Loading branch information
Michael Wodniok committed Aug 13, 2024
1 parent 6e6a276 commit bbc7bea
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ public boolean deleteVMSnapshot(VMSnapshot vmSnapshot) {
final String snapshotName = vmSnapshotVO.getName();
final List<String> failedToDelete = new ArrayList<>();
for (VolumeObjectTO volumeObjectTO : volumeTOs) {
final String rscName = LinstorUtil.RSC_PREFIX + volumeObjectTO.getUuid();
final String volPath = volumeObjectTO.getPath();
final String rscName = LinstorUtil.RSC_PREFIX + (volPath != null ? volPath : volumeObjectTO.getUuid());
String err = linstorDeleteSnapshot(api, rscName, snapshotName);

if (err != null)
Expand Down Expand Up @@ -292,7 +293,8 @@ private boolean revertVMSnapshotOperation(VMSnapshot vmSnapshot, long userVmId)
final String snapshotName = vmSnapshotVO.getName();

for (VolumeObjectTO volumeObjectTO : volumeTOs) {
final String rscName = LinstorUtil.RSC_PREFIX + volumeObjectTO.getUuid();
final String volPath = volumeObjectTO.getPath();
final String rscName = LinstorUtil.RSC_PREFIX + (volPath != null ? volPath : volumeObjectTO.getUuid());
String err = linstorRevertSnapshot(api, rscName, snapshotName);
if (err != null) {
throw new CloudRuntimeException(String.format(
Expand Down

0 comments on commit bbc7bea

Please sign in to comment.