diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 11ad5f41dc..28fbeade6a 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -495,8 +495,11 @@ virCPUDefFormatBufFull(virBufferPtr buf,
virArchToString(def->arch));
if (virCPUDefFormatBuf(buf, def, updateCPU) < 0)
return -1;
- virBufferAdjustIndent(buf, -2);
+ if (virDomainNumaDefCPUFormat(buf, def) < 0)
+ return -1;
+
+ virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "\n");
return 0;
@@ -591,30 +594,6 @@ virCPUDefFormatBuf(virBufferPtr buf,
}
}
- if (def->ncells) {
- virBufferAddLit(buf, "\n");
- virBufferAdjustIndent(buf, 2);
- for (i = 0; i < def->ncells; i++) {
- virMemAccess memAccess = def->cells[i].memAccess;
- char *cpustr = NULL;
-
- if (!(cpustr = virBitmapFormat(def->cells[i].cpumask)))
- return -1;
-
- virBufferAddLit(buf, "cells[i].mem);
- virBufferAddLit(buf, " unit='KiB'");
- if (memAccess)
- virBufferAsprintf(buf, " memAccess='%s'",
- virMemAccessTypeToString(memAccess));
- virBufferAddLit(buf, "/>\n");
- VIR_FREE(cpustr);
- }
- virBufferAdjustIndent(buf, -2);
- virBufferAddLit(buf, " | \n");
- }
return 0;
}
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 9284969950..8b1b00a87e 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -777,3 +777,40 @@ virDomainNumaDefCPUParseXML(virCPUDefPtr def,
VIR_FREE(tmp);
return ret;
}
+
+
+int
+virDomainNumaDefCPUFormat(virBufferPtr buf,
+ virCPUDefPtr def)
+{
+ virMemAccess memAccess;
+ char *cpustr;
+ size_t i;
+
+ if (def->ncells == 0)
+ return 0;
+
+ virBufferAddLit(buf, "\n");
+ virBufferAdjustIndent(buf, 2);
+ for (i = 0; i < def->ncells; i++) {
+ memAccess = def->cells[i].memAccess;
+
+ if (!(cpustr = virBitmapFormat(def->cells[i].cpumask)))
+ return -1;
+
+ virBufferAddLit(buf, "cells[i].mem);
+ virBufferAddLit(buf, " unit='KiB'");
+ if (memAccess)
+ virBufferAsprintf(buf, " memAccess='%s'",
+ virMemAccessTypeToString(memAccess));
+ virBufferAddLit(buf, "/>\n");
+ VIR_FREE(cpustr);
+ }
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, " | \n");
+
+ return 0;
+}
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index 78b24a1bc1..0482ade964 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -117,5 +117,6 @@ bool virDomainNumatuneNodeSpecified(virDomainNumatunePtr numatune,
int cellid);
int virDomainNumaDefCPUParseXML(virCPUDefPtr def, xmlXPathContextPtr ctxt);
+int virDomainNumaDefCPUFormat(virBufferPtr buf, virCPUDefPtr def);
#endif /* __NUMA_CONF_H__ */