mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
conf: Move enum virMemAccess to the NUMA code and rename it
Name it virNumaMemAccess and add it to conf/numa_conf.[ch] Note that to avoid a circular dependency the type of the NUMA cell memAccess variable was changed to int. It will be turned back later after the circular dependency will not exist.
This commit is contained in:
parent
6bc80fa86d
commit
a3673b225d
@ -56,12 +56,6 @@ VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST,
|
||||
"disable",
|
||||
"forbid")
|
||||
|
||||
VIR_ENUM_IMPL(virMemAccess, VIR_MEM_ACCESS_LAST,
|
||||
"default",
|
||||
"shared",
|
||||
"private")
|
||||
|
||||
|
||||
void ATTRIBUTE_NONNULL(1)
|
||||
virCPUDefFreeModel(virCPUDefPtr def)
|
||||
{
|
||||
|
@ -83,16 +83,6 @@ typedef enum {
|
||||
|
||||
VIR_ENUM_DECL(virCPUFeaturePolicy)
|
||||
|
||||
typedef enum {
|
||||
VIR_MEM_ACCESS_DEFAULT,
|
||||
VIR_MEM_ACCESS_SHARED,
|
||||
VIR_MEM_ACCESS_PRIVATE,
|
||||
|
||||
VIR_MEM_ACCESS_LAST,
|
||||
} virMemAccess;
|
||||
|
||||
VIR_ENUM_DECL(virMemAccess)
|
||||
|
||||
typedef struct _virCPUFeatureDef virCPUFeatureDef;
|
||||
typedef virCPUFeatureDef *virCPUFeatureDefPtr;
|
||||
struct _virCPUFeatureDef {
|
||||
@ -105,7 +95,7 @@ typedef virCellDef *virCellDefPtr;
|
||||
struct _virCellDef {
|
||||
virBitmapPtr cpumask; /* CPUs that are part of this node */
|
||||
unsigned long long mem; /* Node memory in kB */
|
||||
virMemAccess memAccess;
|
||||
int memAccess; /* virNumaMemAccess */
|
||||
};
|
||||
|
||||
typedef struct _virCPUDef virCPUDef;
|
||||
|
@ -43,6 +43,11 @@ VIR_ENUM_IMPL(virDomainNumatunePlacement,
|
||||
"static",
|
||||
"auto");
|
||||
|
||||
VIR_ENUM_IMPL(virNumaMemAccess, VIR_NUMA_MEM_ACCESS_LAST,
|
||||
"default",
|
||||
"shared",
|
||||
"private");
|
||||
|
||||
typedef struct _virDomainNumaNode virDomainNumaNode;
|
||||
typedef virDomainNumaNode *virDomainNumaNodePtr;
|
||||
|
||||
@ -757,7 +762,7 @@ virDomainNumaDefCPUParseXML(virCPUDefPtr def,
|
||||
goto cleanup;
|
||||
|
||||
if ((tmp = virXMLPropString(nodes[i], "memAccess"))) {
|
||||
if ((rc = virMemAccessTypeFromString(tmp)) <= 0) {
|
||||
if ((rc = virNumaMemAccessTypeFromString(tmp)) <= 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Invalid 'memAccess' attribute value '%s'"),
|
||||
tmp);
|
||||
@ -783,7 +788,7 @@ int
|
||||
virDomainNumaDefCPUFormat(virBufferPtr buf,
|
||||
virCPUDefPtr def)
|
||||
{
|
||||
virMemAccess memAccess;
|
||||
virNumaMemAccess memAccess;
|
||||
char *cpustr;
|
||||
size_t i;
|
||||
|
||||
@ -805,7 +810,7 @@ virDomainNumaDefCPUFormat(virBufferPtr buf,
|
||||
virBufferAddLit(buf, " unit='KiB'");
|
||||
if (memAccess)
|
||||
virBufferAsprintf(buf, " memAccess='%s'",
|
||||
virMemAccessTypeToString(memAccess));
|
||||
virNumaMemAccessTypeToString(memAccess));
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
VIR_FREE(cpustr);
|
||||
}
|
||||
|
@ -46,6 +46,15 @@ typedef enum {
|
||||
VIR_ENUM_DECL(virDomainNumatunePlacement)
|
||||
VIR_ENUM_DECL(virDomainNumatuneMemMode)
|
||||
|
||||
typedef enum {
|
||||
VIR_NUMA_MEM_ACCESS_DEFAULT,
|
||||
VIR_NUMA_MEM_ACCESS_SHARED,
|
||||
VIR_NUMA_MEM_ACCESS_PRIVATE,
|
||||
|
||||
VIR_NUMA_MEM_ACCESS_LAST
|
||||
} virNumaMemAccess;
|
||||
|
||||
VIR_ENUM_DECL(virNumaMemAccess)
|
||||
|
||||
void virDomainNumaFree(virDomainNumaPtr numa);
|
||||
|
||||
|
@ -4558,7 +4558,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
|
||||
virDomainHugePagePtr hugepage = NULL;
|
||||
virDomainNumatuneMemMode mode;
|
||||
const long system_page_size = virGetSystemPageSizeKB();
|
||||
virMemAccess memAccess = def->cpu->cells[guestNode].memAccess;
|
||||
virNumaMemAccess memAccess = def->cpu->cells[guestNode].memAccess;
|
||||
size_t i;
|
||||
char *mem_path = NULL;
|
||||
virBitmapPtr nodemask = NULL;
|
||||
@ -4651,18 +4651,18 @@ qemuBuildMemoryBackendStr(unsigned long long size,
|
||||
goto cleanup;
|
||||
|
||||
switch (memAccess) {
|
||||
case VIR_MEM_ACCESS_SHARED:
|
||||
case VIR_NUMA_MEM_ACCESS_SHARED:
|
||||
if (virJSONValueObjectAdd(props, "b:share", true, NULL) < 0)
|
||||
goto cleanup;
|
||||
break;
|
||||
|
||||
case VIR_MEM_ACCESS_PRIVATE:
|
||||
case VIR_NUMA_MEM_ACCESS_PRIVATE:
|
||||
if (virJSONValueObjectAdd(props, "b:share", false, NULL) < 0)
|
||||
goto cleanup;
|
||||
break;
|
||||
|
||||
case VIR_MEM_ACCESS_DEFAULT:
|
||||
case VIR_MEM_ACCESS_LAST:
|
||||
case VIR_NUMA_MEM_ACCESS_DEFAULT:
|
||||
case VIR_NUMA_MEM_ACCESS_LAST:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user