[libvirt] [PATCH] libvirt-guests: Don't throw errors if libvirtd is not installed

When only client parts of libvirt are installed (i.e., no libvirtd daemon), libvirt-guests init script in its default configuration would throw seriously looking errors during host shutdown: Running guests on default URI: error: unable to connect to '/var/run/libvirt/libvirt-sock', libvirtd may need to be started: No such file or directory error: failed to connect to the hypervisor This patch changes the script to print rather harmless message in that situation: Running guests on default URI: libvirtd not installed; skipping this URI. --- daemon/libvirt-guests.init.in | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/daemon/libvirt-guests.init.in b/daemon/libvirt-guests.init.in index f99c070..d2ec96a 100644 --- a/daemon/libvirt-guests.init.in +++ b/daemon/libvirt-guests.init.in @@ -25,6 +25,7 @@ sysconfdir=@sysconfdir@ localstatedir=@localstatedir@ +libvirtd=@sbindir@/libvirtd # Source function library. . "$sysconfdir"/rc.d/init.d/functions @@ -232,6 +233,12 @@ stop() { : >"$LISTFILE" for uri in $URIS; do echo -n $"Running guests on $uri URI: " + + if [ "x$uri" = xdefault ] && [ ! -x "$libvirtd" ]; then + echo $"libvirtd not installed; skipping this URI." + continue + fi + list=$(list_guests $uri) if [ $? -eq 0 ]; then empty=true -- 1.7.2

On 07/27/2010 07:10 AM, Jiri Denemark wrote:
When only client parts of libvirt are installed (i.e., no libvirtd daemon), libvirt-guests init script in its default configuration would throw seriously looking errors during host shutdown:
Running guests on default URI: error: unable to connect to '/var/run/libvirt/libvirt-sock', libvirtd may need to be started: No such file or directory error: failed to connect to the hypervisor
This patch changes the script to print rather harmless message in that situation:
Running guests on default URI: libvirtd not installed; skipping this URI.
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

When only client parts of libvirt are installed (i.e., no libvirtd daemon), libvirt-guests init script in its default configuration would throw seriously looking errors during host shutdown:
Running guests on default URI: error: unable to connect to '/var/run/libvirt/libvirt-sock', libvirtd may need to be started: No such file or directory error: failed to connect to the hypervisor
This patch changes the script to print rather harmless message in that situation:
Running guests on default URI: libvirtd not installed; skipping this URI.
ACK.
Thanks, pushed. Jirka
participants (2)
-
Eric Blake
-
Jiri Denemark