Class: Pangea::XObject

Inherits:
Object
  • Object
show all
Defined in:
lib/pangea/objects.rb

Overview

Base class for every Xen Object

Do not use this class.

There’s no direct mapping to xen-api AFAIK

Instance Method Summary collapse

Constructor Details

#initialize(link, ref) ⇒ XObject

:nodoc:



42
43
44
45
46
# File 'lib/pangea/objects.rb', line 42

def initialize(link, ref)
  @ref = ref
  @link = link
  @proxy_name = nil
end

Instance Method Details

#ref_call(method) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/pangea/objects.rb', line 48

def ref_call(method)
  if @proxy.nil?
    # first ref_call, init proxy
    @proxy = @link.client.proxy(@proxy_name)
  end
  begin
    return @proxy.send(method, @link.sid, @ref)['Value']
  rescue Exception => e
      raise ProxyCallError.new("Error sending request to proxy #{@proxy_name}. Link might be dead (#{e.message})")
  end
end

#uuidObject

This is standard in every Xen Object

Returns the unique identifier



65
66
67
# File 'lib/pangea/objects.rb', line 65

def uuid
  ref_call :get_uuid
end