virsh: add wrapper to serialize calls to virsh list

avoid storm of virsh list that overloads libvirtd API causing
unnecessary timeouts during pcmk monitoring operations.

Resolves: https://github.com/ClusterLabs/anvil/issues/395

Signed-off-by: Fabio M. Di Nitto <fabbione@fabbione.net>
main
Fabio M. Di Nitto 1 year ago
parent fc75bda6ef
commit 824e3e07e3
  1. 2
      Anvil/Tools.pm
  2. 3
      tools/Makefile.am
  3. 10
      tools/anvil-virsh-wrapper

@ -1308,7 +1308,7 @@ sub _set_paths
useradd => "/usr/sbin/useradd", useradd => "/usr/sbin/useradd",
usermod => "/usr/sbin/usermod", usermod => "/usr/sbin/usermod",
uuidgen => "/usr/bin/uuidgen", uuidgen => "/usr/bin/uuidgen",
virsh => "/usr/bin/virsh", virsh => "/usr/sbin/anvil-virsh-wrapper",
'virt-install' => "/usr/bin/virt-install", 'virt-install' => "/usr/bin/virt-install",
websockify => "/usr/bin/websockify", websockify => "/usr/bin/websockify",
wipefs => "/usr/sbin/wipefs", wipefs => "/usr/sbin/wipefs",

@ -1,7 +1,5 @@
MAINTAINERCLEANFILES = Makefile.in MAINTAINERCLEANFILES = Makefile.in
# XXX recheck after rebase!
dist_sbin_SCRIPTS = \ dist_sbin_SCRIPTS = \
anvil-access-module \ anvil-access-module \
anvil-boot-server \ anvil-boot-server \
@ -46,6 +44,7 @@ dist_sbin_SCRIPTS = \
anvil-update-states \ anvil-update-states \
anvil-update-system \ anvil-update-system \
anvil-version-changes \ anvil-version-changes \
anvil-virsh-wrapper \
anvil-watch-bonds \ anvil-watch-bonds \
anvil-watch-drbd \ anvil-watch-drbd \
anvil-watch-power \ anvil-watch-power \

@ -0,0 +1,10 @@
#!/bin/sh -e
(
if [ "$1" != "list" ]; then
virsh $@
exit $?
fi
flock -e 200
virsh $@
) 200>/tmp/virsh.lock
Loading…
Cancel
Save