/** * Makes sure that the V4 cluster has a reference to a scheduling policy that is compatible with the one specified * by the given V3 cluster. If that isn't possible throws an exception that will result in an HTTP error response * sent to the caller. */ public static void assignCompatiblePolicy(V3Cluster v3Cluster, Cluster v4Cluster) { V3SchedulingPolicy v3Policy = v3Cluster.getSchedulingPolicy(); SchedulingPolicy v4Policy = v4Cluster.getSchedulingPolicy(); boolean v3IsSet = v3Policy != null && (v3Policy.isSetName() || v3Policy.isSetPolicy()); boolean v4IsSet = v4Policy != null && (v4Policy.isSetName() || v4Policy.isSetId()); if (v3IsSet && !v4IsSet) { SchedulingPolicy v4CompatiblePolicy = findCompatiblePolicy(v3Policy); if (v4CompatiblePolicy != null) { v4Policy = new SchedulingPolicy(); v4Policy.setId(v4CompatiblePolicy.getId()); v4Cluster.setSchedulingPolicy(v4Policy); } else { V3Fault fault = new V3Fault(); fault.setReason("Operation Failed"); fault.setDetail("Can't find a compatible scheduling policy."); Response response = Response.serverError().entity(fault).build(); throw new WebApplicationException(response); } } }
entity.setTransparentHugepages(true); SchedulingPolicy schedulingPolicy = model.getSchedulingPolicy(); if (schedulingPolicy != null) { if (schedulingPolicy.isSetName()) {
Guid clusterPolicyId = entity.getClusterPolicyId(); if (clusterPolicyId != null) { SchedulingPolicy schedulingPolicy = model.getSchedulingPolicy(); if (schedulingPolicy == null) { schedulingPolicy = new SchedulingPolicy();
assertNotNull(transform.getDataCenter()); assertEquals(model.getDataCenter().getId(), transform.getDataCenter().getId()); assertNotNull(transform.getSchedulingPolicy()); assertEquals(model.getSchedulingPolicy().getId(), transform.getSchedulingPolicy().getId()); assertEquals(model.getErrorHandling().getOnError(), transform.getErrorHandling().getOnError()); assertNotNull(transform.getMemoryPolicy());
SchedulingPolicy fromPolicy = from.getSchedulingPolicy(); if (fromPolicy != null && fromPolicy.isSetId()) { SystemResource systemResource = BackendApiResource.getInstance();