[PATCH] esx: Change the default username when connecting to VCenter

Michal Privoznik posted 1 patch 1 year, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/de336665ea854e6e5e66fb54e721eb082512f9bd.1679656283.git.mprivozn@redhat.com
src/esx/esx_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] esx: Change the default username when connecting to VCenter
Posted by Michal Privoznik 1 year, 1 month ago
While it's true that the default username is:

  administrator@${SSO-Domain}

in majority of cases the ${SSO-Domain} is "vsphere.local". But
our code (and what virsh displays then) says it's just
"administrator".

This is wrong also from a different POV: the username must
contain the suffix no matter what and our default suggests
otherwise.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2181234
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/esx/esx_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 9dc5489411..2443e6e88a 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -701,7 +701,8 @@ esxConnectToVCenter(esxPrivate *priv,
     if (conn->uri->user) {
         username = g_strdup(conn->uri->user);
     } else {
-        if (!(username = virAuthGetUsername(conn, auth, "esx", "administrator",
+        if (!(username = virAuthGetUsername(conn, auth, "esx",
+                                            "administrator@vsphere.local",
                                             hostname)))
             return -1;
     }
-- 
2.39.2
Re: [PATCH] esx: Change the default username when connecting to VCenter
Posted by Martin Kletzander 1 year, 1 month ago
On Fri, Mar 24, 2023 at 12:11:23PM +0100, Michal Privoznik wrote:
>While it's true that the default username is:
>
>  administrator@${SSO-Domain}
>
>in majority of cases the ${SSO-Domain} is "vsphere.local". But
>our code (and what virsh displays then) says it's just
>"administrator".
>
>This is wrong also from a different POV: the username must
>contain the suffix no matter what and our default suggests
>otherwise.
>

Not really, I still have some leftover setting that did not have any
suffix.  But that did not use `administrator` either =D

But administartor@vsphere.local is the most common one and it was always
painful to specify the whole username anywhere.

>Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2181234
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

This patch makes complete sense,

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>

... Or as the cool kids would say these days:

/#LGTM

or something like that...

>---
> src/esx/esx_driver.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
>index 9dc5489411..2443e6e88a 100644
>--- a/src/esx/esx_driver.c
>+++ b/src/esx/esx_driver.c
>@@ -701,7 +701,8 @@ esxConnectToVCenter(esxPrivate *priv,
>     if (conn->uri->user) {
>         username = g_strdup(conn->uri->user);
>     } else {
>-        if (!(username = virAuthGetUsername(conn, auth, "esx", "administrator",
>+        if (!(username = virAuthGetUsername(conn, auth, "esx",
>+                                            "administrator@vsphere.local",
>                                             hostname)))
>             return -1;
>     }
>-- 
>2.39.2
>