Class: XenAPI::XenAPIProxy
- Inherits:
-
XMLRPC::Client::Proxy
- Object
- XMLRPC::Client::Proxy
- XenAPI::XenAPIProxy
- Defined in:
- lib/xencap/xenapi.rb
Instance Method Summary collapse
-
#clone(*args) ⇒ Object
method name clash between built-in clone and the method to clone a VM.
- #method_missing(method, *args, &block) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/xencap/xenapi.rb', line 167 def method_missing(method, *args, &block) begin if (@prefix == 'session.') && (Session::LOGIN_METHODS.include? method.to_s) parse_result super(method, *args, &block) else retry_count = 0 while (retry_count < RETRY_COUNT) session_args = [server(:session)] + args begin return parse_result super(method, *session_args, &block) rescue SessionInvalidError retry_count += 1 if server(:last_login_method) @server.send(server(:last_login_method), *server(:last_login_params)) else raise XMLRPC::FaultException.new(401, "You must log in") end end end raise ::XMLRPC::FaultException.new(500, "Tried #{RETRY_COUNT} times to get a valid session, but failed") end ensure # ensure we clear the global state on logout @server.send(:_logout) if (@prefix == 'session.') && (method == :logout) end end |
Instance Method Details
#clone(*args) ⇒ Object
method name clash between built-in clone and the method to clone a VM
197 198 199 |
# File 'lib/xencap/xenapi.rb', line 197 def clone(*args) args.length > 0 ? method_missing(:clone, *args) : super end |