On Fri, Mar 28, 2014 at 02:07:36PM -0600, Eric Blake wrote:
On 03/28/2014 10:32 AM, Cédric Bosdonnat wrote:
> From: Cédric Bosdonnat <cedric.bosdonnat(a)free.fr>
>
> pm-is-supported is the only thing needed in pm-utils, better get rid of
> it since systemd is heavily used for libvirt.
> ---
> src/util/virnodesuspend.c | 34 ++++++++++++++++++++--------------
> 1 file changed, 20 insertions(+), 14 deletions(-)
You also need to modify libvirt.spec.in to drop the dependency.
>
>
> + if (virFileReadAll("/sys/power/state", 1024, &buf) < 0)
> + goto cleanup;
> +
> + states = virStringSplit(buf, " ", 0);
> +
> + canSuspend = (virStringArrayHasString(states, "mem") ||
> + virStringArrayHasString(states, "standby"));
> + canHibernate = virStringArrayHasString(states, "disk");
pm-is-supported checks a bit more than what your replacement checks.
For suspend, it declares yes if any of these succeed:
grep -q mem /sys/power/state
[ -c /dev/pmu ] && pm-pmu --check
grep -q standby /sys/power/state
For hibernate, it requires that BOTH of these succeed:
[ -f /sys/power/disk ]
grep -q disk /sys/power/state
For hybrid, it requires that all three succeed:
[ -f /sys/power/disk ] && \
grep -q disk /sys/power/state && \
grep -q suspend /sys/power/disk
as well as having fallback code to fake a hybrid sleep by joining the
other two states.
What concerns me is that this is what it does today. We also need to
check whether it did anything different on older hosts like REL-5
vintage.
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|