From nobody Fri May 16 09:01:52 2025 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 1497449811746496.38039410416445; Wed, 14 Jun 2017 07:16:51 -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 812C4C0587E1; Wed, 14 Jun 2017 14:16:46 +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 5C0C289732; Wed, 14 Jun 2017 14:16:46 +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 0DD954BB7F; Wed, 14 Jun 2017 14:16:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5EEGiEi018013 for ; Wed, 14 Jun 2017 10:16:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id DBCAF8E506; Wed, 14 Jun 2017 14:16:44 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D0608E504 for ; Wed, 14 Jun 2017 14:16:42 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 32CDA100A25; Wed, 14 Jun 2017 16:16:41 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 812C4C0587E1 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.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 812C4C0587E1 From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 14 Jun 2017 16:16:40 +0200 Message-Id: <8f9164216bfb1a125bf2e28612dc76c1ee0bf279.1497449670.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/4] qemu: Use qemuDomainCheckABIStability where needed 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.32]); Wed, 14 Jun 2017 14:16:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Most places which want to check ABI stability for an active domain need to call this API rather than the original qemuDomainDefCheckABIStability. The only exception is in snapshots where we need to decide what to do depending on the saved image data. https://bugzilla.redhat.com/show_bug.cgi?id=3D1460952 Signed-off-by: Jiri Denemark --- Notes: Best viewed with -b :-) src/qemu/qemu_driver.c | 71 +++++++++++++++++++++++++++----------------= ---- src/qemu/qemu_migration.c | 2 +- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ba1dba5b7..d3526da8c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3340,7 +3340,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDo= mainPtr dom, VIR_DOMAIN_DEF_PARSE_SKIP_VALI= DATE))) { goto endjob; } - if (!qemuDomainDefCheckABIStability(driver, vm->def, def)) { + if (!qemuDomainCheckABIStability(driver, vm, def)) { virDomainDefFree(def); goto endjob; } @@ -15412,39 +15412,50 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr s= napshot, * to have finer control. */ if (virDomainObjIsActive(vm)) { /* Transitions 5, 6, 8, 9 */ - /* Replace the CPU in config and put the original one in priv - * once we're done. - */ - if (cookie && cookie->cpu && config->cpu) { - origCPU =3D config->cpu; - if (!(config->cpu =3D virCPUDefCopy(cookie->cpu))) - goto endjob; - } - /* Check for ABI compatibility. We need to do this check again= st * the migratable XML or it will always fail otherwise */ - if (config && - !qemuDomainDefCheckABIStability(driver, vm->def, config)) { - virErrorPtr err =3D virGetLastError(); + if (config) { + bool compatible; =20 - if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) { - /* Re-spawn error using correct category. */ - if (err->code =3D=3D VIR_ERR_CONFIG_UNSUPPORTED) - virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, "%s", - err->str2); - goto endjob; + /* Replace the CPU in config and put the original one in p= riv + * once we're done. When we have the updated CPU def in the + * cookie, we don't want to replace the CPU in migratable = def + * when doing ABI checks to make sure the current CPU exac= tly + * matches the one used at the time the snapshot was taken. + */ + if (cookie && cookie->cpu && config->cpu) { + origCPU =3D config->cpu; + if (!(config->cpu =3D virCPUDefCopy(cookie->cpu))) + goto endjob; + + compatible =3D qemuDomainDefCheckABIStability(driver, = vm->def, + config); + } else { + compatible =3D qemuDomainCheckABIStability(driver, vm,= config); + } + + if (!compatible) { + virErrorPtr err =3D virGetLastError(); + + if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) { + /* Re-spawn error using correct category. */ + if (err->code =3D=3D VIR_ERR_CONFIG_UNSUPPORTED) + virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, = "%s", + err->str2); + goto endjob; + } + virResetError(err); + qemuProcessStop(driver, vm, + VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, + QEMU_ASYNC_JOB_START, 0); + virDomainAuditStop(vm, "from-snapshot"); + detail =3D VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT; + event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STOP= PED, + detail); + qemuDomainEventQueue(driver, event); + goto load; } - virResetError(err); - qemuProcessStop(driver, vm, - VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, - QEMU_ASYNC_JOB_START, 0); - virDomainAuditStop(vm, "from-snapshot"); - detail =3D VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT; - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STOPPED, - detail); - qemuDomainEventQueue(driver, event); - goto load; } =20 priv =3D vm->privateData; diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index dce2504a3..8129dcd40 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2059,7 +2059,7 @@ qemuMigrationBeginPhase(virQEMUDriverPtr driver, VIR_DOMAIN_DEF_PARSE_SKIP_VALI= DATE))) goto cleanup; =20 - if (!qemuDomainDefCheckABIStability(driver, vm->def, def)) + if (!qemuDomainCheckABIStability(driver, vm, def)) goto cleanup; =20 rv =3D qemuDomainDefFormatLive(driver, def, NULL, false, true); --=20 2.13.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list