]> xenbits.xensource.com Git - libvirt.git/commitdiff
nodesuspend: report unsupported if systemd & pm-utils aren't available
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 23 May 2019 15:55:22 +0000 (16:55 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Mon, 17 Jun 2019 14:02:24 +0000 (15:02 +0100)
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é <berrange@redhat.com>
src/util/virnodesuspend.c

index 0af0908e4ae118565ecbb4387ca52f98679d8b6d..3fc5b93ac765e04ca73e10d63dc1ce38a468ba0a 100644 (file)
@@ -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;