mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Switch back to read-only system connection (#1397)
With the rework to use the default connection to retrieve the domain to allow running of the qemu agent, no longer necessary to use a read write system connection, and can revert to a read-only connection that requires less privileges. This should remove an occurrence of polkit requesting a password when bringing a VM up using a session connection. Fixes: #1342
This commit is contained in:
@@ -61,7 +61,7 @@ module VagrantPlugins
|
|||||||
|
|
||||||
config = @machine.provider_config
|
config = @machine.provider_config
|
||||||
|
|
||||||
@system_connection = Libvirt::open(config.system_uri)
|
@system_connection = Libvirt::open_read_only(config.system_uri)
|
||||||
@system_connection
|
@system_connection
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -80,15 +80,15 @@ describe VagrantPlugins::ProviderLibvirt::Driver do
|
|||||||
# system_uri should be 'qemu+ssh://user@remote1/system'
|
# system_uri should be 'qemu+ssh://user@remote1/system'
|
||||||
# and not 'qemu:///system'.
|
# and not 'qemu:///system'.
|
||||||
it 'should configure a separate connection per machine' do
|
it 'should configure a separate connection per machine' do
|
||||||
expect(Libvirt).to receive(:open).with('qemu:///system').and_return(system_connection1)
|
expect(Libvirt).to receive(:open_read_only).with('qemu:///system').and_return(system_connection1)
|
||||||
expect(Libvirt).to receive(:open).with('qemu:///system').and_return(system_connection2)
|
expect(Libvirt).to receive(:open_read_only).with('qemu:///system').and_return(system_connection2)
|
||||||
|
|
||||||
expect(machine.provider.driver.system_connection).to eq(system_connection1)
|
expect(machine.provider.driver.system_connection).to eq(system_connection1)
|
||||||
expect(machine2.provider.driver.system_connection).to eq(system_connection2)
|
expect(machine2.provider.driver.system_connection).to eq(system_connection2)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should configure the connection once' do
|
it 'should configure the connection once' do
|
||||||
expect(Libvirt).to receive(:open).with('qemu:///system').and_return(system_connection1)
|
expect(Libvirt).to receive(:open_read_only).with('qemu:///system').and_return(system_connection1)
|
||||||
|
|
||||||
expect(machine.provider.driver.system_connection).to eq(system_connection1)
|
expect(machine.provider.driver.system_connection).to eq(system_connection1)
|
||||||
expect(machine.provider.driver.system_connection).to eq(system_connection1)
|
expect(machine.provider.driver.system_connection).to eq(system_connection1)
|
||||||
|
|||||||
Reference in New Issue
Block a user