From nobody Wed May 8 07:38:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1495094769944504.6722338518142; Thu, 18 May 2017 01:06:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 219858047F; Thu, 18 May 2017 08:06:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99D5D18351; Thu, 18 May 2017 08:06:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2613D4BB7F; Thu, 18 May 2017 08:06:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4I85xTk012431 for ; Thu, 18 May 2017 04:05:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5FA3B5C552; Thu, 18 May 2017 08:05:59 +0000 (UTC) Received: from moe.brq.redhat.com (dhcp129-131.brq.redhat.com [10.34.129.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9F705C546 for ; Thu, 18 May 2017 08:05:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 219858047F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 219858047F From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 18 May 2017 10:05:55 +0200 Message-Id: <0af4609446a739df7baed963d699cfb0fb401a9d.1495094745.git.mprivozn@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] virDomainDefCheckABIStabilityFlags: Check for memoryBacking X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 18 May 2017 08:06:08 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1450349 Problem is, memoryBacking is part of guest ABI. Therefore changing it on migration/restore from an image can lead qemu/guest to rejecting the image. At the same time, move other partial checks of virDomainMemtune into the same function: virDomainMemtuneCheckABIStability. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 101 ++++++++++++++++++++++++++++++++++++---------= ---- 1 file changed, 75 insertions(+), 26 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9eba70a95..89b93f4ad 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19786,6 +19786,80 @@ virDomainTPMDefCheckABIStability(virDomainTPMDefPt= r src, return virDomainDeviceInfoCheckABIStability(&src->info, &dst->info); } =20 + +static bool +virDomainMemtuneCheckABIStability(const virDomainDef *src, + const virDomainDef *dst, + unsigned int flags) +{ + if (virDomainDefGetMemoryInitial(src) !=3D virDomainDefGetMemoryInitia= l(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 !=3D 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 !=3D 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 !=3D 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; + } + + if (src->mem.source !=3D dst->mem.source) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target memoryBacking source '%s' doesn't " + "match source memoryBacking source'%s'"), + virDomainMemorySourceTypeToString(dst->mem.source), + virDomainMemorySourceTypeToString(src->mem.source)); + return false; + } + + if (src->mem.access !=3D dst->mem.access) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target memoryBacking access '%s' doesn't " + "match access memoryBacking access'%s'"), + virDomainMemoryAccessTypeToString(dst->mem.access), + virDomainMemoryAccessTypeToString(src->mem.access)); + return false; + } + + if (src->mem.allocation !=3D dst->mem.allocation) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target memoryBacking allocation '%s' doesn't " + "match allocation memoryBacking allocation'%s'"), + virDomainMemoryAllocationTypeToString(dst->mem.allo= cation), + virDomainMemoryAllocationTypeToString(src->mem.allo= cation)); + return false; + } + + return true; +} + + static bool virDomainMemoryDefCheckABIStability(virDomainMemoryDefPtr src, virDomainMemoryDefPtr dst) @@ -19940,37 +20014,12 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPt= r src, goto error; } =20 - if (virDomainDefGetMemoryInitial(src) !=3D virDomainDefGetMemoryInitia= l(dst)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain max memory %lld does not match sou= rce %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 !=3D 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; - } =20 if (!virDomainNumaCheckABIStability(src->numa, dst->numa)) goto error; =20 - if (src->mem.memory_slots !=3D dst->mem.memory_slots) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target domain memory slots count '%u' doesn't ma= tch source '%u'"), - dst->mem.memory_slots, src->mem.memory_slots); - goto error; - } - if (src->mem.max_memory !=3D 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; =20 --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list