mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
Fix values of PM target type constants
The VIR_NODE_SUSPEND_TARGET constants are not flags, so they should just be assigned straightforward incrementing values. * include/libvirt/libvirt.h.in: Change VIR_NODE_SUSPEND_TARGET values * src/util/virnodesuspend.c: Fix suspend target checks
This commit is contained in:
parent
a001a5e28b
commit
866b0a7069
@ -257,9 +257,12 @@ typedef enum {
|
|||||||
* transitioned to.
|
* transitioned to.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_NODE_SUSPEND_TARGET_MEM = (1 << 0),
|
VIR_NODE_SUSPEND_TARGET_MEM = 0,
|
||||||
VIR_NODE_SUSPEND_TARGET_DISK = (1 << 1),
|
VIR_NODE_SUSPEND_TARGET_DISK = 1,
|
||||||
VIR_NODE_SUSPEND_TARGET_HYBRID = (1 << 2),
|
VIR_NODE_SUSPEND_TARGET_HYBRID = 2,
|
||||||
|
|
||||||
|
/* This constant is subject to change */
|
||||||
|
VIR_NODE_SUSPEND_TARGET_LAST,
|
||||||
} virNodeSuspendTarget;
|
} virNodeSuspendTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,7 +213,7 @@ int nodeSuspendForDuration(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
/* Check if the host supports the requested suspend target */
|
/* Check if the host supports the requested suspend target */
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case VIR_NODE_SUSPEND_TARGET_MEM:
|
case VIR_NODE_SUSPEND_TARGET_MEM:
|
||||||
if (hostPMFeatures & VIR_NODE_SUSPEND_TARGET_MEM) {
|
if (hostPMFeatures & (1 << VIR_NODE_SUSPEND_TARGET_MEM)) {
|
||||||
cmdString = strdup("pm-suspend");
|
cmdString = strdup("pm-suspend");
|
||||||
if (cmdString == NULL) {
|
if (cmdString == NULL) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
@ -225,7 +225,7 @@ int nodeSuspendForDuration(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
case VIR_NODE_SUSPEND_TARGET_DISK:
|
case VIR_NODE_SUSPEND_TARGET_DISK:
|
||||||
if (hostPMFeatures & VIR_NODE_SUSPEND_TARGET_DISK) {
|
if (hostPMFeatures & (1 << VIR_NODE_SUSPEND_TARGET_DISK)) {
|
||||||
cmdString = strdup("pm-hibernate");
|
cmdString = strdup("pm-hibernate");
|
||||||
if (cmdString == NULL) {
|
if (cmdString == NULL) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
@ -237,7 +237,7 @@ int nodeSuspendForDuration(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
case VIR_NODE_SUSPEND_TARGET_HYBRID:
|
case VIR_NODE_SUSPEND_TARGET_HYBRID:
|
||||||
if (hostPMFeatures & VIR_NODE_SUSPEND_TARGET_HYBRID) {
|
if (hostPMFeatures & (1 << VIR_NODE_SUSPEND_TARGET_HYBRID)) {
|
||||||
cmdString = strdup("pm-suspend-hybrid");
|
cmdString = strdup("pm-suspend-hybrid");
|
||||||
if (cmdString == NULL) {
|
if (cmdString == NULL) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user