Class: Bosh::Director::ProblemHandlers::UnresponsiveAgent
- Inherits:
-
Base
- Object
- Base
- Bosh::Director::ProblemHandlers::UnresponsiveAgent
show all
- Defined in:
- lib/bosh/director/problem_handlers/unresponsive_agent.rb
Constant Summary
CloudcheckHelper::DEFAULT_AGENT_TIMEOUT
Instance Attribute Summary
Attributes inherited from Base
#data, #job
Instance Method Summary
collapse
Methods inherited from Base
action, action_for, #apply_resolution, auto_resolution, #auto_resolution, #auto_resolve, #checkpoint, #cloud, create_by_type, create_from_model, get_auto_resolution, inherited, init_dsl_data, plan, plan_for, register_as, resolution, #resolution_plan, #resolutions
#agent_client, #agent_timeout_guard, #cloud, #delete_vm_reference, #handler_error, #instance_name, #reboot_vm, #recreate_vm
Constructor Details
Returns a new instance of UnresponsiveAgent.
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 10
def initialize(vm_id, data)
super
@vm = Models::Vm[vm_id]
if @vm.nil?
handler_error("VM `#{vm_id}' is no longer in the database")
end
if @vm.agent_id.nil?
handler_error("VM `#{vm_id}' doesn't have an agent id")
end
end
|
Instance Method Details
#agent_alive? ⇒ Boolean
47
48
49
50
51
52
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 47
def agent_alive?
agent_client(@vm).ping
true
rescue Bosh::Director::RpcTimeout
false
end
|
#delete_vm ⇒ Object
74
75
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 74
def delete_vm
end
|
#description ⇒ Object
23
24
25
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 23
def description
"#{instance_name(@vm)} (#{@vm.cid}) is not responding"
end
|
#ensure_cid ⇒ Object
54
55
56
57
58
59
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 54
def ensure_cid
if @vm.cid.nil?
handler_error("VM `#{@vm.id}' doesn't have a cloud id, " +
"only resolution is to delete the VM reference.")
end
end
|
#ensure_no_cid ⇒ Object
61
62
63
64
65
66
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 61
def ensure_no_cid
if @vm.cid
handler_error("VM `#{@vm.id}' has a cloud id, " +
"please use a different resolution.")
end
end
|
68
69
70
71
72
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 68
def validate
if agent_alive?
handler_error("Agent is responding now, skipping resolution")
end
end
|