This is an automated email from the ASF dual-hosted git repository.

harikrishna pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.19 by this push:
     new 1ff68cf9b10 linstor: Fix ZFS snapshot backup (#10219)
1ff68cf9b10 is described below

commit 1ff68cf9b10d9064dbdb10b840000ad161f734bd
Author: Rene Peinthor <[email protected]>
AuthorDate: Tue Jan 21 11:10:17 2025 +0100

    linstor: Fix ZFS snapshot backup (#10219)
    
    Linstor plugin used the wrong zfs dataset path to hide/unhide
    the snapshot device.
    Also don't use the full path to the zfs binary.
---
 plugins/storage/volume/linstor/CHANGELOG.md                |  6 ++++++
 .../wrapper/LinstorBackupSnapshotCommandWrapper.java       | 14 ++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/plugins/storage/volume/linstor/CHANGELOG.md 
b/plugins/storage/volume/linstor/CHANGELOG.md
index 957377e2978..419a7f983ee 100644
--- a/plugins/storage/volume/linstor/CHANGELOG.md
+++ b/plugins/storage/volume/linstor/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to Linstor CloudStack plugin will be 
documented in this file
 The format is based on [Keep a 
Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic 
Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [2025-01-20]
+
+### Fixed
+
+- Volume snapshots on zfs used the wrong dataset path to hide/unhide snapdev
+
 ## [2024-12-13]
 
 ### Fixed
diff --git 
a/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LinstorBackupSnapshotCommandWrapper.java
 
b/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LinstorBackupSnapshotCommandWrapper.java
index a210d53d7e7..a572759c35a 100644
--- 
a/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LinstorBackupSnapshotCommandWrapper.java
+++ 
b/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LinstorBackupSnapshotCommandWrapper.java
@@ -45,11 +45,17 @@ public final class LinstorBackupSnapshotCommandWrapper
 {
     private static final Logger s_logger = 
Logger.getLogger(LinstorBackupSnapshotCommandWrapper.class);
 
+    private static String zfsDatasetName(String zfsFullSnapshotUrl) {
+        String zfsFullPath = zfsFullSnapshotUrl.substring(6);
+        int atPos = zfsFullPath.indexOf('@');
+        return atPos >= 0 ? zfsFullPath.substring(0, atPos) : zfsFullPath;
+    }
+
     private String zfsSnapdev(boolean hide, String zfsUrl) {
-        Script script = new Script("/usr/bin/zfs", Duration.millis(5000));
+        Script script = new Script("zfs", Duration.millis(5000));
         script.add("set");
         script.add("snapdev=" + (hide ? "hidden" : "visible"));
-        script.add(zfsUrl.substring(6));  // cutting zfs://
+        script.add(zfsDatasetName(zfsUrl));  // cutting zfs:// and 
@snapshotname
         return script.execute();
     }
 
@@ -133,10 +139,10 @@ public final class LinstorBackupSnapshotCommandWrapper
             s_logger.info("Src: " + srcPath + " | " + src.getName());
             if (srcPath.startsWith("zfs://")) {
                 zfsHidden = true;
-                if (zfsSnapdev(false, srcPath) != null) {
+                if (zfsSnapdev(false, src.getPath()) != null) {
                     return new CopyCmdAnswer("Unable to unhide zfs snapshot 
device.");
                 }
-                srcPath = "/dev/" + srcPath.substring(6);
+                srcPath = "/dev/zvol/" + srcPath.substring(6);
             }
 
             secondaryPool = 
storagePoolMgr.getStoragePoolByURI(dstDataStore.getUrl());

Reply via email to