Class: Wakame::ClusterManager
- Inherits:
-
Object
- Object
- Wakame::ClusterManager
show all
- Includes:
- Manager
- Defined in:
- lib/wakame/master.rb
Defined Under Namespace
Classes: ClusterConfigLoader, ServiceClusterPool
Instance Attribute Summary
Attributes included from Manager
#master
Instance Method Summary
collapse
Methods included from Manager
#start, #stop
Instance Method Details
#clusters ⇒ Object
241
242
243
|
# File 'lib/wakame/master.rb', line 241
def clusters
ServiceClusterPool.all.map{|r| r.service_cluster_id }
end
|
#init ⇒ Object
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
# File 'lib/wakame/master.rb', line 207
def init
@status_check_timer = EM::PeriodicTimer.new(5) {
StatusDB.pass {
clusters.each { |cluster_id|
Service::ServiceCluster.find(cluster_id).update_cluster_status
}
}
}
@check_event_tickets = []
[Event::ServiceOnline, Event::ServiceOffline, Event::ServiceFailed].each { |evclass|
@check_event_tickets << EventDispatcher.subscribe(evclass) { |event|
StatusDB.pass {
clusters.each { |cluster_id|
Service::ServiceCluster.find(cluster_id).update_cluster_status
}
}
}
}
end
|
#load_config_cluster ⇒ Object
254
255
256
257
258
259
|
# File 'lib/wakame/master.rb', line 254
def load_config_cluster
ClusterConfigLoader.new.load.each { |name, id|
ServiceClusterPool.register_cluster(name)
}
resolve_template_vm_attr
end
|
#register(cluster) ⇒ Object
245
246
247
248
|
# File 'lib/wakame/master.rb', line 245
def register(cluster)
raise ArgumentError unless cluster.is_a?(Service::ServiceCluster)
ServiceClusterPool.register_cluster(cluster.name)
end
|
#reload ⇒ Object
231
232
|
# File 'lib/wakame/master.rb', line 231
def reload
end
|
#terminate ⇒ Object
234
235
236
237
238
239
|
# File 'lib/wakame/master.rb', line 234
def terminate
@status_check_timer.cancel
@check_event_tickets.each { |t|
EventDispatcher.unsubscribe(t)
}
end
|
#unregister(cluster_id) ⇒ Object
250
251
252
|
# File 'lib/wakame/master.rb', line 250
def unregister(cluster_id)
@clusters.delete(cluster_id)
end
|