提交 e764ec7a 编写于 作者: M Martin Kletzander

numatune: unify numatune struct and enum names

Since there was already public virDomainNumatune*, I changed the
private virNumaTune to match the same, so all the uses are unified and
public API is kept:

s/vir\(Domain\)\?Numa[tT]une/virDomainNumatune/g

then shrunk long lines, and mainly functions, that were created after
that:

sed -i 's/virDomainNumatuneMemPlacementMode/virDomainNumatunePlacement/g'

And to cope with the enum name, I haad to change the constants as
well:

s/VIR_NUMA_TUNE_MEM_PLACEMENT_MODE/VIR_DOMAIN_NUMATUNE_PLACEMENT/g

Last thing I did was at least a little shortening of already long
name:

s/virDomainNumatuneDef/virDomainNumatune/g
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 293d5f21
......@@ -11849,7 +11849,7 @@ virDomainDefParseXML(xmlDocPtr xml,
int placement_mode = 0;
if (placement) {
if ((placement_mode =
virNumaTuneMemPlacementModeTypeFromString(placement)) < 0) {
virDomainNumatunePlacementTypeFromString(placement)) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unsupported memory placement "
"mode '%s'"), placement);
......@@ -11859,18 +11859,18 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(placement);
} else if (def->numatune.memory.nodemask) {
/* Defaults to "static" if nodeset is specified. */
placement_mode = VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC;
placement_mode = VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
} else {
/* Defaults to "placement" of <vcpu> if nodeset is
* not specified.
*/
if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC)
placement_mode = VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC;
placement_mode = VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
else
placement_mode = VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO;
placement_mode = VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO;
}
if (placement_mode == VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC &&
if (placement_mode == VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC &&
!def->numatune.memory.nodemask) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("nodeset for NUMA memory tuning must be set "
......@@ -11879,7 +11879,7 @@ virDomainDefParseXML(xmlDocPtr xml,
}
/* Ignore 'nodeset' if 'placement' is 'auto' finally */
if (placement_mode == VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO) {
if (placement_mode == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO) {
virBitmapFree(def->numatune.memory.nodemask);
def->numatune.memory.nodemask = NULL;
}
......@@ -11887,7 +11887,7 @@ virDomainDefParseXML(xmlDocPtr xml,
/* Copy 'placement' of <numatune> to <vcpu> if its 'placement'
* is not specified and 'placement' of <numatune> is specified.
*/
if (placement_mode == VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO &&
if (placement_mode == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO &&
!def->cpumask)
def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO;
......@@ -11906,7 +11906,7 @@ virDomainDefParseXML(xmlDocPtr xml,
* and 'placement' of <vcpu> is 'auto'.
*/
if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
def->numatune.memory.placement_mode = VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO;
def->numatune.memory.placement_mode = VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO;
def->numatune.memory.mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
}
}
......@@ -17539,13 +17539,13 @@ virDomainDefFormatInternal(virDomainDefPtr def,
virBufferAsprintf(buf, "<memory mode='%s' ", mode);
if (def->numatune.memory.placement_mode ==
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC) {
VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC) {
if (!(nodemask = virBitmapFormat(def->numatune.memory.nodemask)))
goto error;
virBufferAsprintf(buf, "nodeset='%s'/>\n", nodemask);
VIR_FREE(nodemask);
} else if (def->numatune.memory.placement_mode) {
placement = virNumaTuneMemPlacementModeTypeToString(def->numatune.memory.placement_mode);
placement = virDomainNumatunePlacementTypeToString(def->numatune.memory.placement_mode);
virBufferAsprintf(buf, "placement='%s'/>\n", placement);
}
virBufferAdjustIndent(buf, -2);
......
......@@ -1897,7 +1897,7 @@ struct _virDomainDef {
virDomainVcpuPinDefPtr emulatorpin;
} cputune;
virNumaTuneDef numatune;
virDomainNumatune numatune;
virDomainResourceDefPtr resource;
virDomainIdMapDef idmap;
......
......@@ -30,8 +30,8 @@ VIR_ENUM_IMPL(virDomainNumatuneMemMode,
"preferred",
"interleave");
VIR_ENUM_IMPL(virNumaTuneMemPlacementMode,
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST,
VIR_ENUM_IMPL(virDomainNumatunePlacement,
VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST,
"default",
"static",
"auto");
......@@ -28,24 +28,24 @@
# include "virbitmap.h"
typedef enum {
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_DEFAULT = 0,
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC,
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO,
VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT = 0,
VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC,
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO,
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST
} virDomainNumaTuneMemPlacementMode;
VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST
} virDomainNumatunePlacement;
VIR_ENUM_DECL(virNumaTuneMemPlacementMode)
VIR_ENUM_DECL(virDomainNumatunePlacement)
VIR_ENUM_DECL(virDomainNumatuneMemMode)
typedef struct _virNumaTuneDef virNumaTuneDef;
typedef virNumaTuneDef *virNumaTuneDefPtr;
struct _virNumaTuneDef {
typedef struct _virDomainNumatune virDomainNumatune;
typedef virDomainNumatune *virDomainNumatunePtr;
struct _virDomainNumatune {
struct {
virBitmapPtr nodemask;
int mode; /* enum virDomainNumatuneMemMode */
int placement_mode; /* enum virNumaTuneMemPlacementMode */
int placement_mode; /* enum virDomainNumatunePlacement */
} memory; /* pinning for all the memory */
/* Future NUMA tuning related stuff should go here. */
......
......@@ -609,8 +609,8 @@ virNodeDeviceObjUnlock;
# conf/numatune_conf.h
virDomainNumatuneMemModeTypeFromString;
virDomainNumatuneMemModeTypeToString;
virNumaTuneMemPlacementModeTypeFromString;
virNumaTuneMemPlacementModeTypeToString;
virDomainNumatunePlacementTypeFromString;
virDomainNumatunePlacementTypeToString;
# conf/nwfilter_conf.h
......
......@@ -81,10 +81,10 @@ static int virLXCCgroupSetupCpusetTune(virDomainDefPtr def,
if ((def->numatune.memory.nodemask ||
(def->numatune.memory.placement_mode ==
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)) &&
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)) &&
def->numatune.memory.mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
if (def->numatune.memory.placement_mode ==
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)
mask = virBitmapFormat(nodemask);
else
mask = virBitmapFormat(def->numatune.memory.nodemask);
......
......@@ -656,7 +656,7 @@ static int virLXCControllerGetNumadAdvice(virLXCControllerPtr ctrl,
if ((ctrl->def->placement_mode ==
VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) ||
(ctrl->def->numatune.memory.placement_mode ==
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)) {
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)) {
nodeset = virNumaGetAutoPlacementAdvice(ctrl->def->vcpus,
ctrl->def->mem.cur_balloon);
if (!nodeset)
......
......@@ -720,7 +720,7 @@ lxcSetCpusetTune(virDomainDefPtr def, virConfPtr properties)
if ((value = virConfGetValue(properties, "lxc.cgroup.cpuset.mems")) &&
value->str) {
def->numatune.memory.placement_mode = VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC;
def->numatune.memory.placement_mode = VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
def->numatune.memory.mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
if (virBitmapParse(value->str, 0, &def->numatune.memory.nodemask,
VIR_DOMAIN_CPUMASK_LEN) < 0)
......
......@@ -603,11 +603,11 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm,
if ((vm->def->numatune.memory.nodemask ||
(vm->def->numatune.memory.placement_mode ==
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)) &&
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)) &&
vm->def->numatune.memory.mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
if (vm->def->numatune.memory.placement_mode ==
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)
mem_mask = virBitmapFormat(nodemask);
else
mem_mask = virBitmapFormat(vm->def->numatune.memory.nodemask);
......
......@@ -8754,8 +8754,8 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
if (STREQ(param->field, VIR_DOMAIN_NUMA_MODE)) {
int mode = param->value.i;
if (mode >= VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST ||
mode < VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_DEFAULT)
if (mode >= VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST ||
mode < VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT)
{
virReportError(VIR_ERR_INVALID_ARG,
_("unsupported numa_mode: '%d'"), mode);
......@@ -8791,7 +8791,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
virBitmapFree(vm->def->numatune.memory.nodemask);
vm->def->numatune.memory.placement_mode =
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC;
VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
vm->def->numatune.memory.nodemask = virBitmapNewCopy(nodeset);
}
......@@ -8800,7 +8800,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
persistentDef->numatune.memory.nodemask = nodeset;
persistentDef->numatune.memory.placement_mode =
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC;
VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
nodeset = NULL;
}
virBitmapFree(nodeset);
......@@ -8810,7 +8810,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
if (!persistentDef->numatune.memory.placement_mode)
persistentDef->numatune.memory.placement_mode =
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO;
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO;
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0)
goto cleanup;
}
......
......@@ -3901,7 +3901,7 @@ int qemuProcessStart(virConnectPtr conn,
if ((vm->def->placement_mode ==
VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) ||
(vm->def->numatune.memory.placement_mode ==
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)) {
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)) {
nodeset = virNumaGetAutoPlacementAdvice(vm->def->vcpus,
vm->def->mem.max_balloon);
if (!nodeset)
......
......@@ -87,7 +87,7 @@ virNumaGetAutoPlacementAdvice(unsigned short vcpus ATTRIBUTE_UNUSED,
#if WITH_NUMACTL
int
virNumaSetupMemoryPolicy(virNumaTuneDef numatune,
virNumaSetupMemoryPolicy(virDomainNumatune numatune,
virBitmapPtr nodemask)
{
nodemask_t mask;
......@@ -100,13 +100,13 @@ virNumaSetupMemoryPolicy(virNumaTuneDef numatune,
virBitmapPtr tmp_nodemask = NULL;
if (numatune.memory.placement_mode ==
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC) {
VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC) {
if (!numatune.memory.nodemask)
return 0;
VIR_DEBUG("Set NUMA memory policy with specified nodeset");
tmp_nodemask = numatune.memory.nodemask;
} else if (numatune.memory.placement_mode ==
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO) {
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO) {
VIR_DEBUG("Set NUMA memory policy with advisory nodeset from numad");
tmp_nodemask = nodemask;
} else {
......@@ -327,7 +327,7 @@ virNumaGetNodeCPUs(int node,
#else
int
virNumaSetupMemoryPolicy(virNumaTuneDef numatune,
virNumaSetupMemoryPolicy(virDomainNumatune numatune,
virBitmapPtr nodemask ATTRIBUTE_UNUSED)
{
if (numatune.memory.nodemask) {
......
......@@ -31,7 +31,7 @@
char *virNumaGetAutoPlacementAdvice(unsigned short vcups,
unsigned long long balloon);
int virNumaSetupMemoryPolicy(virNumaTuneDef numatune,
int virNumaSetupMemoryPolicy(virDomainNumatune numatune,
virBitmapPtr nodemask);
bool virNumaIsAvailable(void);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册