提交 df55ed4b 编写于 作者: P Peter Krempa

libxl: Unbreak vcpu pinning

Libxl's vcpu pinning would work only if the vcpu array was ordered and
was not sparse. Remove the condition and iterate the pinning array
properly.
上级 4f3f8ca8
......@@ -794,24 +794,22 @@ int
libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
{
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
virDomainDefPtr def = vm->def;
virDomainPinDefPtr pin;
libxl_bitmap map;
virBitmapPtr cpumask = NULL;
int vcpu;
size_t i;
int ret = -1;
for (vcpu = 0; vcpu < def->cputune.nvcpupin; ++vcpu) {
if (vcpu != def->cputune.vcpupin[vcpu]->id)
continue;
cpumask = def->cputune.vcpupin[vcpu]->cpumask;
for (i = 0; i < vm->def->cputune.nvcpupin; ++i) {
pin = vm->def->cputune.vcpupin[i];
cpumask = pin->cpumask;
if (virBitmapToData(cpumask, &map.map, (int *)&map.size) < 0)
goto cleanup;
if (libxl_set_vcpuaffinity(cfg->ctx, def->id, vcpu, &map) != 0) {
if (libxl_set_vcpuaffinity(cfg->ctx, vm->def->id, pin->id, &map) != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to pin vcpu '%d' with libxenlight"), vcpu);
_("Failed to pin vcpu '%d' with libxenlight"), pin->id);
goto cleanup;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册