diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng
index c4cafc47ee..fb8203ad6d 100644
--- a/docs/schemas/capability.rng
+++ b/docs/schemas/capability.rng
@@ -157,16 +157,9 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 926ecb5a24..1290c9c15d 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -349,7 +349,7 @@ virCapabilitiesHostNUMAAddCell(virCapsHostNUMA *caps,
int ncpus,
virCapsHostNUMACellCPU **cpus,
int ndistances,
- virCapsHostNUMACellDistance **distances,
+ virNumaDistance **distances,
int npageinfo,
virCapsHostNUMACellPageInfo **pageinfo)
{
@@ -833,17 +833,7 @@ virCapabilitiesHostNUMAFormat(virBuffer *buf,
cell->pageinfo[j].avail);
}
- if (cell->ndistances) {
- virBufferAddLit(buf, "\n");
- virBufferAdjustIndent(buf, 2);
- for (j = 0; j < cell->ndistances; j++) {
- virBufferAsprintf(buf, "\n",
- cell->distances[j].node,
- cell->distances[j].distance);
- }
- virBufferAdjustIndent(buf, -2);
- virBufferAddLit(buf, "\n");
- }
+ virNumaDistanceFormat(buf, cell->distances, cell->ndistances);
virBufferAsprintf(buf, "\n", cell->ncpus);
virBufferAdjustIndent(buf, 2);
@@ -1457,10 +1447,10 @@ virCapabilitiesFillCPUInfo(int cpu_id G_GNUC_UNUSED,
static int
virCapabilitiesGetNUMADistances(int node,
- virCapsHostNUMACellDistance **distancesRet,
+ virNumaDistance **distancesRet,
int *ndistancesRet)
{
- virCapsHostNUMACellDistance *tmp = NULL;
+ virNumaDistance *tmp = NULL;
int tmp_size = 0;
int ret = -1;
int *distances = NULL;
@@ -1476,14 +1466,14 @@ virCapabilitiesGetNUMADistances(int node,
return 0;
}
- tmp = g_new0(virCapsHostNUMACellDistance, ndistances);
+ tmp = g_new0(virNumaDistance, ndistances);
for (i = 0; i < ndistances; i++) {
if (!distances[i])
continue;
- tmp[tmp_size].node = i;
- tmp[tmp_size].distance = distances[i];
+ tmp[tmp_size].cellid = i;
+ tmp[tmp_size].value = distances[i];
tmp_size++;
}
@@ -1607,7 +1597,7 @@ virCapabilitiesHostNUMAInitReal(virCapsHostNUMA *caps)
for (n = 0; n <= max_node; n++) {
g_autoptr(virBitmap) cpumap = NULL;
- g_autofree virCapsHostNUMACellDistance *distances = NULL;
+ g_autofree virNumaDistance *distances = NULL;
int ndistances = 0;
g_autofree virCapsHostNUMACellPageInfo *pageinfo = NULL;
int npageinfo;
diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index f11471ef6c..4d4ac476ea 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -94,11 +94,6 @@ struct _virCapsHostNUMACellCPU {
virBitmap *siblings;
};
-struct _virCapsHostNUMACellDistance {
- int node; /* foreign NUMA node */
- unsigned int distance; /* distance to the node */
-};
-
struct _virCapsHostNUMACellPageInfo {
unsigned int size; /* page size in kibibytes */
unsigned long long avail; /* the size of pool */
@@ -109,8 +104,8 @@ struct _virCapsHostNUMACell {
int ncpus;
unsigned long long mem; /* in kibibytes */
virCapsHostNUMACellCPU *cpus;
- int ndistances;
- virCapsHostNUMACellDistance *distances;
+ size_t ndistances;
+ virNumaDistance *distances;
int npageinfo;
virCapsHostNUMACellPageInfo *pageinfo;
};
@@ -256,7 +251,7 @@ virCapabilitiesHostNUMAAddCell(virCapsHostNUMA *caps,
int ncpus,
virCapsHostNUMACellCPU **cpus,
int ndistances,
- virCapsHostNUMACellDistance **distances,
+ virNumaDistance **distances,
int npageinfo,
virCapsHostNUMACellPageInfo **pageinfo);
diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h
index d21d5a1be3..b21068486e 100644
--- a/src/conf/virconftypes.h
+++ b/src/conf/virconftypes.h
@@ -60,8 +60,6 @@ typedef struct _virCapsHostNUMACellCPU virCapsHostNUMACellCPU;
typedef struct _virCapsHostNUMACellPageInfo virCapsHostNUMACellPageInfo;
-typedef struct _virCapsHostNUMACellDistance virCapsHostNUMACellDistance;
-
typedef struct _virCapsHostSecModel virCapsHostSecModel;
typedef struct _virCapsHostSecModelLabel virCapsHostSecModelLabel;
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index d1a1241279..a73f13f829 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -249,7 +249,7 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCaps *caps)
libxl_cputopology *cpu_topo = NULL;
int nr_nodes = 0, nr_cpus = 0, nr_distances = 0;
virCapsHostNUMACellCPU **cpus = NULL;
- virCapsHostNUMACellDistance *distances = NULL;
+ virNumaDistance *distances = NULL;
int *nr_cpus_node = NULL;
size_t i;
int ret = -1;
@@ -320,11 +320,11 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCaps *caps)
if (nr_distances) {
size_t j;
- distances = g_new0(virCapsHostNUMACellDistance, nr_distances);
+ distances = g_new0(virNumaDistance, nr_distances);
for (j = 0; j < nr_distances; j++) {
- distances[j].node = j;
- distances[j].distance = numa_info[i].dists[j];
+ distances[j].cellid = j;
+ distances[j].value = numa_info[i].dists[j];
}
}