[PATCH] virsh: Add message to terminal when running snapshot-revert

Ján Tomko jtomko at redhat.com
Tue Nov 22 08:12:45 UTC 2022


On a Tuesday in 2022, Haruka Ohata wrote:
>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 <ohata.haruka at fujitsu.com>
>---
> tests/virsh-snapshot   | 3 +++
> tools/virsh-snapshot.c | 1 +
> 2 files changed, 4 insertions(+)
>
>diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
>index 8fa64ba903..6a6c92d0a3 100644
>--- a/tools/virsh-snapshot.c
>+++ b/tools/virsh-snapshot.c
>@@ -1783,6 +1783,7 @@ cmdDomainSnapshotRevert(vshControl *ctl, const vshCmd *cmd)
>         result = virDomainRevertToSnapshot(snapshot, flags);
>     }
>
>+    vshPrintExtra(ctl, _("Domain snapshot %s reverted\n"), name);
>     return result >= 0;

This would print the message regardless of what the
virDomainRevertToSnapshot API would return.

Looks like we need to return the value the way it was done before
commit 19b77df5cc0b7577cb5b045c76f8b79221f32ac0

Jano

> }
>
>-- 
>2.38.1
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20221122/a708e2b3/attachment.sig>


More information about the libvir-list mailing list