From: Daniel P. Berrangé Date: Thu, 23 May 2019 15:55:22 +0000 (+0100) Subject: nodesuspend: report unsupported if systemd & pm-utils aren't available X-Git-Tag: v5.5.0-rc1~263 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c1e03508584ab0daa9da33ea07f720c9587538c;p=thirdparty%2Flibvirt.git nodesuspend: report unsupported if systemd & pm-utils aren't available When libvirtd is run inside a container it is normal that neither systemd nor pm-utils will be available. In this case there is no way to suspend the host, so libvirt should just report the feature unsupported instead of raising an error. Signed-off-by: Daniel P. Berrangé --- diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c index 0af0908e4a..3fc5b93ac7 100644 --- a/src/util/virnodesuspend.c +++ b/src/util/virnodesuspend.c @@ -330,11 +330,10 @@ virNodeSuspendSupportsTarget(unsigned int target, bool *supported) if (ret == -2) ret = virNodeSuspendSupportsTargetPMUtils(target, supported); - /* If still unavailable, then report error */ + /* If still unavailable, then report unsupported */ if (ret == -2) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot probe for supported suspend types")); - ret = -1; + *supported = false; + ret = 0; } return ret;