@Test public void testRepairByHostGroups() { HostGroup hostGroup1 = new HostGroup(); hostGroup1.setName("hostGroup1"); hostGroup1.setRecoveryMode(RecoveryMode.MANUAL); InstanceMetaData host1 = getHost("host1", hostGroup1.getName(), InstanceStatus.SERVICES_UNHEALTHY, InstanceGroupType.CORE); hostGroup1.setInstanceGroup(host1.getInstanceGroup()); when(hostGroupService.getByCluster(eq(1L))).thenReturn(Set.of(hostGroup1)); when(stackUpdater.updateStackStatus(1L, DetailedStackStatus.REPAIR_IN_PROGRESS)).thenReturn(stack); when(stackService.getByIdWithListsInTransaction(1L)).thenReturn(stack); when(stack.getInstanceMetaDataAsList()).thenReturn(List.of(host1)); underTest.repairHostGroups(1L, Set.of("hostGroup1"), false, false); verify(flowManager).triggerClusterRepairFlow(eq(1L), eq(Map.of("hostGroup1", List.of("host1"))), eq(false), eq(false)); }
public FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices) { Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStart = validateRepair(ManualClusterRepairMode.HOST_GROUP, stackId, hostGroups, false); return triggerRepairOrThrowBadRequest(stackId, repairStart, removeOnly, restartServices, hostGroups); }
ClusterRepairService { public FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices) { Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStart = validateRepair(ManualClusterRepairMode.HOST_GROUP, stackId, hostGroups, false); return triggerRepairOrThrowBadRequest(stackId, repairStart, removeOnly, restartServices, hostGroups); } }
ClusterRepairService { public FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices) { Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStart = validateRepair(ManualClusterRepairMode.HOST_GROUP, stackId, hostGroups, false); return triggerRepairOrThrowBadRequest(stackId, repairStart, removeOnly, restartServices, hostGroups); }  }
ClusterRepairService { public FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices) { Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStart = validateRepair(ManualClusterRepairMode.HOST_GROUP, stackId, hostGroups, false); return triggerRepairOrThrowBadRequest(stackId, repairStart, removeOnly, restartServices, hostGroups); }  FlowIdentifier repairAll(Long stackId); FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices); FlowIdentifier repairNodes(Long stackId, Set<String> nodeIds, boolean deleteVolumes, boolean removeOnly, boolean restartServices); Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairWithDryRun(Long stackId); }
ClusterRepairService { public FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices) { Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairStart = validateRepair(ManualClusterRepairMode.HOST_GROUP, stackId, hostGroups, false); return triggerRepairOrThrowBadRequest(stackId, repairStart, removeOnly, restartServices, hostGroups); }  FlowIdentifier repairAll(Long stackId); FlowIdentifier repairHostGroups(Long stackId, Set<String> hostGroups, boolean removeOnly, boolean restartServices); FlowIdentifier repairNodes(Long stackId, Set<String> nodeIds, boolean deleteVolumes, boolean removeOnly, boolean restartServices); Result<Map<HostGroupName, Set<InstanceMetaData>>, RepairValidation> repairWithDryRun(Long stackId);  }