Search in sources :

Example 1 with VirtualRecover

use of com.bonree.brfs.rebalance.recover.VirtualRecover in project BRFS by zhangnianli.

the class TaskOperation method launchDelayTaskExecutor.

public void launchDelayTaskExecutor(BalanceTaskSummary taskSummary, String taskPath) {
    DataRecover recover = null;
    List<String> multiIds = taskSummary.getOutputServers();
    if (multiIds.contains(idManager.getSecondServerID(taskSummary.getStorageIndex()))) {
        // 注册自身的selfMultiId,并设置为created阶段
        if (taskSummary.getTaskType() == RecoverType.NORMAL) {
            // 正常迁移任务
            StorageRegion node = snManager.findStorageRegionById(taskSummary.getStorageIndex());
            if (node == null) {
                LOG.error("无法开启对" + taskSummary.getStorageIndex() + "的任务");
                return;
            }
            String storageName = snManager.findStorageRegionById(taskSummary.getStorageIndex()).getName();
            recover = new MultiRecover(taskSummary, idManager, serviceManager, taskPath, client, dataDir, storageName, baseRoutesPath);
        } else if (taskSummary.getTaskType() == RecoverType.VIRTUAL) {
            // 虚拟迁移任务
            StorageRegion node = snManager.findStorageRegionById(taskSummary.getStorageIndex());
            if (node == null) {
                LOG.error("无法开启对" + taskSummary.getStorageIndex() + "的任务");
                return;
            }
            String storageName = snManager.findStorageRegionById(taskSummary.getStorageIndex()).getName();
            recover = new VirtualRecover(client, taskSummary, taskPath, dataDir, storageName, idManager, serviceManager);
        }
        updateTaskStatus(taskSummary, TaskStatus.RUNNING);
        launchTask(recover);
    }
}
Also used : VirtualRecover(com.bonree.brfs.rebalance.recover.VirtualRecover) MultiRecover(com.bonree.brfs.rebalance.recover.MultiRecover) DataRecover(com.bonree.brfs.rebalance.DataRecover) StorageRegion(com.bonree.brfs.duplication.storageregion.StorageRegion)

Aggregations

StorageRegion (com.bonree.brfs.duplication.storageregion.StorageRegion)1 DataRecover (com.bonree.brfs.rebalance.DataRecover)1 MultiRecover (com.bonree.brfs.rebalance.recover.MultiRecover)1 VirtualRecover (com.bonree.brfs.rebalance.recover.VirtualRecover)1