mirror of https://github.com/schoebel/mars
marsadm: deactivate unit upon detach
This commit is contained in:
parent
b7b9e6fed1
commit
b951c13d1b
|
@ -477,6 +477,7 @@ sub systemd_activate {
|
|||
$op = "stop";
|
||||
}
|
||||
_systemd_op($op, $unit);
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub systemd_trigger {
|
||||
|
@ -3118,6 +3119,9 @@ sub attach_res_phase0 {
|
|||
if ($detach) {
|
||||
my $device_in_use = get_link("$mars/resource-$res/actual-$host/open-count", 1);
|
||||
if ($device_in_use) {
|
||||
if (systemd_activate($cmd, $res, 0)) {
|
||||
return;
|
||||
}
|
||||
my $name = get_link("$mars/resource-$res/device-$host");
|
||||
my $dev = "/dev/mars/$name";
|
||||
ldie "device '$dev' is in use\n";
|
||||
|
|
Loading…
Reference in New Issue