Search in sources :

Example 1 with AttachPrimaryDataStoreCmd

use of org.apache.cloudstack.storage.command.AttachPrimaryDataStoreCmd in project cloudstack by apache.

the class SamplePrimaryDataStoreLifeCycleImpl method attachCluster.

protected void attachCluster(DataStore store) {
    // send down AttachPrimaryDataStoreCmd command to all the hosts in the
    // cluster
    List<EndPoint> endPoints = selector.selectAll(store);
    CreatePrimaryDataStoreCmd createCmd = new CreatePrimaryDataStoreCmd(store.getUri());
    EndPoint ep = endPoints.get(0);
    HostVO host = hostDao.findById(ep.getId());
    if (host.getHypervisorType() == HypervisorType.XenServer) {
        ep.sendMessage(createCmd);
    }
    endPoints.get(0).sendMessage(createCmd);
    AttachPrimaryDataStoreCmd cmd = new AttachPrimaryDataStoreCmd(store.getUri());
    for (EndPoint endp : endPoints) {
        endp.sendMessage(cmd);
    }
}
Also used : AttachPrimaryDataStoreCmd(org.apache.cloudstack.storage.command.AttachPrimaryDataStoreCmd) CreatePrimaryDataStoreCmd(org.apache.cloudstack.storage.command.CreatePrimaryDataStoreCmd) EndPoint(org.apache.cloudstack.engine.subsystem.api.storage.EndPoint) HostVO(com.cloud.host.HostVO)

Aggregations

HostVO (com.cloud.host.HostVO)1 EndPoint (org.apache.cloudstack.engine.subsystem.api.storage.EndPoint)1 AttachPrimaryDataStoreCmd (org.apache.cloudstack.storage.command.AttachPrimaryDataStoreCmd)1 CreatePrimaryDataStoreCmd (org.apache.cloudstack.storage.command.CreatePrimaryDataStoreCmd)1