Search in sources :

Example 1 with ClusterFailoverLevelAdmissionControlPolicy

use of com.vmware.vim25.ClusterFailoverLevelAdmissionControlPolicy in project coprhd-controller by CoprHD.

the class VcenterClusterSettingsConverter method convertAdmissionControlPolicyToClusterDasAdmissionControlPolicy.

public ClusterDasAdmissionControlPolicy convertAdmissionControlPolicyToClusterDasAdmissionControlPolicy(String policy, Integer acpHostFailoverLevel, Integer acpCpuFailoverPercent, Integer acpMemoryFailoverPercent) throws Exception {
    if (policy.equals("hostFailureLevel")) {
        // Option 1 - Host
        ClusterFailoverLevelAdmissionControlPolicy cflacp = new ClusterFailoverLevelAdmissionControlPolicy();
        // failures cluster
        // tolerates
        cflacp.setFailoverLevel(validateFailoverRange(acpHostFailoverLevel));
        return cflacp;
    } else if (policy.equals("resourcePercentage")) {
        // Option 2 -
        ClusterFailoverResourcesAdmissionControlPolicy cdracp = new ClusterFailoverResourcesAdmissionControlPolicy();
        // Percentage of
        // cluster
        // resources
        // reserved as
        // failover for
        // spare capacity
        // This is the only option exposed in the UI
        cdracp.setCpuFailoverResourcesPercent(validatePercentage(acpCpuFailoverPercent));
        cdracp.setMemoryFailoverResourcesPercent(validatePercentage(acpMemoryFailoverPercent));
        return cdracp;
    // } else if(policy == AdmissionControlPolicy.SPECIFIED_HOST.name) {
    // ClusterFailoverHostAdmissionControlPolicy cfhacp = new ClusterFailoverHostAdmissionControlPolicy(); // Option 3 - Specify a
    // failover host TODO
    // cfhacp.setFailoverHosts([]); // list of a single host
    // return cfhacp // Admission Control Policy
    } else {
        _log.error("Invalid admission control policy " + policy);
        throw new Exception("Invalid admission control policy " + policy);
    }
}
Also used : ClusterFailoverResourcesAdmissionControlPolicy(com.vmware.vim25.ClusterFailoverResourcesAdmissionControlPolicy) ClusterFailoverLevelAdmissionControlPolicy(com.vmware.vim25.ClusterFailoverLevelAdmissionControlPolicy)

Aggregations

ClusterFailoverLevelAdmissionControlPolicy (com.vmware.vim25.ClusterFailoverLevelAdmissionControlPolicy)1 ClusterFailoverResourcesAdmissionControlPolicy (com.vmware.vim25.ClusterFailoverResourcesAdmissionControlPolicy)1