qemu: consider available CPUs in iothread info output

Following the rationale from commit
<2020c6af8a8e4bb04acb629d089142be984484c8> we should do the same thing
for iothread info as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Pavel Hrdina 2020-08-07 16:04:41 +02:00
parent 6a00352f67
commit b94cde18ff

View File

@ -5693,16 +5693,12 @@ qemuDomainGetIOThreadsConfig(virDomainDefPtr targetDef,
virDomainIOThreadInfoPtr *info_ret = NULL; virDomainIOThreadInfoPtr *info_ret = NULL;
virBitmapPtr bitmap = NULL; virBitmapPtr bitmap = NULL;
virBitmapPtr cpumask = NULL; virBitmapPtr cpumask = NULL;
int hostcpus;
size_t i; size_t i;
int ret = -1; int ret = -1;
if (targetDef->niothreadids == 0) if (targetDef->niothreadids == 0)
return 0; return 0;
if ((hostcpus = virHostCPUGetCount()) < 0)
goto cleanup;
if (VIR_ALLOC_N(info_ret, targetDef->niothreadids) < 0) if (VIR_ALLOC_N(info_ret, targetDef->niothreadids) < 0)
goto cleanup; goto cleanup;
@ -5718,9 +5714,8 @@ qemuDomainGetIOThreadsConfig(virDomainDefPtr targetDef,
if (targetDef->cpumask) { if (targetDef->cpumask) {
cpumask = targetDef->cpumask; cpumask = targetDef->cpumask;
} else { } else {
if (!(bitmap = virBitmapNew(hostcpus))) if (!(bitmap = virHostCPUGetAvailableCPUsBitmap()))
goto cleanup; goto cleanup;
virBitmapSetAll(bitmap);
cpumask = bitmap; cpumask = bitmap;
} }
} }