[libvirt] [PATCH] virsh: fixing virsh prompt when connection changes to readonly mode.

Julio Faracco posted 1 patch 6 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1511741891-6539-1-git-send-email-jcfaracco@gmail.com
tools/virsh.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[libvirt] [PATCH] virsh: fixing virsh prompt when connection changes to readonly mode.
Posted by Julio Faracco 6 years, 4 months ago
This commit, fixes the virsh prompt when reconnection to the same URI is
called: `virsh # connect --readonly` (Reconnect). The problem is happening
because the code is considering URI (name) as a mandatory parameter to change
the prompt. This commit remove the assignment into `priv->readonly` from
`if (name)` conditional.

Before:
    virsh # uri
    qemu:///system

    virsh # connect --readonly

    virsh #

After:
    virsh # uri
    qemu:///system

    virsh # connect --readonly

    virsh >

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

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
---
 tools/virsh.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index d1789f0..89a2bea 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -251,8 +251,10 @@ virshReconnect(vshControl *ctl, const char *name, bool readonly, bool force)
         if (name) {
             VIR_FREE(ctl->connname);
             ctl->connname = vshStrdup(ctl, name);
-            priv->readonly = readonly;
         }
+
+        priv->readonly = readonly;
+
         if (virConnectRegisterCloseCallback(priv->conn, virshCatchDisconnect,
                                             ctl, NULL) < 0)
             vshError(ctl, "%s", _("Unable to register disconnect callback"));
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: fixing virsh prompt when connection changes to readonly mode.
Posted by Erik Skultety 6 years, 4 months ago
On Sun, Nov 26, 2017 at 10:18:11PM -0200, Julio Faracco wrote:
> This commit, fixes the virsh prompt when reconnection to the same URI is
> called: `virsh # connect --readonly` (Reconnect). The problem is happening
> because the code is considering URI (name) as a mandatory parameter to change
> the prompt. This commit remove the assignment into `priv->readonly` from
> `if (name)` conditional.
>
> Before:
>     virsh # uri
>     qemu:///system
>
>     virsh # connect --readonly
>
>     virsh #
>
> After:
>     virsh # uri
>     qemu:///system
>
>     virsh # connect --readonly
>
>     virsh >
>
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1507737
>
> Signed-off-by: Julio Faracco <jcfaracco@gmail.com>

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Wrapped the commit message to 80 characters and pushed.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: fixing virsh prompt when connection changes to readonly mode.
Posted by Pavel Hrdina 6 years, 4 months ago
On Mon, Nov 27, 2017 at 10:20:02AM +0100, Erik Skultety wrote:
> On Sun, Nov 26, 2017 at 10:18:11PM -0200, Julio Faracco wrote:
> > This commit, fixes the virsh prompt when reconnection to the same URI is
> > called: `virsh # connect --readonly` (Reconnect). The problem is happening
> > because the code is considering URI (name) as a mandatory parameter to change
> > the prompt. This commit remove the assignment into `priv->readonly` from
> > `if (name)` conditional.
> >
> > Before:
> >     virsh # uri
> >     qemu:///system
> >
> >     virsh # connect --readonly
> >
> >     virsh #
> >
> > After:
> >     virsh # uri
> >     qemu:///system
> >
> >     virsh # connect --readonly
> >
> >     virsh >
> >
> > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1507737
> >
> > Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
> 
> Reviewed-by: Erik Skultety <eskultet@redhat.com>
> Wrapped the commit message to 80 characters and pushed.

Best practices for commit message is to wrap it to 72 characters :).

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