mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
conf: Rename virDomainDefGetMemoryActual to virDomainDefGetMemoryTotal
This commit is contained in:
parent
a877a1635b
commit
f8d565bf86
@ -304,7 +304,7 @@ bhyveDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
|
||||
}
|
||||
|
||||
info->state = virDomainObjGetState(vm, NULL);
|
||||
info->maxMem = virDomainDefGetMemoryActual(vm->def);
|
||||
info->maxMem = virDomainDefGetMemoryTotal(vm->def);
|
||||
info->nrVirtCpu = virDomainDefGetVcpus(vm->def);
|
||||
ret = 0;
|
||||
|
||||
|
@ -889,7 +889,7 @@ virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success)
|
||||
if (vm->def->tpm)
|
||||
virDomainAuditTPM(vm, vm->def->tpm, "start", true);
|
||||
|
||||
virDomainAuditMemory(vm, 0, virDomainDefGetMemoryActual(vm->def),
|
||||
virDomainAuditMemory(vm, 0, virDomainDefGetMemoryTotal(vm->def),
|
||||
"start", true);
|
||||
virDomainAuditVcpu(vm, 0, virDomainDefGetVcpus(vm->def), "start", true);
|
||||
if (vm->def->niothreadids)
|
||||
|
@ -3741,9 +3741,9 @@ virDomainDefPostParseMemory(virDomainDefPtr def,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (def->mem.cur_balloon > virDomainDefGetMemoryActual(def) ||
|
||||
if (def->mem.cur_balloon > virDomainDefGetMemoryTotal(def) ||
|
||||
def->mem.cur_balloon == 0)
|
||||
def->mem.cur_balloon = virDomainDefGetMemoryActual(def);
|
||||
def->mem.cur_balloon = virDomainDefGetMemoryTotal(def);
|
||||
|
||||
if ((def->mem.max_memory || def->mem.memory_slots) &&
|
||||
!(def->mem.max_memory && def->mem.memory_slots)) {
|
||||
@ -3754,7 +3754,7 @@ virDomainDefPostParseMemory(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
if (def->mem.max_memory &&
|
||||
def->mem.max_memory < virDomainDefGetMemoryActual(def)) {
|
||||
def->mem.max_memory < virDomainDefGetMemoryTotal(def)) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("maximum memory size must be equal or greater than "
|
||||
"the actual memory size"));
|
||||
@ -8076,14 +8076,14 @@ virDomainDefSetMemoryTotal(virDomainDefPtr def,
|
||||
|
||||
|
||||
/**
|
||||
* virDomainDefGetMemoryActual:
|
||||
* virDomainDefGetMemoryTotal:
|
||||
* @def: domain definition
|
||||
*
|
||||
* Returns the current maximum memory size usable by the domain described by
|
||||
* @def. This size includes possible additional memory devices.
|
||||
*/
|
||||
unsigned long long
|
||||
virDomainDefGetMemoryActual(virDomainDefPtr def)
|
||||
virDomainDefGetMemoryTotal(const virDomainDef *def)
|
||||
{
|
||||
return def->mem.total_memory;
|
||||
}
|
||||
@ -14536,7 +14536,7 @@ int
|
||||
virDomainMemoryInsert(virDomainDefPtr def,
|
||||
virDomainMemoryDefPtr mem)
|
||||
{
|
||||
unsigned long long memory = virDomainDefGetMemoryActual(def);
|
||||
unsigned long long memory = virDomainDefGetMemoryTotal(def);
|
||||
int id = def->nmems;
|
||||
|
||||
if (mem->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
|
||||
@ -14567,14 +14567,14 @@ virDomainMemoryDefPtr
|
||||
virDomainMemoryRemove(virDomainDefPtr def,
|
||||
int idx)
|
||||
{
|
||||
unsigned long long memory = virDomainDefGetMemoryActual(def);
|
||||
unsigned long long memory = virDomainDefGetMemoryTotal(def);
|
||||
virDomainMemoryDefPtr ret = def->mems[idx];
|
||||
|
||||
VIR_DELETE_ELEMENT(def->mems, idx, def->nmems);
|
||||
|
||||
/* fix up balloon size */
|
||||
if (def->mem.cur_balloon > virDomainDefGetMemoryActual(def))
|
||||
def->mem.cur_balloon = virDomainDefGetMemoryActual(def);
|
||||
if (def->mem.cur_balloon > virDomainDefGetMemoryTotal(def))
|
||||
def->mem.cur_balloon = virDomainDefGetMemoryTotal(def);
|
||||
|
||||
/* fix total memory size of the domain */
|
||||
virDomainDefSetMemoryTotal(def, memory - ret->size);
|
||||
@ -22809,7 +22809,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
virBufferAsprintf(buf, " dumpCore='%s'",
|
||||
virTristateSwitchTypeToString(def->mem.dump_core));
|
||||
virBufferAsprintf(buf, " unit='KiB'>%llu</memory>\n",
|
||||
virDomainDefGetMemoryActual(def));
|
||||
virDomainDefGetMemoryTotal(def));
|
||||
|
||||
virBufferAsprintf(buf, "<currentMemory unit='KiB'>%llu</currentMemory>\n",
|
||||
def->mem.cur_balloon);
|
||||
@ -23705,7 +23705,7 @@ virDomainDefCompatibleDevice(virDomainDefPtr def,
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_MEMORY) {
|
||||
unsigned long long sz = dev->data.memory->size;
|
||||
|
||||
if ((virDomainDefGetMemoryActual(def) + sz) > def->mem.max_memory) {
|
||||
if ((virDomainDefGetMemoryTotal(def) + sz) > def->mem.max_memory) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Attaching memory device with size '%llu' would "
|
||||
"exceed domain's maxMemory config"), sz);
|
||||
|
@ -2270,7 +2270,7 @@ virDomainVcpuInfoPtr virDomainDefGetVcpu(virDomainDefPtr def, unsigned int vcpu)
|
||||
|
||||
unsigned long long virDomainDefGetMemoryInitial(const virDomainDef *def);
|
||||
void virDomainDefSetMemoryTotal(virDomainDefPtr def, unsigned long long size);
|
||||
unsigned long long virDomainDefGetMemoryActual(virDomainDefPtr def);
|
||||
unsigned long long virDomainDefGetMemoryTotal(const virDomainDef *def);
|
||||
bool virDomainDefHasMemoryHotplug(const virDomainDef *def);
|
||||
|
||||
typedef enum {
|
||||
|
@ -219,8 +219,8 @@ virDomainDefFormatConvertXMLFlags;
|
||||
virDomainDefFormatInternal;
|
||||
virDomainDefFree;
|
||||
virDomainDefGetDefaultEmulator;
|
||||
virDomainDefGetMemoryActual;
|
||||
virDomainDefGetMemoryInitial;
|
||||
virDomainDefGetMemoryTotal;
|
||||
virDomainDefGetOnlineVcpumap;
|
||||
virDomainDefGetSecurityLabelDef;
|
||||
virDomainDefGetVcpu;
|
||||
|
@ -1423,7 +1423,7 @@ libxlDomainGetMaxMemory(virDomainPtr dom)
|
||||
if (virDomainGetMaxMemoryEnsureACL(dom->conn, vm->def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDefGetMemoryActual(vm->def);
|
||||
ret = virDomainDefGetMemoryTotal(vm->def);
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
@ -1483,7 +1483,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
||||
} else {
|
||||
/* resize the current memory */
|
||||
|
||||
if (newmem > virDomainDefGetMemoryActual(vm->def)) {
|
||||
if (newmem > virDomainDefGetMemoryTotal(vm->def)) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("cannot set memory higher than max memory"));
|
||||
goto endjob;
|
||||
@ -1554,7 +1554,7 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
info->cpuTime = 0;
|
||||
info->memory = vm->def->mem.cur_balloon;
|
||||
info->maxMem = virDomainDefGetMemoryActual(vm->def);
|
||||
info->maxMem = virDomainDefGetMemoryTotal(vm->def);
|
||||
} else {
|
||||
libxl_dominfo_init(&d_info);
|
||||
|
||||
|
@ -620,7 +620,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
|
||||
}
|
||||
}
|
||||
|
||||
info->maxMem = virDomainDefGetMemoryActual(vm->def);
|
||||
info->maxMem = virDomainDefGetMemoryTotal(vm->def);
|
||||
info->nrVirtCpu = virDomainDefGetVcpus(vm->def);
|
||||
ret = 0;
|
||||
|
||||
@ -686,7 +686,7 @@ lxcDomainGetMaxMemory(virDomainPtr dom)
|
||||
if (virDomainGetMaxMemoryEnsureACL(dom->conn, vm->def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDefGetMemoryActual(vm->def);
|
||||
ret = virDomainDefGetMemoryTotal(vm->def);
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
@ -744,10 +744,10 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
||||
unsigned long oldmax = 0;
|
||||
|
||||
if (def)
|
||||
oldmax = virDomainDefGetMemoryActual(def);
|
||||
oldmax = virDomainDefGetMemoryTotal(def);
|
||||
if (persistentDef) {
|
||||
if (!oldmax || oldmax > virDomainDefGetMemoryActual(persistentDef))
|
||||
oldmax = virDomainDefGetMemoryActual(persistentDef);
|
||||
if (!oldmax || oldmax > virDomainDefGetMemoryTotal(persistentDef))
|
||||
oldmax = virDomainDefGetMemoryTotal(persistentDef);
|
||||
}
|
||||
|
||||
if (newmem > oldmax) {
|
||||
|
@ -166,17 +166,17 @@ static int lxcProcReadMeminfo(char *hostpath, virDomainDefPtr def,
|
||||
|
||||
if (STREQ(line, "MemTotal") &&
|
||||
(virMemoryLimitIsSet(def->mem.hard_limit) ||
|
||||
virDomainDefGetMemoryActual(def))) {
|
||||
virDomainDefGetMemoryTotal(def))) {
|
||||
virBufferAsprintf(new_meminfo, "MemTotal: %8llu kB\n",
|
||||
meminfo.memtotal);
|
||||
} else if (STREQ(line, "MemFree") &&
|
||||
(virMemoryLimitIsSet(def->mem.hard_limit) ||
|
||||
virDomainDefGetMemoryActual(def))) {
|
||||
virDomainDefGetMemoryTotal(def))) {
|
||||
virBufferAsprintf(new_meminfo, "MemFree: %8llu kB\n",
|
||||
(meminfo.memtotal - meminfo.memusage));
|
||||
} else if (STREQ(line, "MemAvailable") &&
|
||||
(virMemoryLimitIsSet(def->mem.hard_limit) ||
|
||||
virDomainDefGetMemoryActual(def))) {
|
||||
virDomainDefGetMemoryTotal(def))) {
|
||||
/* MemAvailable is actually MemFree + SRReclaimable +
|
||||
some other bits, but MemFree is the closest approximation
|
||||
we have */
|
||||
|
@ -460,7 +460,7 @@ static int openvzDomainGetInfo(virDomainPtr dom,
|
||||
}
|
||||
}
|
||||
|
||||
info->maxMem = virDomainDefGetMemoryActual(vm->def);
|
||||
info->maxMem = virDomainDefGetMemoryTotal(vm->def);
|
||||
info->memory = vm->def->mem.cur_balloon;
|
||||
info->nrVirtCpu = virDomainDefGetVcpus(vm->def);
|
||||
ret = 0;
|
||||
|
@ -5119,7 +5119,7 @@ qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
|
||||
/* if no balloning is available, the current size equals to the current
|
||||
* full memory size */
|
||||
if (!virDomainDefHasMemballoon(vm->def)) {
|
||||
vm->def->mem.cur_balloon = virDomainDefGetMemoryActual(vm->def);
|
||||
vm->def->mem.cur_balloon = virDomainDefGetMemoryTotal(vm->def);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5204,7 +5204,7 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def)
|
||||
}
|
||||
}
|
||||
|
||||
memory = virDomainDefGetMemoryActual(def);
|
||||
memory = virDomainDefGetMemoryTotal(def);
|
||||
|
||||
if (def->mem.max_memory)
|
||||
maxMemory = def->mem.max_memory;
|
||||
@ -5276,7 +5276,7 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def)
|
||||
*
|
||||
* Note that this may not be valid for all platforms.
|
||||
*/
|
||||
memKB = virDomainDefGetMemoryActual(def) + 1024 * 1024;
|
||||
memKB = virDomainDefGetMemoryTotal(def) + 1024 * 1024;
|
||||
|
||||
done:
|
||||
return memKB << 10;
|
||||
|
@ -2337,7 +2337,7 @@ qemuDomainGetMaxMemory(virDomainPtr dom)
|
||||
if (virDomainGetMaxMemoryEnsureACL(dom->conn, vm->def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDefGetMemoryActual(vm->def);
|
||||
ret = virDomainDefGetMemoryTotal(vm->def);
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
@ -2416,10 +2416,10 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
||||
unsigned long oldmax = 0;
|
||||
|
||||
if (def)
|
||||
oldmax = virDomainDefGetMemoryActual(def);
|
||||
oldmax = virDomainDefGetMemoryTotal(def);
|
||||
if (persistentDef) {
|
||||
if (!oldmax || oldmax > virDomainDefGetMemoryActual(persistentDef))
|
||||
oldmax = virDomainDefGetMemoryActual(persistentDef);
|
||||
if (!oldmax || oldmax > virDomainDefGetMemoryTotal(persistentDef))
|
||||
oldmax = virDomainDefGetMemoryTotal(persistentDef);
|
||||
}
|
||||
|
||||
if (newmem > oldmax) {
|
||||
@ -2675,7 +2675,7 @@ qemuDomainGetInfo(virDomainPtr dom,
|
||||
|
||||
info->state = virDomainObjGetState(vm, NULL);
|
||||
|
||||
maxmem = virDomainDefGetMemoryActual(vm->def);
|
||||
maxmem = virDomainDefGetMemoryTotal(vm->def);
|
||||
if (VIR_ASSIGN_IS_OVERFLOW(info->maxMem, maxmem)) {
|
||||
virReportError(VIR_ERR_OVERFLOW, "%s",
|
||||
_("Initial memory size too large"));
|
||||
@ -7905,7 +7905,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (vmdef->mem.cur_balloon == virDomainDefGetMemoryActual(vmdef))
|
||||
if (vmdef->mem.cur_balloon == virDomainDefGetMemoryTotal(vmdef))
|
||||
vmdef->mem.cur_balloon += dev->data.memory->size;
|
||||
|
||||
if (virDomainMemoryInsert(vmdef, dev->data.memory) < 0)
|
||||
@ -18620,7 +18620,7 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||
int err = 0;
|
||||
|
||||
if (!virDomainDefHasMemballoon(dom->def)) {
|
||||
cur_balloon = virDomainDefGetMemoryActual(dom->def);
|
||||
cur_balloon = virDomainDefGetMemoryTotal(dom->def);
|
||||
} else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BALLOON_EVENT)) {
|
||||
cur_balloon = dom->def->mem.cur_balloon;
|
||||
} else {
|
||||
@ -18638,7 +18638,7 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||
&record->nparams,
|
||||
maxparams,
|
||||
"balloon.maximum",
|
||||
virDomainDefGetMemoryActual(dom->def)) < 0)
|
||||
virDomainDefGetMemoryTotal(dom->def)) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -1680,7 +1680,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
unsigned long long oldmem = virDomainDefGetMemoryActual(vm->def);
|
||||
unsigned long long oldmem = virDomainDefGetMemoryTotal(vm->def);
|
||||
unsigned long long newmem = oldmem + mem->size;
|
||||
char *devstr = NULL;
|
||||
char *objalias = NULL;
|
||||
@ -2873,7 +2873,7 @@ qemuDomainRemoveMemoryDevice(virQEMUDriverPtr driver,
|
||||
virDomainMemoryDefPtr mem)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
unsigned long long oldmem = virDomainDefGetMemoryActual(vm->def);
|
||||
unsigned long long oldmem = virDomainDefGetMemoryTotal(vm->def);
|
||||
unsigned long long newmem = oldmem - mem->size;
|
||||
virObjectEventPtr event;
|
||||
char *backendAlias = NULL;
|
||||
|
@ -2043,7 +2043,7 @@ qemuProcessRefreshBalloonState(virQEMUDriverPtr driver,
|
||||
/* if no ballooning is available, the current size equals to the current
|
||||
* full memory size */
|
||||
if (!virDomainDefHasMemballoon(vm->def)) {
|
||||
vm->def->mem.cur_balloon = virDomainDefGetMemoryActual(vm->def);
|
||||
vm->def->mem.cur_balloon = virDomainDefGetMemoryTotal(vm->def);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4854,7 +4854,7 @@ qemuProcessPrepareDomain(virConnectPtr conn,
|
||||
*/
|
||||
if (virDomainDefNeedsPlacementAdvice(vm->def)) {
|
||||
nodeset = virNumaGetAutoPlacementAdvice(virDomainDefGetVcpus(vm->def),
|
||||
virDomainDefGetMemoryActual(vm->def));
|
||||
virDomainDefGetMemoryTotal(vm->def));
|
||||
if (!nodeset)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -1929,7 +1929,7 @@ static int testDomainGetInfo(virDomainPtr domain,
|
||||
|
||||
info->state = virDomainObjGetState(privdom, NULL);
|
||||
info->memory = privdom->def->mem.cur_balloon;
|
||||
info->maxMem = virDomainDefGetMemoryActual(privdom->def);
|
||||
info->maxMem = virDomainDefGetMemoryTotal(privdom->def);
|
||||
info->nrVirtCpu = virDomainDefGetVcpus(privdom->def);
|
||||
info->cpuTime = ((tv.tv_sec * 1000ll * 1000ll * 1000ll) + (tv.tv_usec * 1000ll));
|
||||
ret = 0;
|
||||
@ -2255,7 +2255,7 @@ testDomainGetMaxMemory(virDomainPtr domain)
|
||||
if (!(privdom = testDomObjFromDomain(domain)))
|
||||
return 0;
|
||||
|
||||
ret = virDomainDefGetMemoryActual(privdom->def);
|
||||
ret = virDomainDefGetMemoryTotal(privdom->def);
|
||||
|
||||
virDomainObjEndAPI(&privdom);
|
||||
return ret;
|
||||
@ -2285,7 +2285,7 @@ static int testDomainSetMemory(virDomainPtr domain,
|
||||
if (!(privdom = testDomObjFromDomain(domain)))
|
||||
return -1;
|
||||
|
||||
if (memory > virDomainDefGetMemoryActual(privdom->def)) {
|
||||
if (memory > virDomainDefGetMemoryTotal(privdom->def)) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1785,7 +1785,7 @@ umlDomainGetMaxMemory(virDomainPtr dom)
|
||||
if (virDomainGetMaxMemoryEnsureACL(dom->conn, vm->def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDefGetMemoryActual(vm->def);
|
||||
ret = virDomainDefGetMemoryTotal(vm->def);
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
@ -1858,7 +1858,7 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (newmem > virDomainDefGetMemoryActual(vm->def)) {
|
||||
if (newmem > virDomainDefGetMemoryTotal(vm->def)) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("cannot set memory higher than max memory"));
|
||||
goto cleanup;
|
||||
@ -1905,7 +1905,7 @@ static int umlDomainGetInfo(virDomainPtr dom,
|
||||
}
|
||||
}
|
||||
|
||||
info->maxMem = virDomainDefGetMemoryActual(vm->def);
|
||||
info->maxMem = virDomainDefGetMemoryTotal(vm->def);
|
||||
info->memory = vm->def->mem.cur_balloon;
|
||||
info->nrVirtCpu = virDomainDefGetVcpus(vm->def);
|
||||
ret = 0;
|
||||
|
@ -1140,7 +1140,7 @@ vmwareDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
|
||||
|
||||
info->state = virDomainObjGetState(vm, NULL);
|
||||
info->cpuTime = 0;
|
||||
info->maxMem = virDomainDefGetMemoryActual(vm->def);
|
||||
info->maxMem = virDomainDefGetMemoryTotal(vm->def);
|
||||
info->memory = vm->def->mem.cur_balloon;
|
||||
info->nrVirtCpu = virDomainDefGetVcpus(vm->def);
|
||||
ret = 0;
|
||||
|
@ -1429,8 +1429,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||
|
||||
def->mem.cur_balloon = sched_mem_max * 1024; /* Scale from megabytes to kilobytes */
|
||||
|
||||
if (def->mem.cur_balloon > virDomainDefGetMemoryActual(def))
|
||||
def->mem.cur_balloon = virDomainDefGetMemoryActual(def);
|
||||
if (def->mem.cur_balloon > virDomainDefGetMemoryTotal(def))
|
||||
def->mem.cur_balloon = virDomainDefGetMemoryTotal(def);
|
||||
|
||||
/* vmx:sched.mem.minsize -> def:mem.min_guarantee */
|
||||
if (virVMXGetConfigLong(conf, "sched.mem.minsize", &sched_mem_minsize, 0,
|
||||
@ -1443,8 +1443,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||
|
||||
def->mem.min_guarantee = sched_mem_minsize * 1024; /* Scale from megabytes to kilobytes */
|
||||
|
||||
if (def->mem.min_guarantee > virDomainDefGetMemoryActual(def))
|
||||
def->mem.min_guarantee = virDomainDefGetMemoryActual(def);
|
||||
if (def->mem.min_guarantee > virDomainDefGetMemoryTotal(def))
|
||||
def->mem.min_guarantee = virDomainDefGetMemoryTotal(def);
|
||||
|
||||
/* vmx:numvcpus -> def:vcpus */
|
||||
if (virVMXGetConfigLong(conf, "numvcpus", &numvcpus, 1, true) < 0)
|
||||
@ -3172,7 +3172,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
|
||||
|
||||
/* def:mem.max_balloon -> vmx:memsize */
|
||||
/* max-memory must be a multiple of 4096 kilobyte */
|
||||
max_balloon = VIR_DIV_UP(virDomainDefGetMemoryActual(def), 4096) * 4096;
|
||||
max_balloon = VIR_DIV_UP(virDomainDefGetMemoryTotal(def), 4096) * 4096;
|
||||
|
||||
virBufferAsprintf(&buffer, "memsize = \"%llu\"\n",
|
||||
max_balloon / 1024); /* Scale from kilobytes to megabytes */
|
||||
|
@ -609,7 +609,7 @@ vzDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
|
||||
|
||||
info->state = virDomainObjGetState(dom, NULL);
|
||||
info->memory = dom->def->mem.cur_balloon;
|
||||
info->maxMem = virDomainDefGetMemoryActual(dom->def);
|
||||
info->maxMem = virDomainDefGetMemoryTotal(dom->def);
|
||||
info->nrVirtCpu = virDomainDefGetVcpus(dom->def);
|
||||
info->cpuTime = 0;
|
||||
|
||||
@ -1291,7 +1291,7 @@ vzDomainGetMaxMemory(virDomainPtr domain)
|
||||
if (!(dom = vzDomObjFromDomain(domain)))
|
||||
return -1;
|
||||
|
||||
ret = virDomainDefGetMemoryActual(dom->def);
|
||||
ret = virDomainDefGetMemoryTotal(dom->def);
|
||||
virObjectUnlock(dom);
|
||||
return ret;
|
||||
}
|
||||
|
@ -2066,14 +2066,14 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainDefGetMemoryActual(def) != def->mem.cur_balloon) {
|
||||
if (virDomainDefGetMemoryTotal(def) != def->mem.cur_balloon) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("changing balloon parameters is not supported "
|
||||
"by vz driver"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainDefGetMemoryActual(def) % (1 << 10) != 0) {
|
||||
if (virDomainDefGetMemoryTotal(def) % (1 << 10) != 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Memory size should be multiple of 1Mb."));
|
||||
return -1;
|
||||
@ -3582,7 +3582,7 @@ prlsdkDoApplyConfig(vzDriverPtr driver,
|
||||
prlsdkCheckRetGoto(pret, error);
|
||||
}
|
||||
|
||||
pret = PrlVmCfg_SetRamSize(sdkdom, virDomainDefGetMemoryActual(def) >> 10);
|
||||
pret = PrlVmCfg_SetRamSize(sdkdom, virDomainDefGetMemoryTotal(def) >> 10);
|
||||
prlsdkCheckRetGoto(pret, error);
|
||||
|
||||
pret = PrlVmCfg_SetCpuCount(sdkdom, virDomainDefGetVcpus(def));
|
||||
|
@ -480,7 +480,7 @@ xenXMDomainGetInfo(virConnectPtr conn,
|
||||
goto error;
|
||||
|
||||
memset(info, 0, sizeof(virDomainInfo));
|
||||
info->maxMem = virDomainDefGetMemoryActual(entry->def);
|
||||
info->maxMem = virDomainDefGetMemoryTotal(entry->def);
|
||||
info->memory = entry->def->mem.cur_balloon;
|
||||
info->nrVirtCpu = virDomainDefGetVcpus(entry->def);
|
||||
info->state = VIR_DOMAIN_SHUTOFF;
|
||||
@ -558,8 +558,8 @@ xenXMDomainSetMemory(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
|
||||
entry->def->mem.cur_balloon = memory;
|
||||
if (entry->def->mem.cur_balloon > virDomainDefGetMemoryActual(entry->def))
|
||||
entry->def->mem.cur_balloon = virDomainDefGetMemoryActual(entry->def);
|
||||
if (entry->def->mem.cur_balloon > virDomainDefGetMemoryTotal(entry->def))
|
||||
entry->def->mem.cur_balloon = virDomainDefGetMemoryTotal(entry->def);
|
||||
|
||||
/* If this fails, should we try to undo our changes to the
|
||||
* in-memory representation of the config file. I say not!
|
||||
@ -637,7 +637,7 @@ xenXMDomainGetMaxMemory(virConnectPtr conn,
|
||||
if (!(entry = virHashLookup(priv->configCache, filename)))
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDefGetMemoryActual(entry->def);
|
||||
ret = virDomainDefGetMemoryTotal(entry->def);
|
||||
|
||||
cleanup:
|
||||
xenUnifiedUnlock(priv);
|
||||
|
@ -499,8 +499,8 @@ createVMRecordFromXml(virConnectPtr conn, virDomainDefPtr def,
|
||||
|
||||
if (def->mem.cur_balloon)
|
||||
(*record)->memory_static_max = (int64_t) (def->mem.cur_balloon * 1024);
|
||||
if (virDomainDefGetMemoryActual(def))
|
||||
(*record)->memory_dynamic_max = (int64_t) (virDomainDefGetMemoryActual(def) * 1024);
|
||||
if (virDomainDefGetMemoryTotal(def))
|
||||
(*record)->memory_dynamic_max = (int64_t) (virDomainDefGetMemoryTotal(def) * 1024);
|
||||
else
|
||||
(*record)->memory_dynamic_max = (*record)->memory_static_max;
|
||||
|
||||
|
@ -1339,7 +1339,7 @@ static int
|
||||
xenFormatMem(virConfPtr conf, virDomainDefPtr def)
|
||||
{
|
||||
if (xenConfigSetInt(conf, "maxmem",
|
||||
VIR_DIV_UP(virDomainDefGetMemoryActual(def), 1024)) < 0)
|
||||
VIR_DIV_UP(virDomainDefGetMemoryTotal(def), 1024)) < 0)
|
||||
return -1;
|
||||
|
||||
if (xenConfigSetInt(conf, "memory",
|
||||
|
@ -1218,8 +1218,8 @@ xenParseSxpr(const struct sexpr *root,
|
||||
virDomainDefSetMemoryTotal(def, (sexpr_u64(root, "domain/maxmem") << 10));
|
||||
def->mem.cur_balloon = (sexpr_u64(root, "domain/memory") << 10);
|
||||
|
||||
if (def->mem.cur_balloon > virDomainDefGetMemoryActual(def))
|
||||
def->mem.cur_balloon = virDomainDefGetMemoryActual(def);
|
||||
if (def->mem.cur_balloon > virDomainDefGetMemoryTotal(def))
|
||||
def->mem.cur_balloon = virDomainDefGetMemoryTotal(def);
|
||||
|
||||
if (cpus != NULL) {
|
||||
if (virBitmapParse(cpus, 0, &def->cpumask,
|
||||
@ -2183,7 +2183,7 @@ xenFormatSxpr(virConnectPtr conn, virDomainDefPtr def)
|
||||
virBufferEscapeSexpr(&buf, "(name '%s')", def->name);
|
||||
virBufferAsprintf(&buf, "(memory %llu)(maxmem %llu)",
|
||||
VIR_DIV_UP(def->mem.cur_balloon, 1024),
|
||||
VIR_DIV_UP(virDomainDefGetMemoryActual(def), 1024));
|
||||
VIR_DIV_UP(virDomainDefGetMemoryTotal(def), 1024));
|
||||
virBufferAsprintf(&buf, "(vcpus %u)", virDomainDefGetVcpusMax(def));
|
||||
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
|
||||
either 32, or 64 on a platform where long is big enough. */
|
||||
|
Loading…
Reference in New Issue
Block a user