From 0e6a0b3596aaea1ae1bea03b42b5373358077dc8 Mon Sep 17 00:00:00 2001 From: Paulo Henrique Lopes Ribeiro Date: Thu, 5 Dec 2013 09:42:28 -0200 Subject: [PATCH] Added parameter to force request timeout on xen --- lib/fog/xenserver.rb | 3 ++- lib/fog/xenserver/compute.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/fog/xenserver.rb b/lib/fog/xenserver.rb index 0d233061a..3e0a5c194 100644 --- a/lib/fog/xenserver.rb +++ b/lib/fog/xenserver.rb @@ -14,9 +14,10 @@ module Fog class Connection require 'xmlrpc/client' - def initialize(host) + def initialize(host, timeout) @factory = XMLRPC::Client.new(host, '/') @factory.set_parser(NokogiriStreamParser.new) + @factory.timeout = timeout end def authenticate( username, password ) diff --git a/lib/fog/xenserver/compute.rb b/lib/fog/xenserver/compute.rb index ad92a33d3..a521dc2e0 100644 --- a/lib/fog/xenserver/compute.rb +++ b/lib/fog/xenserver/compute.rb @@ -86,7 +86,8 @@ module Fog @username = options[:xenserver_username] @password = options[:xenserver_password] @defaults = options[:xenserver_defaults] || {} - @connection = Fog::XenServer::Connection.new(@host) + @timeout = options[:xenserver_timeout] || 30 + @connection = Fog::XenServer::Connection.new(@host, @timeout) @connection.authenticate(@username, @password) end