Bug 996986

Summary: virsh does not honor uri_default setting in /etc/libvirt/libvirt.conf
Product: [Fedora] Fedora Reporter: James Slagle <jslagle>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: berrange, clalancette, itamar, jforbes, jyang, laine, libvirt-maint, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-14 13:02:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description James Slagle 2013-08-14 12:16:12 UTC
Description of problem:
virsh does not honor uri_default setting in /etc/libvirt/libvirt.conf.
I have 'uri_default = "qemu:///system"' uncommented in /etc/libvirt/libvirt.conf but running 'virsh uri' shows that I'm still connecting to qemu:///session.

Version-Release number of selected component (if applicable):
[root@dublin libvirt]# rpm -q libvirt libvirt-client
libvirt-1.0.5.5-1.fc19.x86_64
libvirt-client-1.0.5.5-1.fc19.x86_64


How reproducible:
[jslagle@dublin ~]$ grep uri_default /etc/libvirt/libvirt.conf
uri_default = "qemu:///system"
[jslagle@dublin ~]$ virsh uri
qemu:///session
(I tried restarting libvirtd as well, but that had no effect)

Note that setting the value in ~/.config/libvirt/libvirt.conf does work:
[jslagle@dublin ~]$ echo uri_default = \"qemu:///system\" >> ~/.config/libvirt/libvirt.conf
[jslagle@dublin ~]$ virsh uri
qemu:///system


Actual results:
I'm still connecting to qemu:///session

Expected results:
should be connected to qemu:///system

Additional info:

Comment 1 Daniel Berrangé 2013-08-14 12:33:51 UTC
The test steps you list work fine for me.

$ virsh uri
qemu:///session
$ echo uri_default = \"qemu:///system\" >> ~/.config/libvirt/libvirt.conf
$ virsh uri
qemu:///system


Do you have either LIBVIRT_DEFAULT_URI or VIRSH_DEFAULT_CONNECT_URI env variables set ? Those will override what's in the config file.

Comment 2 James Slagle 2013-08-14 12:55:15 UTC
(In reply to Daniel Berrange from comment #1)
> The test steps you list work fine for me.
> 
> $ virsh uri
> qemu:///session
> $ echo uri_default = \"qemu:///system\" >> ~/.config/libvirt/libvirt.conf
> $ virsh uri
> qemu:///system

Yes, setting the value in ~/.config/libvirt/libvirt.conf does work for me as I noted.

Setting it in /etc/libvirt/libvirt.conf is what does not work.

> Do you have either LIBVIRT_DEFAULT_URI or VIRSH_DEFAULT_CONNECT_URI env
> variables set ? Those will override what's in the config file.

No.

Comment 3 Daniel Berrangé 2013-08-14 13:02:02 UTC
(In reply to James Slagle from comment #2)
> (In reply to Daniel Berrange from comment #1)
> > The test steps you list work fine for me.
> > 
> > $ virsh uri
> > qemu:///session
> > $ echo uri_default = \"qemu:///system\" >> ~/.config/libvirt/libvirt.conf
> > $ virsh uri
> > qemu:///system
> 
> Yes, setting the value in ~/.config/libvirt/libvirt.conf does work for me as
> I noted.
> 
> Setting it in /etc/libvirt/libvirt.conf is what does not work.

That works if you are running virsh as root. The /etc/libvirt directory is intentionally not readable by non-root users, since some of the files there may contain passwords.