}
+static int
+qemuProcessPrepareDomainNUMAPlacement(virDomainObjPtr vm,
+ virCapsPtr caps)
+{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ char *nodeset = NULL;
+ int ret = -1;
+
+ /* Get the advisory nodeset from numad if 'placement' of
+ * either <vcpu> or <numatune> is 'auto'.
+ */
+ if (!virDomainDefNeedsPlacementAdvice(vm->def))
+ return 0;
+
+ nodeset = virNumaGetAutoPlacementAdvice(virDomainDefGetVcpus(vm->def),
+ virDomainDefGetMemoryTotal(vm->def));
+
+ if (!nodeset)
+ goto cleanup;
+
+ VIR_DEBUG("Nodeset returned from numad: %s", nodeset);
+
+ if (virBitmapParse(nodeset, &priv->autoNodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ goto cleanup;
+
+ if (!(priv->autoCpuset = virCapabilitiesGetCpusForNodemask(caps,
+ priv->autoNodeset)))
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(nodeset);
+ return ret;
+}
+
+
/**
* qemuProcessPrepareDomain
*
{
int ret = -1;
size_t i;
- char *nodeset = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
virCapsPtr caps;
}
virDomainAuditSecurityLabel(vm, true);
- /* Get the advisory nodeset from numad if 'placement' of
- * either <vcpu> or <numatune> is 'auto'.
- */
- if (virDomainDefNeedsPlacementAdvice(vm->def)) {
- nodeset = virNumaGetAutoPlacementAdvice(virDomainDefGetVcpus(vm->def),
- virDomainDefGetMemoryTotal(vm->def));
- if (!nodeset)
- goto cleanup;
-
- VIR_DEBUG("Nodeset returned from numad: %s", nodeset);
-
- if (virBitmapParse(nodeset, &priv->autoNodeset,
- VIR_DOMAIN_CPUMASK_LEN) < 0)
- goto cleanup;
-
- if (!(priv->autoCpuset = virCapabilitiesGetCpusForNodemask(caps,
- priv->autoNodeset)))
- goto cleanup;
- }
+ if (qemuProcessPrepareDomainNUMAPlacement(vm, caps) < 0)
+ goto cleanup;
}
/* Whether we should use virtlogd as stdio handler for character
ret = 0;
cleanup:
- VIR_FREE(nodeset);
virObjectUnref(caps);
virObjectUnref(cfg);
return ret;