]> git.proxmox.com Git - proxmox-backup.git/commitdiff
api: disks/zfs: check template exsits before enabling zfs-import service
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 30 Sep 2020 07:34:21 +0000 (09:34 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 30 Sep 2020 07:34:21 +0000 (09:34 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/api2/node/disks/zfs.rs

index 0f0e4220d57e064984037d0db71e56df6e41f9d3..165341991b3153c839910226c63105196e822181 100644 (file)
@@ -357,8 +357,10 @@ pub fn create_zpool(
             let output = crate::tools::run_command(command, None)?;
             worker.log(output);
 
-            let import_unit = format!("zfs-import@{}.service", systemd::escape_unit(&name, false));
-            systemd::enable_unit(&import_unit)?;
+            if std::path::Path::new("/lib/systemd/system/zfs-import@.service").exists() {
+                let import_unit = format!("zfs-import@{}.service", systemd::escape_unit(&name, false));
+                systemd::enable_unit(&import_unit)?;
+            }
 
             if let Some(compression) = compression {
                 let mut command = std::process::Command::new("zfs");