virsh list authentication
I am trying out some of the command line virsh and virt- commands on a RHEV host that contains KVM guests under RHEV 3.0 beta 4. I am finding some of the command like virt-list-filesystems to be very nice.
But, "virsh list" asks for authentication user and password. Does anyone know what user it is looking for?
Here is some output:
# virsh list
Please enter your authentication name: admin
Please enter your password:
error: Failed to reconnect to the hypervisor
error: no valid connection
error: authentication failed: authentication failed
# virsh list
Please enter your authentication name: root
Please enter your password:
error: Failed to reconnect to the hypervisor
error: no valid connection
error: authentication failed: authentication failed
Responses
When VDSM is managing a node libvirt is set to allow readonly mode (eg virsh --readonly list) any commands that require write access are locked down.
The virt-* commands you mentioned come from libguestfs, which isn't integrated with RHEV yet.
Hi,
I have gained access by creating a user on each RHEV server:
saslpasswd2 -a libvirt username
And then login with it.
Alisson.
Bravo Alisson :)
[root@xbneqts182 ~]# saslpasswd2 -a libvirt virshadmin Password: ************ Again (for verification): ************
[root@xbneqts182 ~]# virsh nodedev-list --cap vports Please enter your authentication name: virshadmin Please enter your password: ************ scsi_host16 scsi_host7
Since RHEV hosts are managed by VDSM, that in turn uses some parts of the libvirt functionality, you should be using VDSM's command line tool - vdsClient.
To run a VM, you need to run vdsClient -a 0 create <params>
virsh will not be able to power a VM on anyway, because the hosts do not hold VM XML definitions. To really protect against RHEV-M outages you need to secure your RHEV-M - set it up in HA mode and/or keep a local DR backup
The recommendation is to use the virsh readonly mode: 'virsh -r' . However some diagnostics still require using virsh without the readonly flag. Tor those:
Newer RHV (4.x) versions use vdsm@ovirt :
sasldblistusers2 -f /etc/libvirt/passwd.dbvdsm@ovirt: userPassword
Password remains shibboleth .
This keeps coming up as the answer when I google for this very problem. I recently found another comment that might actually be more accurate:
virsh -c qemu:///system?authfile=/etc/ovirt-hosted-engine/virsh_auth.conf
(ref: https://lists.ovirt.org/pipermail/users/2017-January/079157.html)
As of version 8.0.0 the authfile parameter is not recognized anymore.
virsh -c esx://myotherserver/?authfile=/path/to/virsh_auth.conf list 2022-08-16 06:59:07.868+0000: 66562: info : libvirt version: 8.0.0 2022-08-16 06:59:07.868+0000: 66562: info : hostname: myserver 2022-08-16 06:59:07.868+0000: 66562: warning : esxUtil_ParseUri:147 : Ignoring unexpected query parameter 'authfile' error: failed to connect to the hypervisor
The solution is to put the path to the authfile in the environment variable LIBVIRT_AUTH_FILE:
export LIBVIRT_AUTH_FILE=/path/to/virsh_auth.conf virsh -c esx://myotherserver/ list