check for service exsitance before enabling zfs-import service

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2020-09-29 17:33:13 +02:00
parent f720f6c440
commit c9c90349c3

View File

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