Class: Wakame::Service::Agent
Overview
Data model for agent Status life cycle: STATUS_INIT -> [STATUS_ONLINE|STATUS_OFFLINE|STATUS_TIMEOUT] -> STATUS_END
Constant Summary
collapse
- STATUS_END =
-1
- STATUS_INIT =
-2
- STATUS_OFFLINE =
0
- STATUS_ONLINE =
1
- STATUS_UNKNOWN =
2
- STATUS_TIMEOUT =
3
AttributeHelper::CLASS_TYPE_KEY, AttributeHelper::CONVERT_CLASSES, AttributeHelper::PRIMITIVE_CLASSES
Instance Method Summary
collapse
#delete, #dirty?, inherited, #new_record?, #on_after_delete, #on_after_load, #on_before_delete, #on_before_load, #reload, #save
#dump_attrs, #retrieve_attr_attribute
Instance Method Details
#agent_ip ⇒ Object
58
59
60
|
# File 'lib/wakame/service.rb', line 58
def agent_ip
vm_attr[:local_ipv4]
end
|
#has_resource_type?(key) ⇒ Boolean
94
95
96
97
98
99
100
101
|
# File 'lib/wakame/service.rb', line 94
def has_resource_type?(key)
res_id = key.is_a?(ServiceInstance) ? key.resource.id : Resource.id(key)
reported_services.keys.any? { |k|
svc = ServiceInstance.find(k)
svc.resource.id == res_id
}
end
|
#id ⇒ Object
54
55
56
|
# File 'lib/wakame/service.rb', line 54
def id
@id || raise("Agent.id is unset: #{self}")
end
|
#id=(agent_id) ⇒ Object
50
51
52
|
# File 'lib/wakame/service.rb', line 50
def id=(agent_id)
@id = agent_id
end
|
#last_ping_at_time ⇒ Object
67
68
69
70
|
# File 'lib/wakame/service.rb', line 67
def last_ping_at_time
require 'time'
Time.parse(last_ping_at)
end
|
#mapped? ⇒ Boolean
46
47
48
|
# File 'lib/wakame/service.rb', line 46
def mapped?
!self.cloud_host_id.nil?
end
|
#renew_reported_services(svc_id_list) ⇒ Object
87
88
89
90
91
92
|
# File 'lib/wakame/service.rb', line 87
def renew_reported_services(svc_id_list)
reported_services.clear
svc_id_list.each { |svc_id, data|
reported_services[svc_id] = data
}
end
|
#terminate ⇒ Object
103
104
|
# File 'lib/wakame/service.rb', line 103
def terminate
end
|
#update_status(new_status) ⇒ Object
#vm_id ⇒ Object
62
63
64
|
# File 'lib/wakame/service.rb', line 62
def vm_id
vm_attr[:instance_id]
end
|