From c9c90349c35efb11bb9ab68b2b1f6d88700b0863 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 29 Sep 2020 17:33:13 +0200 Subject: [PATCH] check for service exsitance before enabling zfs-import service Signed-off-by: Thomas Lamprecht --- PVE/API2/Disks/ZFS.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PVE/API2/Disks/ZFS.pm b/PVE/API2/Disks/ZFS.pm index 66b26e9..2884bb0 100644 --- a/PVE/API2/Disks/ZFS.pm +++ b/PVE/API2/Disks/ZFS.pm @@ -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 = {