mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
numa: conf: Tweak parameters of virDomainNumatuneSet
As virDomainNumatuneSet now doesn't allocate the virDomainNuma object any longer it's not necessary to pass the pointer to a pointer to store the object as it will not change any longer. While touching the parameter definitions I've also changed the name of the parameter to "numa".
This commit is contained in:
parent
21008c013c
commit
fa9930720b
@ -245,7 +245,7 @@ virDomainNumatuneParseXML(virDomainNumaPtr *numatunePtr,
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
|
||||
if (virDomainNumatuneSet(numatunePtr,
|
||||
if (virDomainNumatuneSet(*numatunePtr,
|
||||
placement_static,
|
||||
placement,
|
||||
mode,
|
||||
@ -438,20 +438,19 @@ virDomainNumatuneMaybeFormatNodeset(virDomainNumaPtr numatune,
|
||||
}
|
||||
|
||||
int
|
||||
virDomainNumatuneSet(virDomainNumaPtr *numatunePtr,
|
||||
virDomainNumatuneSet(virDomainNumaPtr numa,
|
||||
bool placement_static,
|
||||
int placement,
|
||||
int mode,
|
||||
virBitmapPtr nodeset)
|
||||
{
|
||||
int ret = -1;
|
||||
virDomainNumaPtr numatune = *numatunePtr;
|
||||
|
||||
/* No need to do anything in this case */
|
||||
if (mode == -1 && placement == -1 && !nodeset)
|
||||
return 0;
|
||||
|
||||
if (!numatune->memory.specified) {
|
||||
if (!numa->memory.specified) {
|
||||
if (mode == -1)
|
||||
mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
|
||||
if (placement == -1)
|
||||
@ -476,26 +475,25 @@ virDomainNumatuneSet(virDomainNumaPtr *numatunePtr,
|
||||
}
|
||||
|
||||
if (mode != -1)
|
||||
numatune->memory.mode = mode;
|
||||
numa->memory.mode = mode;
|
||||
|
||||
if (nodeset) {
|
||||
virBitmapFree(numatune->memory.nodeset);
|
||||
numatune->memory.nodeset = virBitmapNewCopy(nodeset);
|
||||
if (!numatune->memory.nodeset)
|
||||
virBitmapFree(numa->memory.nodeset);
|
||||
if (!(numa->memory.nodeset = virBitmapNewCopy(nodeset)))
|
||||
goto cleanup;
|
||||
if (placement == -1)
|
||||
placement = VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
|
||||
}
|
||||
|
||||
if (placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT) {
|
||||
if (numatune->memory.nodeset || placement_static)
|
||||
if (numa->memory.nodeset || placement_static)
|
||||
placement = VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
|
||||
else
|
||||
placement = VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO;
|
||||
}
|
||||
|
||||
if (placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC &&
|
||||
!numatune->memory.nodeset) {
|
||||
!numa->memory.nodeset) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("nodeset for NUMA memory tuning must be set "
|
||||
"if 'placement' is 'static'"));
|
||||
@ -504,15 +502,15 @@ virDomainNumatuneSet(virDomainNumaPtr *numatunePtr,
|
||||
|
||||
/* setting nodeset when placement auto is invalid */
|
||||
if (placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO &&
|
||||
numatune->memory.nodeset) {
|
||||
virBitmapFree(numatune->memory.nodeset);
|
||||
numatune->memory.nodeset = NULL;
|
||||
numa->memory.nodeset) {
|
||||
virBitmapFree(numa->memory.nodeset);
|
||||
numa->memory.nodeset = NULL;
|
||||
}
|
||||
|
||||
if (placement != -1)
|
||||
numatune->memory.placement = placement;
|
||||
numa->memory.placement = placement;
|
||||
|
||||
numatune->memory.specified = true;
|
||||
numa->memory.specified = true;
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
@ -101,7 +101,7 @@ int virDomainNumatuneMaybeFormatNodeset(virDomainNumaPtr numatune,
|
||||
/*
|
||||
* Setters
|
||||
*/
|
||||
int virDomainNumatuneSet(virDomainNumaPtr *numatunePtr,
|
||||
int virDomainNumatuneSet(virDomainNumaPtr numa,
|
||||
bool placement_static,
|
||||
int placement,
|
||||
int mode,
|
||||
|
@ -847,7 +847,7 @@ lxcSetCpusetTune(virDomainDefPtr def, virConfPtr properties)
|
||||
value->str) {
|
||||
if (virBitmapParse(value->str, 0, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
|
||||
return -1;
|
||||
if (virDomainNumatuneSet(&def->numa,
|
||||
if (virDomainNumatuneSet(def->numa,
|
||||
def->placement_mode ==
|
||||
VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
|
||||
VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC,
|
||||
|
@ -9543,7 +9543,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
|
||||
qemuDomainSetNumaParamsLive(vm, nodeset) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (virDomainNumatuneSet(&vm->def->numa,
|
||||
if (virDomainNumatuneSet(vm->def->numa,
|
||||
vm->def->placement_mode ==
|
||||
VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
|
||||
-1, mode, nodeset) < 0)
|
||||
@ -9554,7 +9554,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
|
||||
}
|
||||
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
if (virDomainNumatuneSet(&persistentDef->numa,
|
||||
if (virDomainNumatuneSet(persistentDef->numa,
|
||||
persistentDef->placement_mode ==
|
||||
VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
|
||||
-1, mode, nodeset) < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user