Commit Graph

12 Commits

Author SHA1 Message Date
Jim Fehlig
8599aedd43 Improve filtering of Xen domain0 in libvirt-guests
The list_guests function in libvirt-guests uses 'grep -v' to filter
Xen domain0 from a list of guests. If domain0 is the only item in
the list, 'grep -v' returns 1, causing the 'stop' operation to fail
when action is 'suspend'. Improve the filtering by using sed to remove
domain0 from the list of guests.
2017-12-18 09:24:13 -07:00
Stefan Bader
cc38d5661f tools: Exclude Xen dom0 from libvirt-guests.sh list
With newer versions of libvirt Domain-0 is again visible in the list of
running guests but it should not be considered as a guest for shutdown
or suspend.

Signed-off-by Stefan Bader <stefan.bader@canonical.com>
2016-10-10 16:52:08 +08:00
Stefan Bader
69722fd7ac tools: Ignore newlines in libvirt-guests.sh guest list
The list file expects all guest UUIDs on the same line as the URI
which the guests run on. This does not happen when the list is
echo'ed in quotes. When stripping the quotes, newlines get transformed
into spaces. Without this, only the first guest on the list is actually
handled.

Based on a fix by Omar Siam <simar@gmx.net>

Bug-Ubuntu: http://bugs.launchpad.net/bugs/1591695

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2016-10-10 16:52:08 +08:00
Michal Privoznik
64e070e8fe libvirt-guests: Initialize SYNC_TIME
https://bugzilla.redhat.com/show_bug.cgi?id=1191227

Since 0fa15b19 we have this variable SYNC_TIME which allows users to
synchronize time on domain resume. However, despite what documentation
says, it's by default on because it's never initialized. Fix this by
setting it to zero at the beginning of the libvirt-guests script.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-05-12 08:53:14 +02:00
Michal Privoznik
0fa15b19a9 libvirt-guests: Allow time sync on guests resume
Well, imagine domains were running, and as the host went down, they
were managesaved. Later, after some time, the host went up again and
domains got restored. But without correct time. And depending on how
long was the host shut off, it may take some time for ntp to sync the
time too. But hey, wait a minute. We have an API just for that! So:

1) Introduce SYNC_TIME variable in libvirt-guests.sysconf to allow
users control over the new functionality
2) Call 'virsh domtime --sync $dom' in the libvirt-guests script.

Unfortunately, this is all-or-nothing approach (just like anything
else with the script). Domains are required to have configured and
running qemu-ga inside.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-02-23 08:49:21 +01:00
Martin Kletzander
15e38ebbf1 libvirt-guests: fix some typos in a comment
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-07-25 12:06:07 +02:00
Guido Günther
5a05865773 libvirt-guests: avoid bashism
At least Debian uses dash to run the init scripts
2014-04-07 12:51:05 +02:00
Michal Privoznik
4e7fc8305a libvirt-guests: Wait for libvirtd to initialize
I've noticed that in some cases systemd was quick enough and even
if libvirt-guests.service is marked to be started after the
libvirtd.service my guests were not resumed as
libvirt-guests.sh failed to connect. This is because of a
simple fact: systemd correctly starts libvirt-guests after it
execs libvirtd. However, the daemon is not able to accept
connections right from the start. It's doing some
initialization which may take ages. This problem is not limited
to systemd only, indeed. Any init system that is able to startup
services in parallel (e.g. OpenRC) may run into this situation.
The fix is to try connecting not only once, but continuously a few
times with a small sleep in between tries.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-02-24 10:54:37 +01:00
Eric Blake
d7f53c7b97 maint: use LGPL correctly
Several files called out COPYING or COPYING.LIB instead of using
the normal boilerplate.  It's especially important that we don't
call out COPYING from an LGPL file, since COPYING is traditionally
used for the GPL.  A few files were lacking copyright altogether.

* src/rpc/gendispatch.pl: Add missing copyright.
* Makefile.nonreentrant: Likewise.
* src/check-symfile.pl: Likewise.
* src/check-symsorting.pl: Likewise.
* src/driver.h: Likewise.
* src/internal.h: Likewise.
* tools/libvirt-guests.sh.in: Likewise.
* tools/virt-pki-validate.in: Mention copyright in comment, not just code.
* tools/virt-sanlock-cleanup.in: Likewise.
* src/rpc/genprotocol.pl: Spell out license terms.
* src/xen/xend_internal.h: Likewise.
* src/xen/xend_internal.c: Likewise.
* Makefile.am: Likewise.
* daemon/Makefile.am: Likewise.
* docs/Makefile.am: Likewise.
* docs/schemas/Makefile.am: Likewise.
* examples/apparmor/Makefile.am: Likewise.
* examples/domain-events/events-c/Makefile.am: Likewise.
* examples/dominfo/Makefile.am: Likewise.
* examples/domsuspend/Makefile.am: Likewise.
* examples/hellolibvirt/Makefile.am: Likewise.
* examples/openauth/Makefile.am: Likewise.
* examples/python/Makefile.am: Likewise.
* examples/systemtap/Makefile.am: Likewise.
* examples/xml/nwfilter/Makefile.am: Likewise.
* gnulib/lib/Makefile.am: Likewise.
* gnulib/tests/Makefile.am: Likewise.
* include/Makefile.am: Likewise.
* include/libvirt/Makefile.am: Likewise.
* python/Makefile.am: Likewise.
* python/tests/Makefile.am: Likewise.
* src/Makefile.am: Likewise.
* tests/Makefile.am: Likewise.
* tools/Makefile.am: Likewise.
* configure.ac: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-20 14:03:48 -06:00
Ján Tomko
9c51de2b4e libvirt-guests: status: return non-zero when stopped
Return 3 when the service is stopped, whether there
are saved guests or not, to conform with the LSB standards:

http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
2013-04-30 18:38:18 +02:00
Eric Blake
7c12055def libvirt-guests: newline between output sentences
Right now, libvirt-guests gives awkward output.  It's possible to
force faster failure by setting /etc/sysconfig/libvirt-guests to use:

ON_SHUTDOWN=shutdown
PARALLEL_SHUTDOWN=0
SHUTDOWN_TIMEOUT=1
ON_BOOT=ignore

at which point, we see:

$ service libvirt-guests restart
Running guests on default URI: a, b, d, c
Shutting down guests on default URI...
Starting shutdown on guest: a
Shutdown of guest a failed to complete in time.Starting shutdown on guest: b
Shutdown of guest b failed to complete in time.Starting shutdown on guest: d
Shutdown of guest d failed to complete in time.Starting shutdown on guest: c
Shutdown of guest c failed to complete in time.libvirt-guests is configured not to start any guests on boot

* tools/libvirt-guests.sh.in (shutdown_guest): Add missing newline.
Reported by Xuesong Zhang.
2013-03-25 08:38:35 -06:00
Cole Robinson
d13155c20c tools: Only install guests init script if --with-init=script=redhat
Most of this deals with moving the libvirt-guests.sh script which
does all the work to /usr/libexec, so it can be shared by both
systemd and traditional init. Previously systemd depended on
the script being in /etc/init.d

Required to fix https://bugzilla.redhat.com/show_bug.cgi?id=789747
2012-12-11 19:54:37 -05:00