From nobody Wed May 22 00:48:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1607410657; cv=none; d=zohomail.com; s=zohoarc; b=ADant3zmjHCtpOL3c2yim8C11FpgOtorX0s9lt00zTis/5DuXbLMblCE4vKnN9vkgo3Zg2ZKq7eItcNbwgwPvGNNg+1j07hiRvOseLPepWAPb/G7AJ7+WOU1GjHDARb5g0LPeh5/mZ8TqpzoQaNKzFcDr+9pjxOvuQpK+T54bE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607410657; h=Content-Type:Cc: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=gk7+05TUyMRGTcUV2dEnuzwoTbtmYZeUv/sYOfqrm+c=; b=PW81RcbfhD7D+f6dgBsej1dNyIA4rmqiXgHvVgjEye9kGG+B3wjb79dxKhfygdSyDhdmJxSRZi04zq3VePRNrZF7W04Kl5F83vovsbF0jui2DE7HpBSms1R7jq5GqTPR4l9616xv40x4BDPCUteVGpvFHlsLM1WjlmuiV3E4+uE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607410657666456.3244492527331; Mon, 7 Dec 2020 22:57:37 -0800 (PST) Received: from localhost ([::1]:51624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmWwK-00080X-Hx for importer@patchew.org; Tue, 08 Dec 2020 01:57:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmWrp-000528-Gm for qemu-devel@nongnu.org; Tue, 08 Dec 2020 01:52:57 -0500 Received: from smtp.h3c.com ([60.191.123.56]:54536 helo=h3cspam01-ex.h3c.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmWrl-0004rl-6F for qemu-devel@nongnu.org; Tue, 08 Dec 2020 01:52:57 -0500 Received: from DAG2EX03-BASE.srv.huawei-3com.com ([10.8.0.66]) by h3cspam01-ex.h3c.com with ESMTP id 0B86qVB8002961; Tue, 8 Dec 2020 14:52:31 +0800 (GMT-8) (envelope-from tu.guoyi@h3c.com) Received: from localhost.localdomain (10.125.33.161) by DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 8 Dec 2020 14:52:33 +0800 From: Tuguoyi To: Juan Quintela , "Dr. David Alan Gilbert" Subject: [PATCH 1/2] savevm: Remove dead code in save_snapshot() Date: Tue, 8 Dec 2020 14:53:35 +0800 Message-ID: <1607410416-13563-2-git-send-email-tu.guoyi@h3c.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1607410416-13563-1-git-send-email-tu.guoyi@h3c.com> References: <1607410416-13563-1-git-send-email-tu.guoyi@h3c.com> MIME-Version: 1.0 X-Originating-IP: [10.125.33.161] X-ClientProxiedBy: BJSMTP01-EX.srv.huawei-3com.com (10.63.20.132) To DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) X-DNSRBL: X-MAIL: h3cspam01-ex.h3c.com 0B86qVB8002961 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=60.191.123.56; envelope-from=tu.guoyi@h3c.com; helo=h3cspam01-ex.h3c.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tuguoyi@outlook.com, qemu-devel@nongnu.org, Tuguoyi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The snapshot in each bs is deleted at the beginning, so there is no need to find the snapshot again. Signed-off-by: Tuguoyi Reviewed-by: Denis V. Lunev --- migration/savevm.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 5f937a2..601b514 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2728,7 +2728,7 @@ int qemu_load_device_state(QEMUFile *f) int save_snapshot(const char *name, Error **errp) { BlockDriverState *bs, *bs1; - QEMUSnapshotInfo sn1, *sn =3D &sn1, old_sn1, *old_sn =3D &old_sn1; + QEMUSnapshotInfo sn1, *sn =3D &sn1; int ret =3D -1, ret2; QEMUFile *f; int saved_vm_running; @@ -2797,13 +2797,7 @@ int save_snapshot(const char *name, Error **errp) } =20 if (name) { - ret =3D bdrv_snapshot_find(bs, old_sn, name); - if (ret >=3D 0) { - pstrcpy(sn->name, sizeof(sn->name), old_sn->name); - pstrcpy(sn->id_str, sizeof(sn->id_str), old_sn->id_str); - } else { - pstrcpy(sn->name, sizeof(sn->name), name); - } + pstrcpy(sn->name, sizeof(sn->name), name); } else { /* cast below needed for OpenBSD where tv_sec is still 'long' */ localtime_r((const time_t *)&tv.tv_sec, &tm); --=20 2.7.4 From nobody Wed May 22 00:48:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1607410531; cv=none; d=zohomail.com; s=zohoarc; b=Lx/vz4CeoiO0eVqA/xc8C/e8aNRXm4KCZ3e2ao8trNzVITaqKqXxkl+rqcMe3bPd1jayqRU4zlh+UlzniRiQZGID1VJjAyhgRFhEtsMH1KrVXOi5qL5B0lwlGUyOBYtaAUIqBebKg++ooFwM90l6IZFge1JIEORRrvUOpNJjfJM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607410531; h=Content-Type:Cc: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=RdVc/xhvTjMNTGH8+5ctJ1OexeeIQDaJUmQMD7ZC66g=; b=jaROsBYjp7U+gskuceV0O3UjE3fS2CLQJ8qO2tqPR25J8sHskTC4UR9Jr6Mrd1O45RPbOhMtQDQh4NWkUrWY0A2dWUMy0sdymamqyugIs1HjFKFvQxxX3mDd3rtlDHhzrTp+cL5TIInw8Z7tt2Vv7MyAWV8VdpK1MolIC9dqG2w= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607410531664234.1777969940464; Mon, 7 Dec 2020 22:55:31 -0800 (PST) Received: from localhost ([::1]:47864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmWuI-0006Ma-Fj for importer@patchew.org; Tue, 08 Dec 2020 01:55:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmWrp-000526-CS for qemu-devel@nongnu.org; Tue, 08 Dec 2020 01:52:57 -0500 Received: from smtp.h3c.com ([60.191.123.50]:58149 helo=h3cspam02-ex.h3c.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmWrl-0004rn-Mv for qemu-devel@nongnu.org; Tue, 08 Dec 2020 01:52:57 -0500 Received: from DAG2EX03-BASE.srv.huawei-3com.com ([10.8.0.66]) by h3cspam02-ex.h3c.com with ESMTP id 0B86qVVn061440; Tue, 8 Dec 2020 14:52:31 +0800 (GMT-8) (envelope-from tu.guoyi@h3c.com) Received: from localhost.localdomain (10.125.33.161) by DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 8 Dec 2020 14:52:33 +0800 From: Tuguoyi To: Juan Quintela , "Dr. David Alan Gilbert" Subject: [PATCH 2/2] savevm: Delete snapshots just created in case of error Date: Tue, 8 Dec 2020 14:53:36 +0800 Message-ID: <1607410416-13563-3-git-send-email-tu.guoyi@h3c.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1607410416-13563-1-git-send-email-tu.guoyi@h3c.com> References: <1607410416-13563-1-git-send-email-tu.guoyi@h3c.com> MIME-Version: 1.0 X-Originating-IP: [10.125.33.161] X-ClientProxiedBy: BJSMTP01-EX.srv.huawei-3com.com (10.63.20.132) To DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) X-DNSRBL: X-MAIL: h3cspam02-ex.h3c.com 0B86qVVn061440 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=60.191.123.50; envelope-from=tu.guoyi@h3c.com; helo=h3cspam02-ex.h3c.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tuguoyi@outlook.com, qemu-devel@nongnu.org, Tuguoyi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" bdrv_all_create_snapshot() can fails with some snapshots created, so it's better to delete those snapshots before returns to the caller Signed-off-by: Tuguoyi Reviewed-by: Dr. David Alan Gilbert --- migration/savevm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/savevm.c b/migration/savevm.c index 601b514..4a18c9d 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2833,6 +2833,7 @@ int save_snapshot(const char *name, Error **errp) if (ret < 0) { error_setg(errp, "Error while creating snapshot on '%s'", bdrv_get_device_or_node_name(bs)); + bdrv_all_delete_snapshot(sn->name, &bs, NULL); goto the_end; } =20 --=20 2.7.4