mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
util: be quiet when pm-is-supported is unavailable
Look up the binary name upfront to avoid the error: Cannot find 'pm-is-supported' in path: No such file or directory In that case, we just assume nodesuspend is not available. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
ab895d5dc3
commit
ff9aa7a862
@ -29,6 +29,7 @@
|
|||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
|
|
||||||
#include "viralloc.h"
|
#include "viralloc.h"
|
||||||
|
#include "virfile.h"
|
||||||
#include "virlog.h"
|
#include "virlog.h"
|
||||||
#include "virerror.h"
|
#include "virerror.h"
|
||||||
|
|
||||||
@ -239,11 +240,15 @@ static int
|
|||||||
virNodeSuspendSupportsTargetPMUtils(unsigned int target, bool *supported)
|
virNodeSuspendSupportsTargetPMUtils(unsigned int target, bool *supported)
|
||||||
{
|
{
|
||||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||||
const char *binary = "pm-is-supported";
|
VIR_AUTOFREE(char *) binary = NULL;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
*supported = false;
|
*supported = false;
|
||||||
|
|
||||||
|
binary = virFindFileInPath("pm-is-supported");
|
||||||
|
if (!binary)
|
||||||
|
return -2;
|
||||||
|
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case VIR_NODE_SUSPEND_TARGET_MEM:
|
case VIR_NODE_SUSPEND_TARGET_MEM:
|
||||||
cmd = virCommandNewArgList(binary, "--suspend", NULL);
|
cmd = virCommandNewArgList(binary, "--suspend", NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user