From nobody Tue May 14 04:42:52 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=openvz.org 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 1647875836217492.76074661159214; Mon, 21 Mar 2022 08:17:16 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-641-pP8XbDFCOQmj7jKrJZvHcQ-1; Mon, 21 Mar 2022 11:17:13 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 009A828EA6E6; Mon, 21 Mar 2022 15:17:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF997140EBD5; Mon, 21 Mar 2022 15:17:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A37D719451F1; Mon, 21 Mar 2022 15:17:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3B33419451ED for ; Mon, 21 Mar 2022 15:17:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5ACE4140265C; Mon, 21 Mar 2022 15:17:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 55B351402642 for ; Mon, 21 Mar 2022 15:17:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3AD2380029D for ; Mon, 21 Mar 2022 15:17:06 +0000 (UTC) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-151-eZ9mflWMNWSl51XOWAaZUw-1; Mon, 21 Mar 2022 11:17:04 -0400 Received: by mail-lf1-f51.google.com with SMTP id 5so6950508lfp.1 for ; Mon, 21 Mar 2022 08:17:04 -0700 (PDT) Received: from vzbook.. (broadband-90-154-71-96.ip.moscow.rt.ru. [90.154.71.96]) by smtp.gmail.com with ESMTPSA id h10-20020a056512220a00b0044a308dad8csm200812lfu.149.2022.03.21.08.17.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 08:17:01 -0700 (PDT) X-MC-Unique: pP8XbDFCOQmj7jKrJZvHcQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: eZ9mflWMNWSl51XOWAaZUw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o4aj4vkjPOkevX6Q5p8VvHAS0LAjo6JGhJ7E7DsR4ps=; b=N+TlxL+lsy7DMg3Oo8JN19ymi13TuJRyovgV3SKr2nVmdp8C7B1LZm+V25+8tjUcqk yZEVpHKzuozncoo1fiAJdi6BY+36A1bxxrF42DZUWxRodIKEjfWP3hohUK0G5kAkepbF WwRiwfiXf3zlvgBTXgUEpL1GCDG1uBrEStKzOK7DhJh7WRgyc8M+R7kAttFvXgEy0rr8 gifwB9mHitu5ItDJcDIcHTb5OwtqWjSSuxCfxPqFt1qyedVSYYxc6HvO2etcNueHjmLQ rO7/nl7eDHrpBIsFKwS4Q5C21SasuSRuc4pIFEKYaLHoepnUroplizvJoq2055g4+ZAn skOw== X-Gm-Message-State: AOAM5312vbNBgsaN6p9DlVUxLSRQTUPGBoVirvV2+RMtIt3jo2EV2KhH VcWBw9HN3uu2Lsji/Ibu0/dv7LSxChIeGA== X-Google-Smtp-Source: ABdhPJx5/OryKGQNDqX+mvE1HijgUvhivGs8cYwQxIClRd2t3/j/wpBOI7k6FO6/OLUUMbdp/YHniA== X-Received: by 2002:ac2:43bb:0:b0:44a:1ee6:8c12 with SMTP id t27-20020ac243bb000000b0044a1ee68c12mr7704769lfl.683.1647875821765; Mon, 21 Mar 2022 08:17:01 -0700 (PDT) From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 1/3] qemu: don't pause vm when creating internal snapshot Date: Mon, 21 Mar 2022 18:16:49 +0300 Message-Id: <20220321151651.330253-2-nikolay.shirokovskiy@openvz.org> In-Reply-To: <20220321151651.330253-1-nikolay.shirokovskiy@openvz.org> References: <20220321151651.330253-1-nikolay.shirokovskiy@openvz.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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-ZM-MESSAGEID: 1647875837503100003 Content-Type: text/plain; charset="utf-8" From: Maxim Nestratov The pause was introduced in [1] in ancient times when probably distro's QEMU does not have RESUME event. Yet the event was in the upstream QEMU at the time version according to [2]. So the event is supported since QEMU version 0.13 which is much older then oldest currently supported 2.11.0 version and we can remove manual pause/resume. Except for the halt case. [1] commit 346236fea97602e9e6529c5d41a32ed26b126082 Author: Jiri Denemark Date: Thu Feb 24 16:46:44 2011 +0100 qemu: Stop guest CPUs before creating a snapshot commit 6ed2c484f261fd8bd217f855b9e5e5f981e63f0a Author: Luiz Capitulino Date: Tue Apr 27 20:35:59 2010 -0300 QMP: Introduce RESUME event Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_snapshot.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index a7901779fc..a41c782c7f 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -291,23 +291,18 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *drive= r, { qemuDomainObjPrivate *priv =3D vm->privateData; virObjectEvent *event =3D NULL; - bool resume =3D false; virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); + bool halt =3D !!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT); int ret =3D -1; =20 if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0)) goto cleanup; =20 - if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING) { - /* savevm monitor command pauses the domain emitting an event which - * confuses libvirt since it's not notified when qemu resumes the - * domain. Thus we stop and start CPUs ourselves. - */ + if (halt) { if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SAVE, QEMU_ASYNC_JOB_SNAPSHOT) < 0) goto cleanup; =20 - resume =3D true; if (!virDomainObjIsActive(vm)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("guest unexpectedly quit")); @@ -316,10 +311,8 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver, } =20 if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_SNAPSHOT) < 0) { - resume =3D false; + QEMU_ASYNC_JOB_SNAPSHOT) < 0) goto cleanup; - } =20 ret =3D qemuMonitorCreateSnapshot(priv->mon, snap->def->name); qemuDomainObjExitMonitor(driver, vm); @@ -329,29 +322,15 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *drive= r, if (!(snapdef->cookie =3D (virObject *) qemuDomainSaveCookieNew(vm))) goto cleanup; =20 - if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT) { + if (halt) { event =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_S= TOPPED, VIR_DOMAIN_EVENT_STOPPED_FROM_SNA= PSHOT); qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, QEMU_ASYNC_JOB_SNAPSHOT, 0); virDomainAuditStop(vm, "from-snapshot"); - resume =3D false; } =20 cleanup: - if (resume && virDomainObjIsActive(vm) && - qemuProcessStartCPUs(driver, vm, - VIR_DOMAIN_RUNNING_UNPAUSED, - QEMU_ASYNC_JOB_SNAPSHOT) < 0) { - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_SUSPENDED, - VIR_DOMAIN_EVENT_SUSPENDED_API_ER= ROR); - if (virGetLastErrorCode() =3D=3D VIR_ERR_OK) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("resuming after snapshot failed")); - } - } - virObjectEventStateQueue(driver->domainEventState, event); =20 return ret; --=20 2.35.1 From nobody Tue May 14 04:42:52 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=openvz.org 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 1647875837444504.9355153579221; Mon, 21 Mar 2022 08:17:17 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-158-FX5yXQ_xOrWr57R-U2IM5g-1; Mon, 21 Mar 2022 11:17:14 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6A6763C1486A; Mon, 21 Mar 2022 15:17:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 542D9145B979; Mon, 21 Mar 2022 15:17:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0FFB719451F1; Mon, 21 Mar 2022 15:17:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1966B19451ED for ; Mon, 21 Mar 2022 15:17:09 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0E6294B8D4D; Mon, 21 Mar 2022 15:17:09 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A7C0492C14 for ; Mon, 21 Mar 2022 15:17:09 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E5B4E106655C for ; Mon, 21 Mar 2022 15:17:08 +0000 (UTC) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-386-_jnur4o5MOCm2aaP4p3O6A-1; Mon, 21 Mar 2022 11:17:06 -0400 Received: by mail-lj1-f171.google.com with SMTP id q5so20267540ljb.11 for ; Mon, 21 Mar 2022 08:17:03 -0700 (PDT) Received: from vzbook.. (broadband-90-154-71-96.ip.moscow.rt.ru. [90.154.71.96]) by smtp.gmail.com with ESMTPSA id h10-20020a056512220a00b0044a308dad8csm200812lfu.149.2022.03.21.08.17.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 08:17:02 -0700 (PDT) X-MC-Unique: FX5yXQ_xOrWr57R-U2IM5g-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: _jnur4o5MOCm2aaP4p3O6A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jy+Rh5Cxm3vfWSrC1riDtQZBFW40SyvNp9I3ZoS4woc=; b=fiGsjQwMwrMp//Ofbq3Z8+Mz3bnK+5u97cg4x7/6UxU/Rfw3pBm4mhRfKRiWP8PzTv K+pPJRZAB846siM+WHHSn/V6JtJPa7QlWWfx39+CkNToqPRjoM6AI5hNB7QMIMglJPbM ZVxIHL+sS0LjtUv5xhBw1wBBwtHhY75VgkRXF6RIiqof0Z4gEVIXmTq95xsTC1oTAv6q UzWopztJ6+FDyImG6CoErsRBLW6+sE2mNp1MnI2EnaXP2nR2LwI0W1e9oV+9cpzInsh7 QZgzIG3u2nO29yps5tWJuuyMp0FCcfdYfodlz3dWJlwdBnwRv65ll2m4IS/fjfVp7AKm 1vTg== X-Gm-Message-State: AOAM532PLFOhtdH6GviNysm3hNz6oyAnVPyrzk2QaLn6VY2KZq6OkepI tW/ZcU6PUUi3RlEMZHhA8uBbeldUJBV54g== X-Google-Smtp-Source: ABdhPJzp/PzlnxpoLO4cb5vsMhHK4Ofqrt5Bm6mvMsGJh6KOtxOr92TdwZTIydTAJ93rRiRmp2kmMw== X-Received: by 2002:a2e:a7c7:0:b0:249:8273:b488 with SMTP id x7-20020a2ea7c7000000b002498273b488mr5163356ljp.238.1647875822477; Mon, 21 Mar 2022 08:17:02 -0700 (PDT) From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 2/3] qemu: remove excessive check in qemuSnapshotCreateActiveInternal Date: Mon, 21 Mar 2022 18:16:50 +0300 Message-Id: <20220321151651.330253-3-nikolay.shirokovskiy@openvz.org> In-Reply-To: <20220321151651.330253-1-nikolay.shirokovskiy@openvz.org> References: <20220321151651.330253-1-nikolay.shirokovskiy@openvz.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1647875839617100001 After [1] it is not possible to get inactive state for domain while communicating with QEMU (see also [2]). Also even if it were possible the qemuProcessStopCPUs would return error and the check would not be reached. [1] commit 81f50cb92d16643bcd749e3ab5b404b8b7cec643 Author: Jiri Denemark Date: Thu Feb 11 11:20:28 2016 +0100 qemu: Avoid calling qemuProcessStop without a job [2] commit f1ea5bd506b6e00aa8bf55940b147d3c0fe7f124 Author: J=C3=A1n Tomko Date: Wed Nov 24 13:41:09 2021 +0100 qemu: turn qemuDomainObjExitMonitor into void Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_snapshot.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index a41c782c7f..8c050cbd75 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -298,17 +298,10 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *drive= r, if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0)) goto cleanup; =20 - if (halt) { - if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SAVE, - QEMU_ASYNC_JOB_SNAPSHOT) < 0) - goto cleanup; - - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); - goto cleanup; - } - } + if (halt && + qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SAVE, + QEMU_ASYNC_JOB_SNAPSHOT) < 0) + goto cleanup; =20 if (qemuDomainObjEnterMonitorAsync(driver, vm, QEMU_ASYNC_JOB_SNAPSHOT) < 0) --=20 2.35.1 From nobody Tue May 14 04:42:52 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=openvz.org 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 1647875835110928.5486198993299; Mon, 21 Mar 2022 08:17:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-643-BP7nnshxNIyAEkDhhlc2FQ-1; Mon, 21 Mar 2022 11:17:12 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3D0662A5957A; Mon, 21 Mar 2022 15:17:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94BC5C23DD4; Mon, 21 Mar 2022 15:17:09 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5513E19451F1; Mon, 21 Mar 2022 15:17:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3DCDE19451F1 for ; Mon, 21 Mar 2022 15:17:07 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5D312442CD9; Mon, 21 Mar 2022 15:17:07 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 59117442CCD for ; Mon, 21 Mar 2022 15:17:07 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3FBC8185A7A4 for ; Mon, 21 Mar 2022 15:17:07 +0000 (UTC) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-401-SXPNXa-aPRS9UzfQfGfwmg-1; Mon, 21 Mar 2022 11:17:05 -0400 Received: by mail-lj1-f179.google.com with SMTP id bn33so20306034ljb.6 for ; Mon, 21 Mar 2022 08:17:05 -0700 (PDT) Received: from vzbook.. (broadband-90-154-71-96.ip.moscow.rt.ru. [90.154.71.96]) by smtp.gmail.com with ESMTPSA id h10-20020a056512220a00b0044a308dad8csm200812lfu.149.2022.03.21.08.17.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 08:17:03 -0700 (PDT) X-MC-Unique: BP7nnshxNIyAEkDhhlc2FQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: SXPNXa-aPRS9UzfQfGfwmg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VSnQl9TGtyN5NfKb7dJP7ATnf/e5vTW2tnRlA3GFihE=; b=OHsld8k4xf+WIhtudtNNBw0iBRZ3/NbqEpU1T6xnYDsb9oR2T4GAA7KSScJJaMcqkw McA+HL50BpvMUprfz8bf3nZiZ0pbTj+MK7Uw/SigOlcPcKEQ+Ik/31xLohGC8hxQm/Iq eBzgTJOSBZO/JsRyqjwPUGOTBJRRTTPUivn6FBENKgl5KR6rP/ihM8NhKS5j7iSIjAIL uh8USrtaXyK/Z8AWcOfYkPcLPMUUyhjoD7ek/uzDfD0ZZsoUW9j4TvcMeFBKTpjSNI0M nyxuS9hgUjvwjLXbkxrmlcQVej6AoxfuQojey6hI1R9JFw3kaj/cOvh9hlFcwlOjTO9b ccDg== X-Gm-Message-State: AOAM5316TaC9jT52a99U57MmlCMCmR5YrkVoQDAqlnAFuwhBDBf7CXPY wLa6+wJLp8msI+KXDjUuEKIU1cDSC4uytQ== X-Google-Smtp-Source: ABdhPJy3Erx9BpMASsbWqN0USM7Uqdd9K240sWsDUvkIK0QhY4wDun8e7PwLM8zNfUXVwq8soouHSg== X-Received: by 2002:a2e:5c02:0:b0:249:824c:a70c with SMTP id q2-20020a2e5c02000000b00249824ca70cmr5089165ljb.259.1647875823576; Mon, 21 Mar 2022 08:17:03 -0700 (PDT) From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 3/3] qemu: remove unnecessary goto in qemuSnapshotCreateActiveInternal Date: Mon, 21 Mar 2022 18:16:51 +0300 Message-Id: <20220321151651.330253-4-nikolay.shirokovskiy@openvz.org> In-Reply-To: <20220321151651.330253-1-nikolay.shirokovskiy@openvz.org> References: <20220321151651.330253-1-nikolay.shirokovskiy@openvz.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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-ZM-MESSAGEID: 1647875835562100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_snapshot.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 8c050cbd75..18b802e6d5 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -290,43 +290,42 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *drive= r, unsigned int flags) { qemuDomainObjPrivate *priv =3D vm->privateData; - virObjectEvent *event =3D NULL; virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); bool halt =3D !!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT); - int ret =3D -1; + int rc; =20 if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0)) - goto cleanup; + return -1; =20 if (halt && qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SAVE, QEMU_ASYNC_JOB_SNAPSHOT) < 0) - goto cleanup; + return -1; =20 if (qemuDomainObjEnterMonitorAsync(driver, vm, QEMU_ASYNC_JOB_SNAPSHOT) < 0) - goto cleanup; + return -1; =20 - ret =3D qemuMonitorCreateSnapshot(priv->mon, snap->def->name); + rc =3D qemuMonitorCreateSnapshot(priv->mon, snap->def->name); qemuDomainObjExitMonitor(driver, vm); - if (ret < 0) - goto cleanup; + if (rc < 0) + return -1; =20 if (!(snapdef->cookie =3D (virObject *) qemuDomainSaveCookieNew(vm))) - goto cleanup; + return -1; =20 if (halt) { + virObjectEvent *event; + event =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_S= TOPPED, VIR_DOMAIN_EVENT_STOPPED_FROM_SNA= PSHOT); + virObjectEventStateQueue(driver->domainEventState, event); qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, QEMU_ASYNC_JOB_SNAPSHOT, 0); virDomainAuditStop(vm, "from-snapshot"); } =20 - cleanup: - virObjectEventStateQueue(driver->domainEventState, event); - - return ret; + return 0; } =20 =20 --=20 2.35.1