mirror of https://gitee.com/openkylin/libvirt.git
virDomainDefCheckABIStabilityFlags: move memtune checks into a separate function
The checks are scattered all over the place. Move them into a single function. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
a495e3f9ea
commit
411713d440
|
@ -19803,6 +19803,53 @@ virDomainTPMDefCheckABIStability(virDomainTPMDefPtr src,
|
|||
return virDomainDeviceInfoCheckABIStability(&src->info, &dst->info);
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
virDomainMemtuneCheckABIStability(const virDomainDef *src,
|
||||
const virDomainDef *dst,
|
||||
unsigned int flags)
|
||||
{
|
||||
if (virDomainDefGetMemoryInitial(src) != virDomainDefGetMemoryInitial(dst)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain max memory %lld "
|
||||
"does not match source %lld"),
|
||||
virDomainDefGetMemoryInitial(dst),
|
||||
virDomainDefGetMemoryInitial(src));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(flags & VIR_DOMAIN_DEF_ABI_CHECK_SKIP_VOLATILE) &&
|
||||
src->mem.cur_balloon != dst->mem.cur_balloon) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain current memory %lld "
|
||||
"does not match source %lld"),
|
||||
dst->mem.cur_balloon,
|
||||
src->mem.cur_balloon);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (src->mem.max_memory != dst->mem.max_memory) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target maximum memory size '%llu' "
|
||||
"doesn't match source '%llu'"),
|
||||
dst->mem.max_memory,
|
||||
src->mem.max_memory);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (src->mem.memory_slots != dst->mem.memory_slots) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain memory slots "
|
||||
"count '%u' doesn't match source '%u'"),
|
||||
dst->mem.memory_slots,
|
||||
src->mem.memory_slots);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
virDomainMemoryDefCheckABIStability(virDomainMemoryDefPtr src,
|
||||
virDomainMemoryDefPtr dst)
|
||||
|
@ -19957,37 +20004,12 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src,
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (virDomainDefGetMemoryInitial(src) != virDomainDefGetMemoryInitial(dst)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain max memory %lld does not match source %lld"),
|
||||
virDomainDefGetMemoryInitial(dst),
|
||||
virDomainDefGetMemoryInitial(src));
|
||||
if (!virDomainMemtuneCheckABIStability(src, dst, flags))
|
||||
goto error;
|
||||
}
|
||||
if (!(flags & VIR_DOMAIN_DEF_ABI_CHECK_SKIP_VOLATILE) &&
|
||||
src->mem.cur_balloon != dst->mem.cur_balloon) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain current memory %lld does not match source %lld"),
|
||||
dst->mem.cur_balloon, src->mem.cur_balloon);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!virDomainNumaCheckABIStability(src->numa, dst->numa))
|
||||
goto error;
|
||||
|
||||
if (src->mem.memory_slots != dst->mem.memory_slots) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target domain memory slots count '%u' doesn't match source '%u'"),
|
||||
dst->mem.memory_slots, src->mem.memory_slots);
|
||||
goto error;
|
||||
}
|
||||
if (src->mem.max_memory != dst->mem.max_memory) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target maximum memory size '%llu' doesn't match source '%llu'"),
|
||||
dst->mem.max_memory, src->mem.max_memory);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!virDomainDefVcpuCheckAbiStability(src, dst))
|
||||
goto error;
|
||||
|
||||
|
|
Loading…
Reference in New Issue