Increase xml rpc timeout

With hundreds of nodes Cobbler sync cannot fit default 30 secods
timeout. Cobbler performance is going to be investigated in the next
release. By now lets just increase the timeout.

Change-Id: Ief8ff93fc808549e8d729040512a266b0c09383d
Closes-Bug: #1608700
This commit is contained in:
Georgy Kibardin 2016-09-08 11:29:56 +03:00
parent 5d2cf196dd
commit f030161d19
3 changed files with 10 additions and 0 deletions

View File

@ -39,6 +39,7 @@ module Astute
Astute.logger.debug("Connecting to cobbler with: host: #{host} port: #{port} path: #{path}")
@remote = XMLRPC::Client.new(host, path, port)
@remote.timeout = 120
Astute.logger.debug("Cobbler initialize with username: #{@username}, password: #{@password}")
end

View File

@ -28,6 +28,7 @@ describe Cobbler do
password = 'pass'
remote = mock()
remote.expects(:timeout=)
tmp = XMLRPC::Client
XMLRPC::Client = mock() do
expects(:new).with(host, path, port).returns(remote)
@ -47,6 +48,7 @@ describe Cobbler do
path = "/api"
port = "1234"
remote = mock()
remote.expects(:timeout=)
tmp = XMLRPC::Client
XMLRPC::Client = mock() do
expects(:new).with(host, path, port).returns(remote)
@ -64,6 +66,7 @@ describe Cobbler do
context "cobbler methods" do
before(:each) do
remote = mock() do
stubs(:timeout=)
stubs(:call)
stubs(:call).with('login', 'cobbler', 'cobbler').returns('remotetoken')
end
@ -173,6 +176,7 @@ describe Cobbler do
it 'should generate token in every cobbler call where token need' do
remote = mock() do
stubs(:timeout=)
stubs(:call).twice.with('sync', 'remotetoken')
expects(:call).twice.with('login', 'cobbler', 'cobbler').returns('remotetoken')
end
@ -200,6 +204,7 @@ describe Cobbler do
it 'should try sync several time before raise a exception (Net)' do
remote = mock() do
stubs(:timeout=)
stubs(:call).with('sync', 'remotetoken')
.raises(Net::ReadTimeout)
.then.returns(nil)
@ -216,6 +221,7 @@ describe Cobbler do
it 'should try sync several time before raise a exception (XMLRPC)' do
remote = mock() do
stubs(:timeout=)
stubs(:call).with('sync', 'remotetoken')
.raises(XMLRPC::FaultException.new("", ""))
.then.returns(nil)
@ -232,6 +238,7 @@ describe Cobbler do
it 'should raise a exception if sync do not succeed after several(3) tries' do
remote = mock() do
stubs(:timeout=)
stubs(:call).with('sync', 'remotetoken')
.raises(Net::ReadTimeout)
.then.raises(Net::ReadTimeout)

View File

@ -56,6 +56,7 @@ describe Astute::Provisioner do
before(:each) do
remote = mock() do
stubs(:timeout=)
stubs(:call)
stubs(:call).with('login', 'cobbler', 'cobbler').returns('remotetoken')
end
@ -208,6 +209,7 @@ describe Astute::Provisioner do
context 'node state cases' do
before(:each) do
remote = mock() do
stubs(:timeout=)
stubs(:call)
stubs(:call).with('login', 'cobbler', 'cobbler').returns('remotetoken')
end