On 03/28/2014 01:49 PM, Doug Goldstein wrote:
On Mar 28, 2014, at 11:32 AM, Cédric Bosdonnat <cbosdonnat(a)suse.com> 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(-)
>
>
> + if (virFileReadAll("/sys/power/state", 1024, &buf) < 0)
> + goto cleanup;
> +
> case VIR_NODE_SUSPEND_TARGET_MEM:
> - cmd = virCommandNewArgList("pm-is-supported",
"--suspend", NULL);
> + *supported = canSuspend;
While systemd is used for a number of things there are other
platforms than Linux and there are Linux platforms that don't use systemd. Can't
we just wrap this in if not systemd?
How long has the kernel been providing /sys/power/state and
/sys/power/disk? It looks like pm-is-supported is just a shell script
that greps these two files - so it makes total sense to me to likewise
just search these files ourselves instead of going through a shell
script to do it on our behalf. Thus, this patch is independent of
whether we use systemd, and more a case of avoiding a dependence on a
package for the use of a single shell script, especially for platforms
where systemd is taking over most other functionality in that package.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org