[libvirt] [PATCH] virsh: fix snapshot list --parent

Ján Tomko posted 1 patch 5 years, 9 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/d6ec23b435b3cb835468197b8a0429f6cfa0ba02.1550152099.git.jtomko@redhat.com
tools/virsh-snapshot.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[libvirt] [PATCH] virsh: fix snapshot list --parent
Posted by Ján Tomko 5 years, 9 months ago
The root snapshot does not have a parent.
Use NULLSTR_EMPTY to pass an empty string instead of putting
too few columns in the table.

https://bugzilla.redhat.com/show_bug.cgi?id=1662849

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 tools/virsh-snapshot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 90000ef1aa..6cadb2b0d6 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -1608,7 +1608,8 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
                  &time_info);
 
         if (parent) {
-            if (vshTableRowAppend(table, snap_name, timestr, state, parent_snap,
+            if (vshTableRowAppend(table, snap_name, timestr, state,
+                                  NULLSTR_EMPTY(parent_snap),
                                   NULL) < 0)
                 goto cleanup;
         } else {
-- 
2.19.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: fix snapshot list --parent
Posted by Eric Blake 5 years, 9 months ago
On 2/14/19 7:48 AM, Ján Tomko wrote:
> The root snapshot does not have a parent.
> Use NULLSTR_EMPTY to pass an empty string instead of putting
> too few columns in the table.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1662849
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  tools/virsh-snapshot.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
> index 90000ef1aa..6cadb2b0d6 100644
> --- a/tools/virsh-snapshot.c
> +++ b/tools/virsh-snapshot.c
> @@ -1608,7 +1608,8 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
>                   &time_info);
>  
>          if (parent) {
> -            if (vshTableRowAppend(table, snap_name, timestr, state, parent_snap,
> +            if (vshTableRowAppend(table, snap_name, timestr, state,
> +                                  NULLSTR_EMPTY(parent_snap),
>                                    NULL) < 0)
>                  goto cleanup;
>          } else {
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list