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";
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 = {