/*
* virnodesuspend.c: Support for suspending a node (host machine)
*
+ * Copyright (C) 2014 Red Hat, Inc.
* Copyright (C) 2011 Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
*
* This library is free software; you can redistribute it and/or
virCommandFree(cmd);
return ret;
}
-#endif
+#else /* ! WITH_PM_UTILS */
+static int
+virNodeSuspendSupportsTargetPMUtils(unsigned int target ATTRIBUTE_UNUSED,
+ bool *supported ATTRIBUTE_UNUSED)
+{
+ return -2;
+}
+#endif /* ! WITH_PM_UTILS */
static int
virNodeSuspendSupportsTargetSystemd(unsigned int target, bool *supported)
int ret;
ret = virNodeSuspendSupportsTargetSystemd(target, supported);
-#ifdef WITH_PM_UTILS
- if (ret < 0)
+
+ /* If just unavailable, try other options */
+ if (ret == -2)
ret = virNodeSuspendSupportsTargetPMUtils(target, supported);
-#endif
+
+ /* If still unavailable, then report error */
+ if (ret == -2) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot probe for supported suspend types"));
+ ret = -1;
+ }
return ret;
}
/*
* virsystemd.c: helpers for using systemd APIs
*
- * Copyright (C) 2013 Red Hat, Inc.
+ * Copyright (C) 2013, 2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#endif
}
+#ifdef WITH_SYSTEMD_DAEMON
static int
virSystemdPMSupportTarget(const char *methodName, bool *result)
{
return ret;
}
+#else /* ! WITH_SYSTEMD_DAEMON */
+static int
+virSystemdPMSupportTarget(const char *methodName ATTRIBUTE_UNUSED,
+ bool *result ATTRIBUTE_UNUSED)
+{
+ return -2;
+}
+#endif /* ! WITH_SYSTEMD_DAEMON */
int virSystemdCanSuspend(bool *result)
{