From nobody Mon Apr 29 14:43:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636993446; cv=none; d=zohomail.com; s=zohoarc; b=EPtT9oWy9iZz8O5KRx3Oy6dDNNw+VEgYLuaYfEtEKcm3A20A5kGjjCJjvacXOb/oD8aLyckqZvMWr8Q+VPex0rq6YT/NU2eDDVsbOyTRhEQgXH5jraDL0LNUjH17EhJsvOPaOr7n6sXvC2sZDiTKOb0JPWB8/3NYKrSbnwPV2YU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993446; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I72GkxBZFezJjN6lnMeU7C6UTclhrqI7LPbco+xdQ7c=; b=COJ0mu9YT3Afty1vAB7/G7VBPl5DcYLsvvjobCqFTBkh4WvrYw74bAAiQ/C2Sb4cf7bbRB9eMlOsLa5XA5a9c+kc9HGnf64ieNU8T6CrYiyde902pgI3Q/4RnuEmbtzEMYBynNx8XvSYwicw1e9PtWCjp8FkJWjcxSLgoemeP3k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636993446790554.3696506789195; Mon, 15 Nov 2021 08:24:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-98-Pe2fiwnVP9SldArIO34_lA-1; Mon, 15 Nov 2021 11:24:03 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81D6010144E0; Mon, 15 Nov 2021 16:23:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6213D5E272; Mon, 15 Nov 2021 16:23:58 +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 2E9FE1832DD2; Mon, 15 Nov 2021 16:23:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGN7lh028205 for ; Mon, 15 Nov 2021 11:23:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7CFBC197FC; Mon, 15 Nov 2021 16:23:07 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id C17FA60657 for ; Mon, 15 Nov 2021 16:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993445; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=I72GkxBZFezJjN6lnMeU7C6UTclhrqI7LPbco+xdQ7c=; b=PGEcIbKSl8TBf2BNMa4wWtFTGW4YuqlzVU16U2imZdc6u5NWJY7tk1JjSzrP/VmbyeH7H/ 3qVoTLC4L1I8jTHhe97tccOYBZ+WI9/tZ3lIjCKbT+dHt6pLpiQuWlMqwzGg1RccnktqnI cFnCgG52zIK9MVWaBkPeA3FzEjkNuiI= X-MC-Unique: Pe2fiwnVP9SldArIO34_lA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 01/11] qemu_snapshot: revert: always error out if VM XML is missing Date: Mon, 15 Nov 2021 17:22:44 +0100 Message-Id: <58390d24a29c2a9efc8a76b6d46c9d232c314d04.1636993188.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636993484529100005 Content-Type: text/plain; charset="utf-8" The support to revert snapshots was introduced in libvirt 0.8.0 but saving the whole VM XML was implemented later in libvirt 0.9.5. That is more then 10 years ago so we can safely assume that nobody will try reverting to snapshot created by that old libvirt. In the unlikely scenario where someone would actually did it we would simply error out. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 138 +++++++++++++++++++-------------------- 1 file changed, 66 insertions(+), 72 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index d105eead27..3d6ec490ab 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1908,13 +1908,14 @@ qemuSnapshotRevert(virDomainObj *vm, goto endjob; } =20 + if (!snap->def->dom) { + virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, + _("snapshot '%s' lacks domain '%s' rollback info"), + snap->def->name, vm->def->name); + goto endjob; + } + if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) { - if (!snap->def->dom) { - virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, - _("snapshot '%s' lacks domain '%s' rollback inf= o"), - snap->def->name, vm->def->name); - goto endjob; - } if (virDomainObjIsActive(vm) && !(snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_RUNNING || snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED) && @@ -1935,16 +1936,14 @@ qemuSnapshotRevert(virDomainObj *vm, } } =20 - if (snap->def->dom) { - config =3D virDomainDefCopy(snap->def->dom, - driver->xmlopt, priv->qemuCaps, true); - if (!config) - goto endjob; + config =3D virDomainDefCopy(snap->def->dom, + driver->xmlopt, priv->qemuCaps, true); + if (!config) + goto endjob; =20 - if (STRNEQ(config->name, vm->def->name)) { - VIR_FREE(config->name); - config->name =3D g_strdup(vm->def->name); - } + if (STRNEQ(config->name, vm->def->name)) { + VIR_FREE(config->name); + config->name =3D g_strdup(vm->def->name); } =20 if (snap->def->inactiveDom) { @@ -1992,61 +1991,59 @@ qemuSnapshotRevert(virDomainObj *vm, /* Transitions 5, 6, 8, 9 */ /* Check for ABI compatibility. We need to do this check again= st * the migratable XML or it will always fail otherwise */ - if (config) { - bool compatible; + bool compatible; =20 - /* 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; + /* Replace the CPU in config and put the original one in priv + * 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 exactly + * 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; =20 - compatible =3D qemuDomainDefCheckABIStability(driver, - priv->qemu= Caps, - vm->def, - config); - } else { - compatible =3D qemuDomainCheckABIStability(driver, vm,= config); - } + compatible =3D qemuDomainDefCheckABIStability(driver, + priv->qemuCaps, + vm->def, + config); + } else { + compatible =3D qemuDomainCheckABIStability(driver, vm, con= fig); + } =20 - /* If using VM GenID, there is no way currently to change - * the genid for the running guest, so set an error, - * mark as incompatible, and don't allow change of genid - * if the revert force flag would start the guest again. */ - if (compatible && config->genidRequested) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("domain genid update requires restart= ")); - compatible =3D false; - start_flags &=3D ~VIR_QEMU_PROCESS_START_GEN_VMID; - } + /* If using VM GenID, there is no way currently to change + * the genid for the running guest, so set an error, + * mark as incompatible, and don't allow change of genid + * if the revert force flag would start the guest again. */ + if (compatible && config->genidRequested) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("domain genid update requires restart")); + compatible =3D false; + start_flags &=3D ~VIR_QEMU_PROCESS_START_GEN_VMID; + } =20 - if (!compatible) { - virErrorPtr err =3D virGetLastError(); + if (!compatible) { + virErrorPtr err =3D virGetLastError(); =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; - } - 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); - virObjectEventStateQueue(driver->domainEventState, eve= nt); - goto load; + 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_STOPPED, + detail); + virObjectEventStateQueue(driver->domainEventState, event); + goto load; } =20 if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING) { @@ -2073,10 +2070,9 @@ qemuSnapshotRevert(virDomainObj *vm, * failed loadvm attempt? */ goto endjob; } - if (config) { - virCPUDefFree(priv->origCPU); - priv->origCPU =3D g_steal_pointer(&origCPU); - } + + virCPUDefFree(priv->origCPU); + priv->origCPU =3D g_steal_pointer(&origCPU); =20 if (cookie && !cookie->slirpHelper) priv->disableSlirp =3D true; @@ -2097,10 +2093,8 @@ qemuSnapshotRevert(virDomainObj *vm, defined =3D true; } =20 - if (config) { - virDomainObjAssignDef(vm, config, true, NULL); - config =3D NULL; - } + virDomainObjAssignDef(vm, config, true, NULL); + config =3D NULL; =20 /* No cookie means libvirt which saved the domain was too old = to * mess up the CPU definitions. --=20 2.31.1 From nobody Mon Apr 29 14:43:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636993616; cv=none; d=zohomail.com; s=zohoarc; b=HrxLrsEWLx0dVHHSIT3+tIRaBZKH4zaJP2heShCOPR/fw2Dvlt3778P0zCAmZFL2EViPVnbJ+j6DB0VGVspxBUn6q7sxp63c/LM102BlTlr/RebHV2Iz4HrGkody2ayIbngS2f+mgjwPMAGB4zoHriZLFgyouCwCecKVRGUJH+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993616; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4dj39jQhtTaR1IdyisbY+EmiyRJkETgNixrVba2nzGQ=; b=DJ/LHagE05Z5aAOmv9Iik5RwdE5UEOpTPjsEQE/C+1Xl4lmF5MqW0z4fQa0Adt1F9m/xDWbQnqYQBEMHGm5OoLhgnIQIpbTCR1TngALC7vjVm5f5kIl/BszD4zhxMXxJKTv39zYuzTiV2njhCaGjMXs5vFdpZTUC6PW0EUFj6T0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636993616531876.3885050391457; Mon, 15 Nov 2021 08:26:56 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-120-45_KjKSMOMKpC--r5uHG0A-1; Mon, 15 Nov 2021 11:26:53 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2AF96824FAF; Mon, 15 Nov 2021 16:26:22 +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 62BC956AB6; Mon, 15 Nov 2021 16:26:21 +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 180144A703; Mon, 15 Nov 2021 16:26:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGN8fQ028215 for ; Mon, 15 Nov 2021 11:23:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 63C01197FC; Mon, 15 Nov 2021 16:23:08 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id D460160657 for ; Mon, 15 Nov 2021 16:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993615; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4dj39jQhtTaR1IdyisbY+EmiyRJkETgNixrVba2nzGQ=; b=CO0RlMU7pgsARhVk7F8wO/VThuuQ20Hm9rD0K34hqThGBKwB+LnxTq8THncpxQMyuyGQhT ItIXC9goK5hQTR8DOtmpqhOLkN/OIapqJ3PVDY+l5k4Sw5A0PrANwVW1hDIpPrtksbmawA L58kQCZi0yGX6xpeLGntHFX7+s28NBE= X-MC-Unique: 45_KjKSMOMKpC--r5uHG0A-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 02/11] qemu_snapshot: revert: always restart QEMU process for running VM Date: Mon, 15 Nov 2021 17:22:45 +0100 Message-Id: <560359ae82f1e9d7b9cb037f5dcaf1c4a3ea0aa5.1636993188.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636993617729100001 Content-Type: text/plain; charset="utf-8" Our compatibility check code isn't complete and there are cases where it fails to detect incompatible configuration and the revert fails. In addition future support for external snapshot will always require restarting the QEMU process. To unify the behavior drop the compatibility check code and always restart the QEMU process. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 66 ++++++---------------------------------- 1 file changed, 10 insertions(+), 56 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 3d6ec490ab..661f74146c 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1989,62 +1989,16 @@ qemuSnapshotRevert(virDomainObj *vm, * to have finer control. */ if (virDomainObjIsActive(vm)) { /* Transitions 5, 6, 8, 9 */ - /* Check for ABI compatibility. We need to do this check again= st - * the migratable XML or it will always fail otherwise */ - bool compatible; - - /* Replace the CPU in config and put the original one in priv - * 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 exactly - * 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, - priv->qemuCaps, - vm->def, - config); - } else { - compatible =3D qemuDomainCheckABIStability(driver, vm, con= fig); - } - - /* If using VM GenID, there is no way currently to change - * the genid for the running guest, so set an error, - * mark as incompatible, and don't allow change of genid - * if the revert force flag would start the guest again. */ - if (compatible && config->genidRequested) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("domain genid update requires restart")); - compatible =3D false; - start_flags &=3D ~VIR_QEMU_PROCESS_START_GEN_VMID; - } - - 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_STOPPED, - detail); - virObjectEventStateQueue(driver->domainEventState, event); - goto load; - } + 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_STO= PPED, + detail); + virObjectEventStateQueue(driver->domainEventState, event); + goto load; =20 if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING) { /* Transitions 5, 6 */ --=20 2.31.1 From nobody Mon Apr 29 14:43:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636993433; cv=none; d=zohomail.com; s=zohoarc; b=XIje5XWmmhfsPpfq/SmnUl0EDGcjDW2uuQLX1ohP9IP5dQ8qtAUbY/GsfscFPo8tNXQFngWATgbawfjrbF7ghgcGNcHDxEYtSQMD+cP6Qdy/Oah8eFV7g8XPeOIW1MCSVZDMp/orHbBAfnKgvsPufGd99oMFOHVCM/A3Y9tZ9hs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993433; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0pwkh6cIWmitqGj9HhQz3jyBd5ynGfpyBK9nooI9kdo=; b=DomPlbQwyV8U/f0cAHfHU3GRHP9rltJzxeKkhKb0zzC8u8C3RCear0eRG2sx5TQF1x7fMkW0aBdRnk1ubuq7pdf36DrKnQfzfnVNQzsI28fGDsrn1Zazs732g2XAZJlk+BAmCTrBMj2jQcUQ7e5u/3o5+RzVgqwASV2dqS02nTM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636993433052853.641656649596; Mon, 15 Nov 2021 08:23:53 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-506-9y3yV2Y9PnyYNl-vhvJdWg-1; Mon, 15 Nov 2021 11:23:49 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6E2619F92C; Mon, 15 Nov 2021 16:23:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB1EF1017CE3; Mon, 15 Nov 2021 16:23:43 +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 40AE91819AC1; Mon, 15 Nov 2021 16:23:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGN9IT028224 for ; Mon, 15 Nov 2021 11:23:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 48F8E197FC; Mon, 15 Nov 2021 16:23:09 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id B953960657 for ; Mon, 15 Nov 2021 16:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993431; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0pwkh6cIWmitqGj9HhQz3jyBd5ynGfpyBK9nooI9kdo=; b=eGRjB/VkZz1ogIHFsn35AxsUtkcD78c+Pj7FUKQ5whTIa3R03hxiY/VDZpmQ4CkBMo11Xf PqrPIoUR81oBk7+60pVxxwEJM0AGwokavoWWs4KEn/Xp3EBoELNVmN6QazCzTCJUbuzFPW 9uh5JID4zVFv5QnCHsfOyx6S1nUc1aU= X-MC-Unique: 9y3yV2Y9PnyYNl-vhvJdWg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 03/11] qemu_snapshot: revert: drop unused loadvm code Date: Mon, 15 Nov 2021 17:22:46 +0100 Message-Id: <587f98c873f6b39cd5adba9a6cd224bc26152145.1636993188.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636993473778100001 Content-Type: text/plain; charset="utf-8" Now that we always restart QEMU process the loadvm code is unused and can be dropped. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 96 +++++++++++----------------------------- 1 file changed, 26 insertions(+), 70 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 661f74146c..251a0e5cfa 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1982,11 +1982,6 @@ qemuSnapshotRevert(virDomainObj *vm, start_flags |=3D VIR_QEMU_PROCESS_START_PAUSED; =20 /* Transitions 2, 3, 5, 6, 8, 9 */ - /* When using the loadvm monitor command, qemu does not know - * whether to pause or run the reverted domain, and just stays - * in the same state as before the monitor command, whether - * that is paused or running. We always pause before loadvm, - * to have finer control. */ if (virDomainObjIsActive(vm)) { /* Transitions 5, 6, 8, 9 */ qemuProcessStop(driver, vm, @@ -1998,78 +1993,39 @@ qemuSnapshotRevert(virDomainObj *vm, VIR_DOMAIN_EVENT_STO= PPED, detail); virObjectEventStateQueue(driver->domainEventState, event); - goto load; - - if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING) { - /* Transitions 5, 6 */ - if (qemuProcessStopCPUs(driver, vm, - VIR_DOMAIN_PAUSED_FROM_SNAPSHOT, - QEMU_ASYNC_JOB_START) < 0) - goto endjob; - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); - goto endjob; - } - } - - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_START) < 0) - goto endjob; - rc =3D qemuMonitorLoadSnapshot(priv->mon, snap->def->name); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; - if (rc < 0) { - /* XXX resume domain if it was running before the - * failed loadvm attempt? */ - goto endjob; - } - - virCPUDefFree(priv->origCPU); - priv->origCPU =3D g_steal_pointer(&origCPU); - - if (cookie && !cookie->slirpHelper) - priv->disableSlirp =3D true; - - if (inactiveConfig) { - virDomainObjAssignDef(vm, inactiveConfig, false, NULL); - inactiveConfig =3D NULL; - defined =3D true; - } } else { /* Transitions 2, 3 */ - load: was_stopped =3D true; + } =20 - if (inactiveConfig) { - virDomainObjAssignDef(vm, inactiveConfig, false, NULL); - inactiveConfig =3D NULL; - defined =3D true; - } + if (inactiveConfig) { + virDomainObjAssignDef(vm, inactiveConfig, false, NULL); + inactiveConfig =3D NULL; + defined =3D true; + } =20 - virDomainObjAssignDef(vm, config, true, NULL); - config =3D NULL; + virDomainObjAssignDef(vm, config, true, NULL); + config =3D NULL; =20 - /* No cookie means libvirt which saved the domain was too old = to - * mess up the CPU definitions. - */ - if (cookie && - qemuDomainFixupCPUs(vm, &cookie->cpu) < 0) - goto cleanup; + /* No cookie means libvirt which saved the domain was too old to + * mess up the CPU definitions. + */ + if (cookie && + qemuDomainFixupCPUs(vm, &cookie->cpu) < 0) + goto cleanup; =20 - rc =3D qemuProcessStart(snapshot->domain->conn, driver, vm, - cookie ? cookie->cpu : NULL, - QEMU_ASYNC_JOB_START, NULL, -1, NULL, sn= ap, - VIR_NETDEV_VPORT_PROFILE_OP_CREATE, - start_flags); - virDomainAuditStart(vm, "from-snapshot", rc >=3D 0); - detail =3D VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STARTED, - detail); - if (rc < 0) - goto endjob; - } + rc =3D qemuProcessStart(snapshot->domain->conn, driver, vm, + cookie ? cookie->cpu : NULL, + QEMU_ASYNC_JOB_START, NULL, -1, NULL, snap, + VIR_NETDEV_VPORT_PROFILE_OP_CREATE, + start_flags); + virDomainAuditStart(vm, "from-snapshot", rc >=3D 0); + detail =3D VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; + event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STARTED, + detail); + if (rc < 0) + goto endjob; =20 /* Touch up domain state. */ if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING) && --=20 2.31.1 From nobody Mon Apr 29 14:43:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636993447; cv=none; d=zohomail.com; s=zohoarc; b=EpBhzI6nmgDQAzaou0dx+Q4AsLc8QJa8kR4V4YuHF38wbq456fJM+DLe6lqjxHpOAQ+Lm6h+RxfEAkly1kj2Nc/iqee8GTnVGksCVL00iQr+/t5So812Y85Jh4BfaJA5n6hKs9FUnomO8bXWHMJvvrBXvFKdCYC0d3L66B4a+Ys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993447; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DYUGub2tOTUB7EUtaNFQRu9F9oamZS2jZAW3haM1fhU=; b=YV4wiLAV6CW9Ie6KgftbUVmEDN3f9yWOc7ZDd3hI+dSW1+BuWvlzYPHcD5AB8fEZueCF+3Dwl3VpMEFHdceXU6fs33mqVJWhXIsZ8uAZ6f/QZF7+5/3O0fy1zLfbQknLZrEtAllfkBydYCtqK+0gQpoZYYYOPsP1j4D/SC98+2Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636993446857916.0466449412083; Mon, 15 Nov 2021 08:24:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-544-mjZ2g6SsMj6UTAVctEiEWw-1; Mon, 15 Nov 2021 11:24:03 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CD3341018724; Mon, 15 Nov 2021 16:23:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A64B319D9F; Mon, 15 Nov 2021 16:23:58 +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 769851832DD5; Mon, 15 Nov 2021 16:23:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGNAK7028229 for ; Mon, 15 Nov 2021 11:23:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 39BAA67843; Mon, 15 Nov 2021 16:23:10 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F50460657 for ; Mon, 15 Nov 2021 16:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993445; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=DYUGub2tOTUB7EUtaNFQRu9F9oamZS2jZAW3haM1fhU=; b=fVKT/zg7M5Qt02orZZ6Tttyf6dt58jDzZ3q5rRJoo6w7qXJoBqsX5bAwtSPQgXmYjlpJlz EJVXMq98zKcmv+BYRvLMuSeC52GAFRK0wzuw2aP+xWQCIGo8dBMgjQSIE4F04nkmLgLWnA kPh7Xy60TO4vsVFtJwv9Vg4jBjkNE98= X-MC-Unique: mjZ2g6SsMj6UTAVctEiEWw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 04/11] qemu_snapshot: revert: fix emitting events Date: Mon, 15 Nov 2021 17:22:47 +0100 Message-Id: <7180d8122ba6cba7ad59f135d6c2d6e859ea91a0.1636993188.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636993482749100003 Content-Type: text/plain; charset="utf-8" Now that we always restart the QEMU process events are emitted differently so we need to update the code and the comment as well. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 251a0e5cfa..e08959a754 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1852,7 +1852,6 @@ qemuSnapshotRevert(virDomainObj *vm, virDomainDef *config =3D NULL; virDomainDef *inactiveConfig =3D NULL; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); - bool was_stopped =3D false; qemuDomainSaveCookie *cookie; virCPUDef *origCPU =3D NULL; unsigned int start_flags =3D VIR_QEMU_PROCESS_START_GEN_VMID; @@ -1865,15 +1864,14 @@ qemuSnapshotRevert(virDomainObj *vm, /* We have the following transitions, which create the following event= s: * 1. inactive -> inactive: none * 2. inactive -> running: EVENT_STARTED - * 3. inactive -> paused: EVENT_STARTED, EVENT_PAUSED + * 3. inactive -> paused: EVENT_STARTED, EVENT_SUSPENDED * 4. running -> inactive: EVENT_STOPPED - * 5. running -> running: none - * 6. running -> paused: EVENT_PAUSED + * 5. running -> running: EVENT_STOPPED, EVENT_STARTED + * 6. running -> paused: EVENT_STOPPED, EVENT_STARTED, EVENT_SUSPEN= DED * 7. paused -> inactive: EVENT_STOPPED - * 8. paused -> running: EVENT_RESUMED - * 9. paused -> paused: none - * Also, several transitions occur even if we fail partway through, - * and use of FORCE can cause multiple transitions. + * 8. paused -> running: EVENT_STOPPED, EVENT_STARTED + * 9. paused -> paused: EVENT_STOPPED, EVENT_STARTED, EVENT_SUSPEN= DED + * Also, several transitions occur even if we fail partway through. */ =20 if (qemuDomainHasBlockjob(vm, false)) { @@ -1993,9 +1991,6 @@ qemuSnapshotRevert(virDomainObj *vm, VIR_DOMAIN_EVENT_STO= PPED, detail); virObjectEventStateQueue(driver->domainEventState, event); - } else { - /* Transitions 2, 3 */ - was_stopped =3D true; } =20 if (inactiveConfig) { @@ -2034,13 +2029,10 @@ qemuSnapshotRevert(virDomainObj *vm, /* Transitions 3, 6, 9 */ virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_FROM_SNAPSHOT); - if (was_stopped) { - /* Transition 3, use event as-is and add event2 */ - detail =3D VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; - event2 =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_SUSPEND= ED, - detail); - } /* else transition 6 and 9 use event as-is */ + detail =3D VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; + event2 =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_SUSPENDED, + detail); } else { /* Transitions 2, 5, 8 */ if (!virDomainObjIsActive(vm)) { @@ -2053,15 +2045,6 @@ qemuSnapshotRevert(virDomainObj *vm, QEMU_ASYNC_JOB_START); if (rc < 0) goto endjob; - virObjectUnref(event); - event =3D NULL; - if (was_stopped) { - /* Transition 2 */ - detail =3D VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STARTED, - detail); - } } break; =20 --=20 2.31.1 From nobody Mon Apr 29 14:43:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636993627; cv=none; d=zohomail.com; s=zohoarc; b=AUy+PBrrFWfED4OSp0P0/6ON/uq8BCDiFw+hf7Dwle7aaJDZz0q9HGhXPn5aGY8U3BbWjBpyDR/itCKEAujkUZ5AGf+JWpjT8D3gUaDRrlynsOttsHLFXuraNUT3tmoIJkLSRITVF/0tHR8rNtBaGsF+LHnd+ZR5Hg8pxey4KNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993627; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BnVK+6wQm7Pi91N7fhhT8cOOKk9Fsifuk+k5m1FWyD8=; b=fpYO2Zvh8Sq+AGWbtoZfn+lsHMlqhzjDwv2RWTQTT3MV08gfNtP+EjEExrkTxV0dQrlT4fmaJSz0UdR+yrzU2ylWJLHST1CN9sjwkrSiGTVWeRxCFV9smMMCDXfQTW24aFM0DQK8WPyyOxrKXcLtothSI5/er4ttRyqCXHb018I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636993627007512.0713346651821; Mon, 15 Nov 2021 08:27:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-188-huSPk3tEOY250VdNPG2oGA-1; Mon, 15 Nov 2021 11:24:06 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 797E010144EB; Mon, 15 Nov 2021 16:24:01 +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 5BA5567845; Mon, 15 Nov 2021 16:24:01 +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 25ADE4A702; Mon, 15 Nov 2021 16:24:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGNBE3028237 for ; Mon, 15 Nov 2021 11:23:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 19960197FC; Mon, 15 Nov 2021 16:23:11 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89DB867843 for ; Mon, 15 Nov 2021 16:23:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993450; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=BnVK+6wQm7Pi91N7fhhT8cOOKk9Fsifuk+k5m1FWyD8=; b=bgs7uJPuW682J710YJYRMWCH14eWtcJmFjzqpnc5P311xwU1fxN8xe13iFDhRjfaOclILC OiuxZuaXJ+k/BLzIxrEBdgeihrkJmX2r2LpynmV87evU803w4BTichDN8IszvEkBeAUw5j yLYP0+x1mTEpReF1jNWnQ5sPcGgBs98= X-MC-Unique: huSPk3tEOY250VdNPG2oGA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 05/11] qemu_snapshot: revert: drop error that QEMU process must be restarted Date: Mon, 15 Nov 2021 17:22:48 +0100 Message-Id: <30dc7fda2fe342e318c045e0fc94a33ba38de9b2.1636993188.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636993628384100003 Content-Type: text/plain; charset="utf-8" This will always happen so there is no need to error out and require usage of FORCE flag. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index e08959a754..9e975e0eaa 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1914,15 +1914,6 @@ qemuSnapshotRevert(virDomainObj *vm, } =20 if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) { - if (virDomainObjIsActive(vm) && - !(snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_RUNNING || - snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED) && - (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | - VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED))) { - virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, "%s", - _("must respawn qemu to start inactive snapshot= ")); - goto endjob; - } if (vm->hasManagedSave && !(snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_RUNNING || snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED)) { --=20 2.31.1 From nobody Mon Apr 29 14:43:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636993622; cv=none; d=zohomail.com; s=zohoarc; b=fOpa8v0gO6POxZ9fYa8P2naeLTrFscHB/xpVoJ+GxCLsdFfhypWzhemGxHYJOFLcLB2hllH9l3EnsmGrDa0nb6Y6oCskVR1UHo4+nJ6lBvfpCh5BWZD97tS+/UKRhga7nWa+XN2vzBIT+6Sx9hMQ8uN3B1Hq4fKQoySJPQ+x0MI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993622; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MyK23C0zGIidN+JyXiOevZirX8h1fl7stPS8vzBrY5o=; b=GLw+sW/OvYJe14JyBer8h61pzFT5CelTflX9UPGkDDoAkoLWihmDtKVEQhOPiajBKyvVeE1Z6qg3FpG7daM63XlZ70EiI9Rz9rKLkap/VfTSwqhE/zFSNU3tUmJDqZeCvA+AC+SpkTDfVrhTJpT9M5PdZIk4H4O5QGL+W6s4oIg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636993622592648.5805638146214; Mon, 15 Nov 2021 08:27:02 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-60-5M70pYKgPL6XfiWIyYmaBw-1; Mon, 15 Nov 2021 11:26:58 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CF92BC745C; Mon, 15 Nov 2021 16:26:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B4CFD22719; Mon, 15 Nov 2021 16:26:26 +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 803D51832DD2; Mon, 15 Nov 2021 16:26:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGNCJv028249 for ; Mon, 15 Nov 2021 11:23:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 00549197FC; Mon, 15 Nov 2021 16:23:12 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 708DB60657 for ; Mon, 15 Nov 2021 16:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993621; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MyK23C0zGIidN+JyXiOevZirX8h1fl7stPS8vzBrY5o=; b=GnDOGHiIImYsEhejx3H1fr/aOn68JcPiJiBBUwZKyO/H4Pvo2mlSGLavi78DHxf83cDFsH EMIieepy4LxsuzNELL5kYUjXYNKEOBWOra5qEst5OYvjiE5+/rUv1BbSHIQLMPM8ryExP2 XslZRA0KAgr+l43UkeYRnhYINSBbJPo= X-MC-Unique: 5M70pYKgPL6XfiWIyYmaBw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 06/11] test: snapshot revert: always error out if VM XML is missing Date: Mon, 15 Nov 2021 17:22:49 +0100 Message-Id: <575b2aac6cb83044de37bb02e64194e24dd1e0bf.1636993188.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636993623041100001 Content-Type: text/plain; charset="utf-8" We should have this check even if FORCE flag is used because later we unconditionally copy the `snap->def->dom` and error out if there is no copy created. The test driver will always save the VM XML when creating new snapshot. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/test/test_driver.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index ea474d55ac..2fa78a15d6 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -9043,13 +9043,14 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr sna= pshot, goto cleanup; } =20 + if (!snap->def->dom) { + virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, + _("snapshot '%s' lacks domain '%s' rollback info"), + snap->def->name, vm->def->name); + goto cleanup; + } + if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) { - if (!snap->def->dom) { - virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, - _("snapshot '%s' lacks domain '%s' rollback inf= o"), - snap->def->name, vm->def->name); - goto cleanup; - } if (virDomainObjIsActive(vm) && !(snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_RUNNING || snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED) && --=20 2.31.1 From nobody Mon Apr 29 14:43:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636993626; cv=none; d=zohomail.com; s=zohoarc; b=QCCS1xRUA+PP1IoXh+zMbtt51XITFxXh+3w5SwxQ4Io1obGfm0JsREDTmYR3rSIRmNzqJEcR7MdrbvWzn+/dgIFj1Rz49yLJe/bb2ZselIu78YyunmFqIqM2kt7eMzkLdYAHadnx6gQTaMjMwsOA+1PfMUySvt5kn6r7UOr5rR0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993626; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2fB8vypwdnPBSrJFoGROTwIVS6S83vW0Am+QISxsFNc=; b=fIBQkWAffqymFkJ5CBHsqEyzDxlkrIXvxTmzCDlzIVZHsj/A0wXa+UHGY3zfjYUaFnaopkuKpQXCpOW7Z8a2/ZJIyGFqgrT4LHYZ0wilC7ilZPQsiszLnX/LSCBQ+wzhp0KpUSNBRedaC0NdRjBTa5Mq8i2IWhbvyzR9ADSvux0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1636993626279856.9758009209341; Mon, 15 Nov 2021 08:27:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-469-_mXOpHcmMKedSJS4W3ZymQ-1; Mon, 15 Nov 2021 11:24:11 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E316519253F4; Mon, 15 Nov 2021 16:24:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 674235C1A1; Mon, 15 Nov 2021 16:24: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 35B0E1832DDA; Mon, 15 Nov 2021 16:24:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGNCdr028254 for ; Mon, 15 Nov 2021 11:23:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id DA37E197FC; Mon, 15 Nov 2021 16:23:12 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5613119EF9 for ; Mon, 15 Nov 2021 16:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993452; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2fB8vypwdnPBSrJFoGROTwIVS6S83vW0Am+QISxsFNc=; b=E3hhERlaqI/SM+FCiSoWoU2Ii77Gfc4JtAXDy7YZH/dnjBDxwcTsjPzH01Ut2zhx1R7swk TU4AZHOUohSOuI+6CNKFQ6mtuOm8sfDo5KnYZ9mo4MneK/jzPdIQNupqA824ygBYj/5EfL V/oS2u+/QOj3u2CyLpT5TU11sAnaTvI= X-MC-Unique: _mXOpHcmMKedSJS4W3ZymQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 07/11] test: snapshot revert: always emulate VM process stop Date: Mon, 15 Nov 2021 17:22:50 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636993628201100001 Content-Type: text/plain; charset="utf-8" Reflect the same change in test driver as in QEMU driver because the compatibility check code isn't perfect. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/test/test_driver.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2fa78a15d6..0da8a2ea0f 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -9077,28 +9077,13 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr sna= pshot, =20 if (virDomainObjIsActive(vm)) { /* Transitions 5, 6, 8, 9 */ - /* Check for ABI compatibility. */ - if (!virDomainDefCheckABIStability(vm->def, config, - privconn->xmlopt)) { - 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 cleanup; - } - - virResetError(err); - testDomainShutdownState(snapshot->domain, vm, - VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT); - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STOPPED, - VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT); - virObjectEventStateQueue(privconn->eventState, event); - goto load; - } + testDomainShutdownState(snapshot->domain, vm, + VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT); + event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STO= PPED, + VIR_DOMAIN_EVENT_STO= PPED_FROM_SNAPSHOT); + virObjectEventStateQueue(privconn->eventState, event); + goto load; =20 if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING) { /* Transitions 5, 6 */ --=20 2.31.1 From nobody Mon Apr 29 14:43:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636993622; cv=none; d=zohomail.com; s=zohoarc; b=DBjSx+FWrcFarE0eVNRniW4XDVzrVXJxdDBHnMWeZuMnOl8QH1MJiuNFeqAVfSfjYoxX2hIQOm6l+UenB0U2eVe3+Qi8UsVRbMX7zkwEoLrc2oyYUSdS/SQ840gyrHLZPRd34tbUoDt5+SAJTUZmS39zQue3dH1dqUwx4dzWeX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993622; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iTGnZWfmGKYpK23eLQxd1wo2dEePlFbQw6Opu0G6yJw=; b=ikApZNZmKgBR5IDdBIIP0noreJG40qvppdgns5TdeEGc20AnUa9gD3U57zi5MVK2dXyThtDbHhN3hYB22PmBanjKc86Fdr1tIDsM64OXAbsVEDIKFWOswS2VlJjTkq0lfEpjvXsN1nl5MdvNLMRnz9Uirp3iuFizNvRIKRik54k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636993622620867.5696994266051; Mon, 15 Nov 2021 08:27:02 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-OmA3O8OZMaSfpF-LwA13Aw-1; Mon, 15 Nov 2021 11:27:00 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 53EC919611CB; Mon, 15 Nov 2021 16:26:30 +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 34E5C5DEFB; Mon, 15 Nov 2021 16:26:30 +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 F25F84A703; Mon, 15 Nov 2021 16:26:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGNDmN028263 for ; Mon, 15 Nov 2021 11:23:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id BFF4319EF9; Mon, 15 Nov 2021 16:23:13 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C71060657 for ; Mon, 15 Nov 2021 16:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993621; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=iTGnZWfmGKYpK23eLQxd1wo2dEePlFbQw6Opu0G6yJw=; b=d11uFz4lSvRoXZzc109ehQHl6f05O1ojVnRtfMAsIqfp1sOemVCBVPTmzFp4UNjk1aIs7h eMfRldsscFHjB5/7n1TXPOg4Jsr8Xjs5bbAqxCqKQW4Nt5wGsY84LNKScnMkkqOupcbPE7 UhIS8tp8E8f7bb3YxYHYagoU2oacpro= X-MC-Unique: OmA3O8OZMaSfpF-LwA13Aw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 08/11] test: snapshot revert: drop unused code Date: Mon, 15 Nov 2021 17:22:51 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636993623138100003 Content-Type: text/plain; charset="utf-8" Now that we always emulate VM process stop we can drop the unused code and simply the logic. Signed-off-by: Pavel Hrdina --- src/test/test_driver.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 0da8a2ea0f..4ae68571ef 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -9083,35 +9083,18 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr sna= pshot, VIR_DOMAIN_EVENT_STO= PPED, VIR_DOMAIN_EVENT_STO= PPED_FROM_SNAPSHOT); virObjectEventStateQueue(privconn->eventState, event); - goto load; - - if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING) { - /* Transitions 5, 6 */ - was_running =3D true; - virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, - VIR_DOMAIN_PAUSED_FROM_SNAPSHOT); - /* Create an event now in case the restore fails, so - * that user will be alerted that they are now paused. - * If restore later succeeds, we might replace this. */ - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_SUSPENDED, - VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT); - } - virDomainObjAssignDef(vm, config, false, NULL); - } else { - /* Transitions 2, 3 */ - load: was_stopped =3D true; - virDomainObjAssignDef(vm, config, false, NULL); - if (testDomainStartState(privconn, vm, - VIR_DOMAIN_RUNNING_FROM_SNAPSHOT) < 0) - goto cleanup; - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STARTED, - VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT); } =20 + virDomainObjAssignDef(vm, config, false, NULL); + if (testDomainStartState(privconn, vm, + VIR_DOMAIN_RUNNING_FROM_SNAPSHOT) < 0) + goto cleanup; + event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_STARTED, + VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT); + /* Touch up domain state. */ if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING) && (snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED || --=20 2.31.1 From nobody Mon Apr 29 14:43:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636993618; cv=none; d=zohomail.com; s=zohoarc; b=HuIIbcntS3nVD8/Dy2SFCXvCUhCdU1n1hqHJItxHE0nrjCsM0ajWFIw/ttT4nHN++EeYDu7GQ0Vy+5ed2LWgDVIwXv9Ky/hdlr4J9vm2i8jA96B+E7ulSvt0c4fiZxk/aA57qFRJTzymP4T8q10dyhqeRb2oWNn04+mZjywkrBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993618; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=b7OZ7UhuHnJtuoWDn7nTsxCsBT58RVfAwN/zmtvW9y8=; b=N82HUaqxGYTQNEgyESiOZw21xu7tDfKt+od2698CkYrKOlz5j/0WFuc1yNXKbRugKuXPi4E/0/2+NBJYB7fLA+gRBasFSRQuAwo/t31r4+hPZ2q5F1JDpj004wQmNO5yzzxudEJjaf54rC3CWOe96cqaOd3qYdlAM2jVEDfqJpY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1636993618300138.07042047275456; Mon, 15 Nov 2021 08:26:58 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-251-sVqkcO9wOkCIjrgAIMhf1g-1; Mon, 15 Nov 2021 11:26:55 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5950888EF03; Mon, 15 Nov 2021 16:26:33 +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 39C8260BE5; Mon, 15 Nov 2021 16:26:33 +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 02C784E58E; Mon, 15 Nov 2021 16:26:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGNEMw028278 for ; Mon, 15 Nov 2021 11:23:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id A65AB19EF9; Mon, 15 Nov 2021 16:23:14 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21D6660657 for ; Mon, 15 Nov 2021 16:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993617; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=b7OZ7UhuHnJtuoWDn7nTsxCsBT58RVfAwN/zmtvW9y8=; b=WvpjRyE9/qj/ERnoEuY5wteDiWlDyzTMAYDCyOrfhDDOuk/u3S5M/i8ntdFICthlRLO2G6 a+3Pot/nPi9xnEk1PW3e7xpoSxpRiQHfrFt4qkCburFYeOoLOu42M+uEWTU76t2Wvkyd65 smBMlJSu43SpMmq5TiuN1Aki5mbfgfk= X-MC-Unique: sVqkcO9wOkCIjrgAIMhf1g-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 09/11] test: snapshot revert: fix emitting events Date: Mon, 15 Nov 2021 17:22:52 +0100 Message-Id: <20dfb7830956fd402d1f7b9589bf7e0d7ed75488.1636993188.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636993620410100001 Content-Type: text/plain; charset="utf-8" Now that we always emulate restarting the VM process events are emitted differently so we need to update the code and the comment as well. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/test/test_driver.c | 42 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 4ae68571ef..333b5e8bfc 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -9014,15 +9014,14 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr sna= pshot, /* We have the following transitions, which create the following event= s: * 1. inactive -> inactive: none * 2. inactive -> running: EVENT_STARTED - * 3. inactive -> paused: EVENT_STARTED, EVENT_PAUSED + * 3. inactive -> paused: EVENT_STARTED, EVENT_SUSPENDED * 4. running -> inactive: EVENT_STOPPED - * 5. running -> running: none - * 6. running -> paused: EVENT_PAUSED + * 5. running -> running: EVENT_STOPPED, EVENT_STARTED + * 6. running -> paused: EVENT_STOPPED, EVENT_STARTED, EVENT_SUSPEN= DED * 7. paused -> inactive: EVENT_STOPPED - * 8. paused -> running: EVENT_RESUMED - * 9. paused -> paused: none - * Also, several transitions occur even if we fail partway through, - * and use of FORCE can cause multiple transitions. + * 8. paused -> running: EVENT_STOPPED, EVENT_STARTED + * 9. paused -> paused: EVENT_STOPPED, EVENT_STARTED, EVENT_SUSPEN= DED + * Also, several transitions occur even if we fail partway through. */ =20 if (!(vm =3D testDomObjFromSnapshot(snapshot))) @@ -9072,8 +9071,6 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snaps= hot, if (snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_RUNNING || snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED) { /* Transitions 2, 3, 5, 6, 8, 9 */ - bool was_running =3D false; - bool was_stopped =3D false; =20 if (virDomainObjIsActive(vm)) { /* Transitions 5, 6, 8, 9 */ @@ -9083,8 +9080,6 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snaps= hot, VIR_DOMAIN_EVENT_STO= PPED, VIR_DOMAIN_EVENT_STO= PPED_FROM_SNAPSHOT); virObjectEventStateQueue(privconn->eventState, event); - } else { - was_stopped =3D true; } =20 virDomainObjAssignDef(vm, config, false, NULL); @@ -9102,28 +9097,9 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snap= shot, /* Transitions 3, 6, 9 */ virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_FROM_SNAPSHOT); - if (was_stopped) { - /* Transition 3, use event as-is and add event2 */ - event2 =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_SUSPENDED, - VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT); - } /* else transition 6 and 9 use event as-is */ - } else { - /* Transitions 2, 5, 8 */ - virObjectUnref(event); - event =3D NULL; - - if (was_stopped) { - /* Transition 2 */ - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_STARTED, - VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT); - } else if (was_running) { - /* Transition 8 */ - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_RESUMED, - VIR_DOMAIN_EVENT_RESUMED); - } + event2 =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_SUSPENDED, + VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT); } } else { /* Transitions 1, 4, 7 */ --=20 2.31.1 From nobody Mon Apr 29 14:43:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636993450; cv=none; d=zohomail.com; s=zohoarc; b=JYb2mW/YD2tAZsfqo0VYWSOfVDGGnEMHMf23TR+88SlVyp+GtVn1e3y334KoaQ4oW8fbw47cmK1MtbtGPYqs5Spm8jGi17TvD/xykBsWPea7s7L850rh5uPvMGyu42DsBwDh4U1EZcpLg1MWR5DShVEg/GxyM0cr6+NH9Om8bpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993450; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ok4fgUbuyuYwdeZ4fG913D683qBuCPhCW4I1zflw+Fg=; b=iwQZYDeLl4woNLPp2AljGfHBKgTXXr80zHHIZCR1lCw7BDwBYLBPDSSnH3WV9e3nvhm9uGl7T/LPuqVnOHzWQZu4oyxoHvyUjDIL8Vz1ahLgsRIaMUWbBDJtruB3Ovap/ckovi8fAn/LwiNUEjnYOOLhxSWjp8aHBYC1umPtSP8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16369934505961021.6468844919957; Mon, 15 Nov 2021 08:24:10 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-532-zYhbFX9nOCOtTyhsjeRcOg-1; Mon, 15 Nov 2021 11:24:06 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 92E841018730; Mon, 15 Nov 2021 16:24:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3122B76608; Mon, 15 Nov 2021 16:24:01 +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 E53771832DD7; Mon, 15 Nov 2021 16:24:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGNFXp028304 for ; Mon, 15 Nov 2021 11:23:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id AD08519EF9; Mon, 15 Nov 2021 16:23:15 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F3F260657 for ; Mon, 15 Nov 2021 16:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993448; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ok4fgUbuyuYwdeZ4fG913D683qBuCPhCW4I1zflw+Fg=; b=dM8V2yOI96TmvoEuJ1hDHPBdHuIgSG3sBsKx5xdwcdZdxZNhClf/cw7xnQ5JamviUjQmFB n+MHxC+Qm9O6fIWeLmPvfOfhARUei2EIq73BQCCDEJlGTRg1ovHTSVfp7LlOR/71687zsN bJYzf2JYRe+dz2ApLQzBNH94SevlskA= X-MC-Unique: zYhbFX9nOCOtTyhsjeRcOg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 10/11] test: snapshot revert: drop error the VM must be restarted Date: Mon, 15 Nov 2021 17:22:53 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636993486132100007 Content-Type: text/plain; charset="utf-8" This will always happen so there is no need to error out and require usage of FORCE flag. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/test/test_driver.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 333b5e8bfc..2871c8ebac 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -9049,18 +9049,6 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snap= shot, goto cleanup; } =20 - if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) { - if (virDomainObjIsActive(vm) && - !(snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_RUNNING || - snapdef->state =3D=3D VIR_DOMAIN_SNAPSHOT_PAUSED) && - (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | - VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED))) { - virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, "%s", - _("must respawn guest to start inactive snapsho= t")); - goto cleanup; - } - } - virDomainSnapshotSetCurrent(vm->snapshots, NULL); =20 config =3D virDomainDefCopy(snap->def->dom, --=20 2.31.1 From nobody Mon Apr 29 14:43:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636993566; cv=none; d=zohomail.com; s=zohoarc; b=Ik4qgTrNqUauR1Y9rf88Vqt+Im6LbglGElzmlghMIHcd83woug0P1sur4DgJY0M3k0zhVnFKU9sRvsgWBmQtBTTZHDfT3Kb4QfTP80lZe4jrNs1A8GI8aBTNVgwHJNhsnm+jT0kRLHcYqgo5VXKk3BjoVQrot3iXVcgkkjOWgJE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636993566; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NvVn/xEpjJshz+g6DVJXhC7Ee0HXh2u+wORmie/h2GA=; b=g3Wdvumv/5ltvBj/ZI7t73Wsfati3YspnQ1mu9TXSk+4MjtWQ60ufpwsMjK5qh7FXLtnd4BN5rOdWYRtMxiDb1zKI5y9TEbt+Rk8BVi19eye2UF23NVd3Jb0e5lBa6Bgn53AjmHFOyOwQVIk5JX9Z2UMDbKyCgyK2tmM3mhRNZE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1636993566624978.9513061139917; Mon, 15 Nov 2021 08:26:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-cQheXRtoN5SZdQPWCG1rAw-1; Mon, 15 Nov 2021 11:24:09 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C8741018734; Mon, 15 Nov 2021 16:24:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CBB7019730; Mon, 15 Nov 2021 16:24:03 +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 9D9E71832DD7; Mon, 15 Nov 2021 16:24:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AFGNGJm028315 for ; Mon, 15 Nov 2021 11:23:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 93F0919EF9; Mon, 15 Nov 2021 16:23:16 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F6EC60657 for ; Mon, 15 Nov 2021 16:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636993565; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=NvVn/xEpjJshz+g6DVJXhC7Ee0HXh2u+wORmie/h2GA=; b=ZROymy72Ap4g0MShray+0/s2mxKN6qasTfzRSNUaTe72KO9W4Pmhx+G4QD3RSDHzIzWDzk ItO8BJuj1WMXu5J3vyeSCRHCcQtayePsyG425aLepvcTjJ/KQun0D/6PfqimI4oGQC1Gej WlbukgwpGTiyy1FPWNzTv3CQcUIGSR0= X-MC-Unique: cQheXRtoN5SZdQPWCG1rAw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 11/11] domain_snapshot: update virDomainRevertToSnapshot description Date: Mon, 15 Nov 2021 17:22:54 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636993574881100001 Content-Type: text/plain; charset="utf-8" We've changed the behavior of this API that from now on it will always restart the VM process and we are no longer able to revert to snapshots created by libvirt older then 0.9.5. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/libvirt-domain-snapshot.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c index 4a79e95704..99316460aa 100644 --- a/src/libvirt-domain-snapshot.c +++ b/src/libvirt-domain-snapshot.c @@ -960,6 +960,11 @@ virDomainSnapshotHasMetadata(virDomainSnapshotPtr snap= shot, * implies the intent to roll back state, no additional confirmation is * normally required for these lossy effects. * + * Since libvirt 7.10.0 the VM process is always restarted so the following + * paragraph is no longer valid. In case that the snapshot metadata lacks + * full VM XML we will error out as it is no longer possible to revert to + * these old snapshots. + * * However, there are two particular situations where reverting will * be refused by default, and where @flags must include * VIR_DOMAIN_SNAPSHOT_REVERT_FORCE to acknowledge the risks. 1) Any --=20 2.31.1