Laszlo Hornyak has uploaded a new change for review. Change subject: [wip] engine: external scheduler integration ......................................................................
[wip] engine: external scheduler integration external scheduler integration Change-Id: I95b6660beb319df0afe569f31c16033bf6192df9 Signed-off-by: Laszlo Hornyak <lhorn...@redhat.com> --- M backend/manager/modules/bll/pom.xml M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java 4 files changed, 67 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/01/17501/1 diff --git a/backend/manager/modules/bll/pom.xml b/backend/manager/modules/bll/pom.xml index ff6038f..4d93e3f 100644 --- a/backend/manager/modules/bll/pom.xml +++ b/backend/manager/modules/bll/pom.xml @@ -114,6 +114,10 @@ <groupId>org.jboss.spec.javax.interceptor</groupId> <artifactId>jboss-interceptors-api_1.1_spec</artifactId> </dependency> + <dependency> + <groupId>org.apache.xmlrpc</groupId> + <artifactId>xmlrpc-client</artifactId> + </dependency> <!-- logging implementation used for unit tests --> <dependency> diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java index ccdd2b0..7c1e8e6 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java @@ -1,5 +1,8 @@ package org.ovirt.engine.core.bll.scheduling; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -13,6 +16,10 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; +import org.apache.xmlrpc.XmlRpcException; +import org.apache.xmlrpc.client.XmlRpcClient; +import org.apache.xmlrpc.client.XmlRpcClientConfig; +import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; import org.ovirt.engine.core.common.businessentities.MigrationSupport; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSGroup; @@ -20,6 +27,7 @@ import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.common.config.ConfigValues; +import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.common.scheduling.ClusterPolicy; import org.ovirt.engine.core.common.scheduling.PolicyUnit; import org.ovirt.engine.core.common.utils.Pair; @@ -173,6 +181,12 @@ policy.getFilterPositionMap(), messages, memoryChecker); + + // filter the hosts through external filters as last step in filtering + vdsList = + runExternalFilters(vdsList, + parameters, messages); + if (vdsList == null || vdsList.size() == 0) { return null; } @@ -225,10 +239,40 @@ policy.getFilterPositionMap(), messages, noWaitingMemoryChecker); + + // after running the internal filters, run the external filters + vdsList = + runExternalFilters(vdsList, + parameters, + messages); + if (vdsList == null || vdsList.size() == 0) { return false; } return true; + } + + protected List<VDS> runExternalFilters(List<VDS> vdsList, Map<String, Object> parameters, List<String> messages) { + String extSchedUrl = Config.GetValue(ConfigValues.ExternalSchedulerServiceURL); + XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); + config.setConnectionTimeout((Integer) Config.GetValue(ConfigValues.ExternalSchedulerConnectionTimeout)); + try { + config.setServerURL(new URL(extSchedUrl)); + XmlRpcClient client = new XmlRpcClient(); + client.setConfig(config); + //TODO: build parameters + Object result = client.execute("runFilters", new Object[]{}); + //TODO: parse results (should be a Map), return results + + } catch (IOException|XmlRpcException e) { + log.error("Could not communicate with the external scheduler at " + extSchedUrl, e); + messages.add(VdcBllMessages.EXTERNAL_SCHEDULER_FAIL.toString()); + // TODO: decision is needed what to do here: + // - return all vds without filtering? + // - return empty vds list? + } + //TODO: temporary placeholder + return vdsList; } protected boolean checkDestinationHost(VM vm, @@ -252,6 +296,10 @@ policy.getFilterPositionMap(), messages, memoryChecker); + + // check with the external filters + destVdsList = runExternalFilters(destVdsList, parameters, messages); + return destVdsList != null && destVdsList.size() == 1; } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java index e3298f9..42fec15 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java @@ -1449,6 +1449,18 @@ @DefaultValueAttribute("true") NormalizedMgmgNetworkEnabled(522), + @TypeConverterAttribute(String.class) + @DefaultValueAttribute("http://localhost:18781/") + ExternalSchedulerServiceURL(523), + + @TypeConverterAttribute(Integer.class) + @DefaultValueAttribute("100") + ExternalSchedulerConnectionTimeout(523), + + @TypeConverterAttribute(Boolean.class) + @DefaultValueAttribute("false") + ExternalSchedulerBehavior(523), + Invalid(65535); private int intValue; diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java index 8d744fd..2d0fa44 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java @@ -763,6 +763,9 @@ ACTION_TYPE_FAILED_NETWORK_QOS_NOT_FOUND(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_NETWORK_QOS_INVALID_DC_ID(ErrorType.BAD_PARAMETERS), ACTION_TYPE_FAILED_NETWORK_QOS_PEAK_LOWER_THAN_AVERAGE(ErrorType.BAD_PARAMETERS), + + //exteral scheduler + EXTERNAL_SCHEDULER_FAIL(ErrorType.INTERNAL_ERROR), // memory QOS features QOS_BALLOON_NOT_SUPPORTED(ErrorType.BAD_PARAMETERS); -- To view, visit http://gerrit.ovirt.org/17501 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I95b6660beb319df0afe569f31c16033bf6192df9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Laszlo Hornyak <lhorn...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches