description). Further, the power management features
supported by the host are shown, such as Suspend-to-RAM (S3),
Suspend-to-Disk (S4) and Hybrid-Suspend (a combination of S3
- and S4). In case the query for power
- management features succeeded but the host does not support
+ and S4). In case the host does not support
any such feature, then an empty <power_management/>
- tag will be shown. Otherwise, if the query itself failed, no
- such tag will be displayed (i.e., there will not be any
- power_management block or empty tag in the XML).</p>
+ tag will be shown. </p>
<p>The second block (in blue) indicates the paravirtualization
support of the Xen support, you will see the os_type of xen
to indicate a paravirtual kernel, then architecture
virBufferAddLit(&xml, " </cpu>\n");
- if (caps->host.powerMgmt_valid) {
- /* The PM query was successful. */
- if (caps->host.powerMgmt) {
- /* The host supports some PM features. */
- unsigned int pm = caps->host.powerMgmt;
- virBufferAddLit(&xml, " <power_management>\n");
- while (pm) {
- int bit = ffs(pm) - 1;
- virBufferAsprintf(&xml, " <%s/>\n",
- virCapsHostPMTargetTypeToString(bit));
- pm &= ~(1U << bit);
- }
- virBufferAddLit(&xml, " </power_management>\n");
- } else {
- /* The host does not support any PM feature. */
- virBufferAddLit(&xml, " <power_management/>\n");
+ /* The PM query was successful. */
+ if (caps->host.powerMgmt) {
+ /* The host supports some PM features. */
+ unsigned int pm = caps->host.powerMgmt;
+ virBufferAddLit(&xml, " <power_management>\n");
+ while (pm) {
+ int bit = ffs(pm) - 1;
+ virBufferAsprintf(&xml, " <%s/>\n",
+ virCapsHostPMTargetTypeToString(bit));
+ pm &= ~(1U << bit);
}
+ virBufferAddLit(&xml, " </power_management>\n");
+ } else {
+ /* The host does not support any PM feature. */
+ virBufferAddLit(&xml, " <power_management/>\n");
}
if (caps->host.offlineMigrate) {
size_t nfeatures;
size_t nfeatures_max;
char **features;
- bool powerMgmt_valid;
unsigned int powerMgmt; /* Bitmask of the PM capabilities.
* See enum virHostPMCapability.
*/
/* Add the power management features of the host */
- if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0) {
+ if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0)
VIR_WARN("Failed to get host power management capabilities");
- caps->host.powerMgmt_valid = false;
- } else
- caps->host.powerMgmt_valid = true; /* The PM query succeeded. */
virCapabilitiesAddHostMigrateTransport(caps,
"tcp");
/* Check support for Suspend-to-RAM (S3) */
ret = virNodeSuspendSupportsTarget(VIR_NODE_SUSPEND_TARGET_MEM, &supported);
if (ret < 0)
- return -1;
+ goto error;
if (supported)
*bitmask |= (1 << VIR_NODE_SUSPEND_TARGET_MEM);
/* Check support for Suspend-to-Disk (S4) */
ret = virNodeSuspendSupportsTarget(VIR_NODE_SUSPEND_TARGET_DISK, &supported);
if (ret < 0)
- return -1;
+ goto error;
if (supported)
*bitmask |= (1 << VIR_NODE_SUSPEND_TARGET_DISK);
/* Check support for Hybrid-Suspend */
ret = virNodeSuspendSupportsTarget(VIR_NODE_SUSPEND_TARGET_HYBRID, &supported);
if (ret < 0)
- return -1;
+ goto error;
if (supported)
*bitmask |= (1 << VIR_NODE_SUSPEND_TARGET_HYBRID);
return 0;
+
+error:
+ *bitmask = 0;
+ return -1;
}