]> git.proxmox.com Git - pve-storage.git/commitdiff
check for service exsitance before enabling zfs-import service
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 29 Sep 2020 15:33:13 +0000 (17:33 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 29 Sep 2020 16:52:32 +0000 (18:52 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/API2/Disks/ZFS.pm

index 66b26e965e6ac751643e72d3600d84905adcac06..2884bb064dfe806c79a6b49f86b5b4bb4be8be77 100644 (file)
@@ -394,10 +394,12 @@ __PACKAGE__->register_method ({
                print "# ", join(' ', @$cmd), "\n";
                run_command($cmd);
 
-               my $importunit = 'zfs-import@'. PVE::Systemd::escape_unit($name, undef) . '.service';
-               $cmd = ['systemctl', 'enable', $importunit];
-               print "# ", join(' ', @$cmd), "\n";
-               run_command($cmd);
+               if (-e '/lib/systemd/system/zfs-import@.service') {
+                   my $importunit = 'zfs-import@'. PVE::Systemd::escape_unit($name, undef) . '.service';
+                   $cmd = ['systemctl', 'enable', $importunit];
+                   print "# ", join(' ', @$cmd), "\n";
+                   run_command($cmd);
+               }
 
                if ($param->{add_storage}) {
                    my $storage_params = {