mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemuBuildNumaCommandLine: Separate out building of CPU list
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
c9f47bfc7a
commit
9c47d2754c
@ -7281,6 +7281,31 @@ qemuBuildNumaHMATCommandLine(virCommand *cmd,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuBuildNumaCPUs(virBuffer *buf,
|
||||
virBitmap *cpu)
|
||||
{
|
||||
g_autofree char *cpumask = NULL;
|
||||
char *tmpmask = NULL;
|
||||
char *next = NULL;
|
||||
|
||||
if (!cpu)
|
||||
return 0;
|
||||
|
||||
if (!(cpumask = virBitmapFormat(cpu)))
|
||||
return -1;
|
||||
|
||||
for (tmpmask = cpumask; tmpmask; tmpmask = next) {
|
||||
if ((next = strchr(tmpmask, ',')))
|
||||
*(next++) = '\0';
|
||||
virBufferAddLit(buf, ",cpus=");
|
||||
virBufferAdd(buf, tmpmask, -1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg,
|
||||
virDomainDef *def,
|
||||
@ -7347,7 +7372,6 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg,
|
||||
}
|
||||
|
||||
for (i = 0; i < ncells; i++) {
|
||||
virBitmap *cpumask = virDomainNumaGetNodeCpumask(def->numa, i);
|
||||
ssize_t initiator = virDomainNumaGetNodeInitiator(def->numa, i);
|
||||
|
||||
if (needBackend) {
|
||||
@ -7358,21 +7382,8 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg,
|
||||
virCommandAddArg(cmd, "-numa");
|
||||
virBufferAsprintf(&buf, "node,nodeid=%zu", i);
|
||||
|
||||
if (cpumask) {
|
||||
g_autofree char *cpumaskStr = NULL;
|
||||
char *next = NULL;
|
||||
char *tmpmask;
|
||||
|
||||
if (!(cpumaskStr = virBitmapFormat(cpumask)))
|
||||
goto cleanup;
|
||||
|
||||
for (tmpmask = cpumaskStr; tmpmask; tmpmask = next) {
|
||||
if ((next = strchr(tmpmask, ',')))
|
||||
*(next++) = '\0';
|
||||
virBufferAddLit(&buf, ",cpus=");
|
||||
virBufferAdd(&buf, tmpmask, -1);
|
||||
}
|
||||
}
|
||||
if (qemuBuildNumaCPUs(&buf, virDomainNumaGetNodeCpumask(def->numa, i)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (hmat) {
|
||||
if (initiator < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user