The run script tries to detect when a daemon is being run in order to
shutdown other systemd unit files that clash. As implemented this
only works if the daemon name is the first argument. This won't be the
case if running via GDB or strace eg
./run strace -e trace=openat ./build/src/virtqemud
We need to check all argv to find which might be a daemon path/name.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
run.in | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/run.in b/run.in
index 64f99751fe..174b191675 100644
--- a/run.in
+++ b/run.in
@@ -130,18 +130,18 @@ def change_unit(name, action):
try_stop_units = []
if is_systemd_host():
- name = os.path.basename(prog)
-
maybe_stopped_units = []
- if is_modular_daemon(name):
- # Only need to stop libvirtd or this specific modular unit
- maybe_stopped_units += daemon_units("libvirtd")
- maybe_stopped_units += daemon_units(name)
- elif is_monolithic_daemon(name):
- # Need to stop libvirtd and/or all modular units
- maybe_stopped_units += daemon_units("libvirtd")
- for entry in modular_daemons:
- maybe_stopped_units += daemon_units(entry)
+ for arg in sys.argv:
+ name = os.path.basename(arg)
+ if is_modular_daemon(name):
+ # Only need to stop libvirtd or this specific modular unit
+ maybe_stopped_units += daemon_units("libvirtd")
+ maybe_stopped_units += daemon_units(name)
+ elif is_monolithic_daemon(name):
+ # Need to stop libvirtd and/or all modular units
+ maybe_stopped_units += daemon_units("libvirtd")
+ for entry in modular_daemons:
+ maybe_stopped_units += daemon_units(entry)
for unit in maybe_stopped_units:
if is_unit_active(unit):
--
2.33.1