Search in sources :

Example 1 with GetControllerDataAnswer

use of com.cloud.agent.api.GetControllerDataAnswer 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;
}
Also used : GetControllerDataAnswer(com.cloud.agent.api.GetControllerDataAnswer) GetControllerDataCommand(com.cloud.agent.api.GetControllerDataCommand) BigSwitchBcfDeviceVO(com.cloud.network.BigSwitchBcfDeviceVO) HostVO(com.cloud.host.HostVO)

Aggregations

GetControllerDataAnswer (com.cloud.agent.api.GetControllerDataAnswer)1 GetControllerDataCommand (com.cloud.agent.api.GetControllerDataCommand)1 HostVO (com.cloud.host.HostVO)1 BigSwitchBcfDeviceVO (com.cloud.network.BigSwitchBcfDeviceVO)1