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.
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 8
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
45
46
47
48
49
50
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 45
def agent_alive?
agent_client(@vm).ping
true
rescue Bosh::Director::RpcTimeout
false
end
|
#delete_vm ⇒ Object
72
73
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 72
def delete_vm
end
|
#description ⇒ Object
21
22
23
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 21
def description
"#{instance_name(@vm)} (#{@vm.cid}) is not responding"
end
|
#ensure_cid ⇒ Object
52
53
54
55
56
57
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 52
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
59
60
61
62
63
64
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 59
def ensure_no_cid
if @vm.cid
handler_error("VM `#{@vm.id}' has a cloud id, " +
'please use a different resolution.')
end
end
|
66
67
68
69
70
|
# File 'lib/bosh/director/problem_handlers/unresponsive_agent.rb', line 66
def validate
if agent_alive?
handler_error('Agent is responding now, skipping resolution')
end
end
|