From nobody Mon Feb 9 01:22:43 2026 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