expandResource(ClusterId.from(clusterName), resourceId);
}
}
private void expandResource(ClusterId clusterId, ResourceId resourceId) {
ResourceAccessor accessor = resourceAccessor(clusterId.stringify());
Resource resource = accessor.readResource(resourceId);
SemiAutoRebalancerContext context =
resource.getRebalancerConfig().getRebalancerContext(SemiAutoRebalancerContext.class);
if (context == null) {
LOG.info("Only SEMI_AUTO mode supported for resource expansion");
return;
}
if (context.anyLiveParticipant()) {
LOG.info("Resource uses ANY_LIVE_PARTICIPANT, skipping default assignment");
return;
}
if (context.getPreferenceLists().size() == 0) {
LOG.info("No preference lists have been set yet, skipping default assignment");
return;
}
accessor.generateDefaultAssignment(resourceId, -1, null);
}