From nobody Mon Feb 9 00:32:26 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=fail(p=none dis=none) header.from=fujitsu.com ARC-Seal: i=1; a=rsa-sha256; t=1669620942; cv=none; d=zohomail.com; s=zohoarc; b=kZ3hPjzSoSkAyP3F8SShvtf4wlSdwrAhY1vdhIONpHjqF+GsgOUny/V71g8eDSWbeT9g8N9PVTNTSnquUrQdioMCgR5XCj4KPA0sKoeZIQqRWwE+XHj5ExA4S4+HrBKF2pyj8j/50jOMUhosnTGSSMa0Pmu+RFfiiQNQb4STuCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669620942; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Q7mgww9obXXJoIjJdkNWnSeEqDK5J7BBW7j5iHm/A/I=; b=dpLIWDOWy0OdzhKzJJonwZ3R5MpQGg3jukZdJec8xMUFPbf5UX44YyxCWx4zKsoKBq4x+fwK/8+m2v/atwjQdWNIBKPEA0GVL8sPpLmWOqA8znMLN/p8gkzono5y6XoDf5UlTGycKvh/HZDOxr0slG6PFan69mo1DLhP/i7B+PI= 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=fail 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 1669620942460190.98893129324642; Sun, 27 Nov 2022 23:35:42 -0800 (PST) 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-352-25tKGg8SMRKrTrmc3gQJDg-1; Mon, 28 Nov 2022 02:35:38 -0500 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 4FBE829AA3B5; Mon, 28 Nov 2022 07:35:36 +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 3D218141511E; Mon, 28 Nov 2022 07:35:33 +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 DA10A1946589; Mon, 28 Nov 2022 07:35:32 +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 DB7F31946588 for ; Mon, 28 Nov 2022 07:35:31 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BF4B049BB64; Mon, 28 Nov 2022 07:35:31 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B7F6249BB61 for ; Mon, 28 Nov 2022 07:35:31 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 9422229AA3B5 for ; Mon, 28 Nov 2022 07:35:31 +0000 (UTC) Received: from esa12.hc1455-7.c3s2.iphmx.com (esa12.hc1455-7.c3s2.iphmx.com [139.138.37.100]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-618-KsgHXNeTNQqIwij7BSXLnw-1; Mon, 28 Nov 2022 02:35:29 -0500 Received: from unknown (HELO yto-r3.gw.nic.fujitsu.com) ([218.44.52.219]) by esa12.hc1455-7.c3s2.iphmx.com with ESMTP; 28 Nov 2022 16:34:24 +0900 Received: from yto-m3.gw.nic.fujitsu.com (yto-nat-yto-m3.gw.nic.fujitsu.com [192.168.83.66]) by yto-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id 69E7BE8523 for ; Mon, 28 Nov 2022 16:34:24 +0900 (JST) Received: from m3003.s.css.fujitsu.com (m3003.s.css.fujitsu.com [10.128.233.114]) by yto-m3.gw.nic.fujitsu.com (Postfix) with ESMTP id B67CF14116 for ; Mon, 28 Nov 2022 16:34:23 +0900 (JST) Received: from ohf37b.. (unknown [10.125.14.40]) by m3003.s.css.fujitsu.com (Postfix) with ESMTP id 9ED012026123; Mon, 28 Nov 2022 16:34:23 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669620940; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Q7mgww9obXXJoIjJdkNWnSeEqDK5J7BBW7j5iHm/A/I=; b=Q55tZw0aj/cw1OI2KzJUikUCOQI2U9mxz43D4J9IldNOLto9pSQfWMM96sWLY4iHrtgREr +K8w4aeTP2OF8W7/GmVMdP0dyyzQkqFnxBYm+/+3nTWq1ZT2RgmPKUNhT3DLgYgeJMXdzp CPS/mHYWSdnksfv+Q5242KD0QnK5e68= X-MC-Unique: 25tKGg8SMRKrTrmc3gQJDg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: KsgHXNeTNQqIwij7BSXLnw-1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="77390274" X-IronPort-AV: E=Sophos;i="5.96,199,1665414000"; d="scan'208";a="77390274" From: Haruka Ohata To: libvir-list@redhat.com Subject: [PATCH v2] virsh: Add message to terminal when running snapshot-revert Date: Mon, 28 Nov 2022 16:33:40 +0900 Message-Id: <20221128073340.134209-1-ohata.haruka@fujitsu.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 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 3.1 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: , Cc: ohata.haruka@fujitsu.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1669620943713100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When running virsh snapshot-* command, such as snapshot-create-as / snapshot-delete, it prints a result message. On the other hand virsh snapshot-revert command doesn't print a result message. So, This patch fixes to add message when running virsh snapshot-revert command. --- # virsh snapshot-create-as vm1 test1 Domain snapshot test01 created # virsh snapshot-revert vm1 test1 # virsh snapshot-delete vm1 test1 Domain snapshot test01 deleted # --- Signed-off-by: Haruka Ohata --- tests/virsh-snapshot | 3 +++ tools/virsh-snapshot.c | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/virsh-snapshot b/tests/virsh-snapshot index 4c64bb537b..b09273917b 100755 --- a/tests/virsh-snapshot +++ b/tests/virsh-snapshot @@ -100,11 +100,14 @@ Domain snapshot s1 created =20 Domain snapshot s3 created Domain snapshot s2 created +Domain snapshot s3 reverted =20 Domain snapshot s6 created Domain snapshot s5 created +Domain snapshot s6 reverted =20 Domain snapshot s4 created +Domain snapshot s1 reverted =20 Domain snapshot s7 created Domain snapshot s8 created diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 8fa64ba903..4576bf1020 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1745,7 +1745,7 @@ static const vshCmdOptDef opts_snapshot_revert[] =3D { }; =20 static bool -cmdDomainSnapshotRevert(vshControl *ctl, const vshCmd *cmd) +cmdSnapshotRevert(vshControl *ctl, const vshCmd *cmd) { g_autoptr(virshDomain) dom =3D NULL; const char *name =3D NULL; @@ -1783,7 +1783,11 @@ cmdDomainSnapshotRevert(vshControl *ctl, const vshCm= d *cmd) result =3D virDomainRevertToSnapshot(snapshot, flags); } =20 - return result >=3D 0; + if (virDomainRevertToSnapshot(snapshot, flags) < 0) + vshError(ctl, _("Failed to revert snapshot %s"), name); + else + vshPrintExtra(ctl, _("Domain snapshot %s reverted\n"), name); + return result; } =20 /* @@ -1916,7 +1920,7 @@ const vshCmdDef snapshotCmds[] =3D { .flags =3D 0 }, {.name =3D "snapshot-revert", - .handler =3D cmdDomainSnapshotRevert, + .handler =3D cmdSnapshotRevert, .opts =3D opts_snapshot_revert, .info =3D info_snapshot_revert, .flags =3D 0 --=20 2.38.1