use of com.cloud.agent.api.GetControllerDataCommand in project cloudstack by apache.
the class BigSwitchBcfUtils method getControlClusterData.
public ControlClusterData getControlClusterData(long physicalNetworkId) {
ControlClusterData cluster = new ControlClusterData();
// reusable command to query all devices
GetControllerDataCommand cmd = new GetControllerDataCommand();
// retrieve all registered BCF devices
List<BigSwitchBcfDeviceVO> devices = _bigswitchBcfDao.listByPhysicalNetwork(physicalNetworkId);
for (BigSwitchBcfDeviceVO d : devices) {
HostVO bigswitchBcfHost = _hostDao.findById(d.getHostId());
if (bigswitchBcfHost == null) {
continue;
}
_hostDao.loadDetails(bigswitchBcfHost);
GetControllerDataAnswer answer = (GetControllerDataAnswer) _agentMgr.easySend(bigswitchBcfHost.getId(), cmd);
if (answer != null) {
if (answer.isMaster()) {
cluster.setMaster(bigswitchBcfHost);
} else {
cluster.setSlave(bigswitchBcfHost);
}
}
}
return cluster;
}
Aggregations