mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
conf: Rename max_balloon to total_memory
The name of the variable was misleading. Rename it and it's setting accessor before other fixes.
This commit is contained in:
parent
849b5fc4f6
commit
8059a99025
@ -7706,27 +7706,27 @@ virDomainDefGetMemoryInitial(virDomainDefPtr def)
|
|||||||
if ((ret = virDomainNumaGetMemorySize(def->numa)) > 0) {
|
if ((ret = virDomainNumaGetMemorySize(def->numa)) > 0) {
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
ret = def->mem.max_balloon;
|
ret = def->mem.total_memory;
|
||||||
for (i = 0; i < def->nmems; i++)
|
for (i = 0; i < def->nmems; i++)
|
||||||
ret -= def->mems[i]->size;
|
ret -= def->mems[i]->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return def->mem.max_balloon;
|
return def->mem.total_memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virDomainDefSetMemoryInitial:
|
* virDomainDefSetMemoryTotal:
|
||||||
* @def: domain definition
|
* @def: domain definition
|
||||||
* @size: size to set
|
* @size: size to set
|
||||||
*
|
*
|
||||||
* Sets the initial memory size in @def.
|
* Sets the total memory size in @def.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
virDomainDefSetMemoryInitial(virDomainDefPtr def,
|
virDomainDefSetMemoryTotal(virDomainDefPtr def,
|
||||||
unsigned long long size)
|
unsigned long long size)
|
||||||
{
|
{
|
||||||
def->mem.max_balloon = size;
|
def->mem.total_memory = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -7748,7 +7748,7 @@ virDomainDefGetMemoryActual(virDomainDefPtr def)
|
|||||||
for (i = 0; i < def->nmems; i++)
|
for (i = 0; i < def->nmems; i++)
|
||||||
ret += def->mems[i]->size;
|
ret += def->mems[i]->size;
|
||||||
} else {
|
} else {
|
||||||
ret = def->mem.max_balloon;
|
ret = def->mem.total_memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -14763,7 +14763,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
|
|
||||||
/* Extract domain memory */
|
/* Extract domain memory */
|
||||||
if (virDomainParseMemory("./memory[1]", NULL, ctxt,
|
if (virDomainParseMemory("./memory[1]", NULL, ctxt,
|
||||||
&def->mem.max_balloon, false, true) < 0)
|
&def->mem.total_memory, false, true) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (virDomainParseMemory("./currentMemory[1]", NULL, ctxt,
|
if (virDomainParseMemory("./currentMemory[1]", NULL, ctxt,
|
||||||
|
@ -2142,8 +2142,9 @@ typedef struct _virDomainMemtune virDomainMemtune;
|
|||||||
typedef virDomainMemtune *virDomainMemtunePtr;
|
typedef virDomainMemtune *virDomainMemtunePtr;
|
||||||
|
|
||||||
struct _virDomainMemtune {
|
struct _virDomainMemtune {
|
||||||
unsigned long long max_balloon; /* in kibibytes, capped at ulong thanks
|
/* total memory size including memory modules in kibibytes, this field
|
||||||
to virDomainGetMaxMemory */
|
* should be accessed only via accessors */
|
||||||
|
unsigned long long total_memory;
|
||||||
unsigned long long cur_balloon; /* in kibibytes, capped at ulong thanks
|
unsigned long long cur_balloon; /* in kibibytes, capped at ulong thanks
|
||||||
to virDomainGetInfo */
|
to virDomainGetInfo */
|
||||||
|
|
||||||
@ -2322,7 +2323,7 @@ struct _virDomainDef {
|
|||||||
};
|
};
|
||||||
|
|
||||||
unsigned long long virDomainDefGetMemoryInitial(virDomainDefPtr def);
|
unsigned long long virDomainDefGetMemoryInitial(virDomainDefPtr def);
|
||||||
void virDomainDefSetMemoryInitial(virDomainDefPtr def, unsigned long long size);
|
void virDomainDefSetMemoryTotal(virDomainDefPtr def, unsigned long long size);
|
||||||
unsigned long long virDomainDefGetMemoryActual(virDomainDefPtr def);
|
unsigned long long virDomainDefGetMemoryActual(virDomainDefPtr def);
|
||||||
bool virDomainDefHasMemoryHotplug(const virDomainDef *def);
|
bool virDomainDefHasMemoryHotplug(const virDomainDef *def);
|
||||||
|
|
||||||
|
@ -870,7 +870,7 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
|||||||
if (VIR_STRDUP(def->description, virtualSystemSettingData->data->Notes) < 0)
|
if (VIR_STRDUP(def->description, virtualSystemSettingData->data->Notes) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virDomainDefSetMemoryInitial(def, memorySettingData->data->Limit * 1024); /* megabyte to kilobyte */
|
virDomainDefSetMemoryTotal(def, memorySettingData->data->Limit * 1024); /* megabyte to kilobyte */
|
||||||
def->mem.cur_balloon = memorySettingData->data->VirtualQuantity * 1024; /* megabyte to kilobyte */
|
def->mem.cur_balloon = memorySettingData->data->VirtualQuantity * 1024; /* megabyte to kilobyte */
|
||||||
|
|
||||||
def->vcpus = processorSettingData->data->VirtualQuantity;
|
def->vcpus = processorSettingData->data->VirtualQuantity;
|
||||||
|
@ -227,7 +227,7 @@ virDomainDefParseFile;
|
|||||||
virDomainDefParseNode;
|
virDomainDefParseNode;
|
||||||
virDomainDefParseString;
|
virDomainDefParseString;
|
||||||
virDomainDefPostParse;
|
virDomainDefPostParse;
|
||||||
virDomainDefSetMemoryInitial;
|
virDomainDefSetMemoryTotal;
|
||||||
virDomainDeleteConfig;
|
virDomainDeleteConfig;
|
||||||
virDomainDeviceAddressIsValid;
|
virDomainDeviceAddressIsValid;
|
||||||
virDomainDeviceAddressTypeToString;
|
virDomainDeviceAddressTypeToString;
|
||||||
|
@ -553,7 +553,7 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
|
|||||||
vm->def->vcpus = d_info.vcpu_online;
|
vm->def->vcpus = d_info.vcpu_online;
|
||||||
vm->def->maxvcpus = d_info.vcpu_max_id + 1;
|
vm->def->maxvcpus = d_info.vcpu_max_id + 1;
|
||||||
vm->def->mem.cur_balloon = d_info.current_memkb;
|
vm->def->mem.cur_balloon = d_info.current_memkb;
|
||||||
virDomainDefSetMemoryInitial(vm->def, d_info.max_memkb);
|
virDomainDefSetMemoryTotal(vm->def, d_info.max_memkb);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
@ -1498,7 +1498,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
|||||||
if (flags & VIR_DOMAIN_MEM_CONFIG) {
|
if (flags & VIR_DOMAIN_MEM_CONFIG) {
|
||||||
/* Help clang 2.8 decipher the logic flow. */
|
/* Help clang 2.8 decipher the logic flow. */
|
||||||
sa_assert(persistentDef);
|
sa_assert(persistentDef);
|
||||||
virDomainDefSetMemoryInitial(persistentDef, newmem);
|
virDomainDefSetMemoryTotal(persistentDef, newmem);
|
||||||
if (persistentDef->mem.cur_balloon > newmem)
|
if (persistentDef->mem.cur_balloon > newmem)
|
||||||
persistentDef->mem.cur_balloon = newmem;
|
persistentDef->mem.cur_balloon = newmem;
|
||||||
ret = virDomainSaveConfig(cfg->configDir, persistentDef);
|
ret = virDomainSaveConfig(cfg->configDir, persistentDef);
|
||||||
|
@ -734,7 +734,7 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||||
virDomainDefSetMemoryInitial(persistentDef, newmem);
|
virDomainDefSetMemoryTotal(persistentDef, newmem);
|
||||||
if (persistentDef->mem.cur_balloon > newmem)
|
if (persistentDef->mem.cur_balloon > newmem)
|
||||||
persistentDef->mem.cur_balloon = newmem;
|
persistentDef->mem.cur_balloon = newmem;
|
||||||
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0)
|
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0)
|
||||||
|
@ -770,7 +770,7 @@ lxcSetMemTune(virDomainDefPtr def, virConfPtr properties)
|
|||||||
if (lxcConvertSize(value->str, &size) < 0)
|
if (lxcConvertSize(value->str, &size) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
size = size / 1024;
|
size = size / 1024;
|
||||||
virDomainDefSetMemoryInitial(def, size);
|
virDomainDefSetMemoryTotal(def, size);
|
||||||
def->mem.hard_limit = virMemoryLimitTruncate(size);
|
def->mem.hard_limit = virMemoryLimitTruncate(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1010,7 +1010,7 @@ lxcParseConfigString(const char *config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vmdef->id = -1;
|
vmdef->id = -1;
|
||||||
virDomainDefSetMemoryInitial(vmdef, 64 * 1024);
|
virDomainDefSetMemoryTotal(vmdef, 64 * 1024);
|
||||||
|
|
||||||
vmdef->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART;
|
vmdef->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART;
|
||||||
vmdef->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY;
|
vmdef->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY;
|
||||||
|
@ -3281,7 +3281,7 @@ phypDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
virDomainDefSetMemoryInitial(&def, memory);
|
virDomainDefSetMemoryTotal(&def, memory);
|
||||||
|
|
||||||
if ((def.mem.cur_balloon =
|
if ((def.mem.cur_balloon =
|
||||||
phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0) {
|
phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0) {
|
||||||
|
@ -13010,7 +13010,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
|
|||||||
|
|
||||||
def->id = -1;
|
def->id = -1;
|
||||||
def->mem.cur_balloon = 64 * 1024;
|
def->mem.cur_balloon = 64 * 1024;
|
||||||
virDomainDefSetMemoryInitial(def, def->mem.cur_balloon);
|
virDomainDefSetMemoryTotal(def, def->mem.cur_balloon);
|
||||||
def->maxvcpus = 1;
|
def->maxvcpus = 1;
|
||||||
def->vcpus = 1;
|
def->vcpus = 1;
|
||||||
def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
|
def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
|
||||||
@ -13216,7 +13216,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
|
|||||||
_("cannot parse memory level '%s'"), val);
|
_("cannot parse memory level '%s'"), val);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
virDomainDefSetMemoryInitial(def, mem * 1024);
|
virDomainDefSetMemoryTotal(def, mem * 1024);
|
||||||
def->mem.cur_balloon = mem * 1024;
|
def->mem.cur_balloon = mem * 1024;
|
||||||
} else if (STREQ(arg, "-smp")) {
|
} else if (STREQ(arg, "-smp")) {
|
||||||
WANT_VALUE();
|
WANT_VALUE();
|
||||||
|
@ -3387,7 +3387,7 @@ qemuDomainAlignMemorySizes(virDomainDefPtr def)
|
|||||||
|
|
||||||
/* align initial memory size */
|
/* align initial memory size */
|
||||||
mem = virDomainDefGetMemoryInitial(def);
|
mem = virDomainDefGetMemoryInitial(def);
|
||||||
virDomainDefSetMemoryInitial(def, VIR_ROUND_UP(mem, align));
|
virDomainDefSetMemoryTotal(def, VIR_ROUND_UP(mem, align));
|
||||||
|
|
||||||
def->mem.max_memory = VIR_ROUND_UP(def->mem.max_memory, align);
|
def->mem.max_memory = VIR_ROUND_UP(def->mem.max_memory, align);
|
||||||
|
|
||||||
|
@ -2357,7 +2357,7 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
|||||||
goto endjob;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
virDomainDefSetMemoryInitial(persistentDef, newmem);
|
virDomainDefSetMemoryTotal(persistentDef, newmem);
|
||||||
|
|
||||||
if (persistentDef->mem.cur_balloon > newmem)
|
if (persistentDef->mem.cur_balloon > newmem)
|
||||||
persistentDef->mem.cur_balloon = newmem;
|
persistentDef->mem.cur_balloon = newmem;
|
||||||
|
@ -2256,7 +2256,7 @@ static int testDomainSetMaxMemory(virDomainPtr domain,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* XXX validate not over host memory wrt to other domains */
|
/* XXX validate not over host memory wrt to other domains */
|
||||||
virDomainDefSetMemoryInitial(privdom->def, memory);
|
virDomainDefSetMemoryTotal(privdom->def, memory);
|
||||||
|
|
||||||
virDomainObjEndAPI(&privdom);
|
virDomainObjEndAPI(&privdom);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1828,7 +1828,7 @@ static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
virDomainDefSetMemoryInitial(vm->def, newmax);
|
virDomainDefSetMemoryTotal(vm->def, newmax);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -3898,7 +3898,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
* reading and while dumping xml
|
* reading and while dumping xml
|
||||||
*/
|
*/
|
||||||
/* def->mem.max_balloon = maxMemorySize * 1024; */
|
/* def->mem.max_balloon = maxMemorySize * 1024; */
|
||||||
virDomainDefSetMemoryInitial(def, memorySize * 1024);
|
virDomainDefSetMemoryTotal(def, memorySize * 1024);
|
||||||
|
|
||||||
gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount);
|
gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount);
|
||||||
def->maxvcpus = def->vcpus = CPUCount;
|
def->maxvcpus = def->vcpus = CPUCount;
|
||||||
@ -6051,7 +6051,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
|
|||||||
* the notation here seems to be inconsistent while
|
* the notation here seems to be inconsistent while
|
||||||
* reading and while dumping xml
|
* reading and while dumping xml
|
||||||
*/
|
*/
|
||||||
virDomainDefSetMemoryInitial(def->dom, memorySize * 1024);
|
virDomainDefSetMemoryTotal(def->dom, memorySize * 1024);
|
||||||
def->dom->os.type = VIR_DOMAIN_OSTYPE_HVM;
|
def->dom->os.type = VIR_DOMAIN_OSTYPE_HVM;
|
||||||
def->dom->os.arch = virArchFromHost();
|
def->dom->os.arch = virArchFromHost();
|
||||||
gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount);
|
gVBoxAPI.UIMachine.GetCPUCount(machine, &CPUCount);
|
||||||
|
@ -1416,7 +1416,7 @@ virVMXParseConfig(virVMXContext *ctx,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
virDomainDefSetMemoryInitial(def, memsize * 1024); /* Scale from megabytes to kilobytes */
|
virDomainDefSetMemoryTotal(def, memsize * 1024); /* Scale from megabytes to kilobytes */
|
||||||
|
|
||||||
/* vmx:sched.mem.max -> def:mem.cur_balloon */
|
/* vmx:sched.mem.max -> def:mem.cur_balloon */
|
||||||
if (virVMXGetConfigLong(conf, "sched.mem.max", &sched_mem_max, memsize,
|
if (virVMXGetConfigLong(conf, "sched.mem.max", &sched_mem_max, memsize,
|
||||||
|
@ -1299,7 +1299,7 @@ prlsdkLoadDomain(vzConnPtr privconn,
|
|||||||
/* get RAM parameters */
|
/* get RAM parameters */
|
||||||
pret = PrlVmCfg_GetRamSize(sdkdom, &ram);
|
pret = PrlVmCfg_GetRamSize(sdkdom, &ram);
|
||||||
prlsdkCheckRetGoto(pret, error);
|
prlsdkCheckRetGoto(pret, error);
|
||||||
virDomainDefSetMemoryInitial(def, ram << 10); /* RAM size obtained in Mbytes,
|
virDomainDefSetMemoryTotal(def, ram << 10); /* RAM size obtained in Mbytes,
|
||||||
convert to Kbytes */
|
convert to Kbytes */
|
||||||
def->mem.cur_balloon = ram << 10;
|
def->mem.cur_balloon = ram << 10;
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ xenXMDomainSetMaxMemory(virConnectPtr conn,
|
|||||||
if (entry->def->mem.cur_balloon > memory)
|
if (entry->def->mem.cur_balloon > memory)
|
||||||
entry->def->mem.cur_balloon = memory;
|
entry->def->mem.cur_balloon = memory;
|
||||||
|
|
||||||
virDomainDefSetMemoryInitial(entry->def, memory);
|
virDomainDefSetMemoryTotal(entry->def, memory);
|
||||||
/* If this fails, should we try to undo our changes to the
|
/* If this fails, should we try to undo our changes to the
|
||||||
* in-memory representation of the config file. I say not!
|
* in-memory representation of the config file. I say not!
|
||||||
*/
|
*/
|
||||||
|
@ -1492,7 +1492,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
|||||||
VIR_FREE(val);
|
VIR_FREE(val);
|
||||||
}
|
}
|
||||||
memory = xenapiDomainGetMaxMemory(dom);
|
memory = xenapiDomainGetMaxMemory(dom);
|
||||||
virDomainDefSetMemoryInitial(defPtr, memory);
|
virDomainDefSetMemoryTotal(defPtr, memory);
|
||||||
if (xen_vm_get_memory_dynamic_max(session, &dynamic_mem, vm)) {
|
if (xen_vm_get_memory_dynamic_max(session, &dynamic_mem, vm)) {
|
||||||
defPtr->mem.cur_balloon = (unsigned long) (dynamic_mem / 1024);
|
defPtr->mem.cur_balloon = (unsigned long) (dynamic_mem / 1024);
|
||||||
} else {
|
} else {
|
||||||
|
@ -316,7 +316,7 @@ xenParseMem(virConfPtr conf, virDomainDefPtr def)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
def->mem.cur_balloon *= 1024;
|
def->mem.cur_balloon *= 1024;
|
||||||
virDomainDefSetMemoryInitial(def, memory * 1024);
|
virDomainDefSetMemoryTotal(def, memory * 1024);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1154,7 +1154,7 @@ xenParseSxpr(const struct sexpr *root,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virDomainDefSetMemoryInitial(def, (sexpr_u64(root, "domain/maxmem") << 10));
|
virDomainDefSetMemoryTotal(def, (sexpr_u64(root, "domain/maxmem") << 10));
|
||||||
def->mem.cur_balloon = (sexpr_u64(root, "domain/memory") << 10);
|
def->mem.cur_balloon = (sexpr_u64(root, "domain/memory") << 10);
|
||||||
|
|
||||||
if (def->mem.cur_balloon > virDomainDefGetMemoryActual(def))
|
if (def->mem.cur_balloon > virDomainDefGetMemoryActual(def))
|
||||||
|
Loading…
Reference in New Issue
Block a user