From bbc7bea798248581354814d9405dd7a907192ae6 Mon Sep 17 00:00:00 2001 From: Michael Wodniok Date: Tue, 13 Aug 2024 14:45:00 +0000 Subject: [PATCH] [linstor] fixes #9522: snapshot revert and delete does always not 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 --- .../storage/snapshot/LinstorVMSnapshotStrategy.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/snapshot/LinstorVMSnapshotStrategy.java b/plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/snapshot/LinstorVMSnapshotStrategy.java index af7b6978db56..20a1f90da2f0 100644 --- a/plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/snapshot/LinstorVMSnapshotStrategy.java +++ b/plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/snapshot/LinstorVMSnapshotStrategy.java @@ -239,7 +239,8 @@ public boolean deleteVMSnapshot(VMSnapshot vmSnapshot) { final String snapshotName = vmSnapshotVO.getName(); final List 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) @@ -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(