Noam Slomianko has uploaded a new change for review. Change subject: External scheduler: last sample changes ......................................................................
External scheduler: last sample changes - Move to the final function names - Reflect the change in the utils and loader modules Signed-off-by: Noam Slomianko <nslom...@redhat.com> Change-Id: I85178aa5d6c67c76c20df3caed3ddc5cf9bc49cc --- M plugins/dummy.py M src/ovirtscheduler/loader.py M src/ovirtscheduler/utils.py 3 files changed, 15 insertions(+), 23 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-scheduler-proxy refs/changes/97/18397/1 diff --git a/plugins/dummy.py b/plugins/dummy.py index 1c6a108..146a36f 100755 --- a/plugins/dummy.py +++ b/plugins/dummy.py @@ -38,6 +38,10 @@ import ovirtsdk.infrastructure.brokers import sys +#How to validate the input, used to show the options to the user +#in the UI +properties_validation = '' + class SampleFilter(): @@ -58,7 +62,7 @@ # Notice: plugin filters are going to run in process that will be created and destroyed # per request, you cannot save state in memory -def filterFunction(hosts, vm, args): +def do_filter(hosts, vm, args): '''This is a simple filter that returns all given host ID''' try: filterClassInstance = SampleFilter() @@ -67,9 +71,6 @@ print filterClassInstance.filter(hosts, vm, args) except Exception as ex: print >> sys.stderr, ex - -regex_filter = "" - #Files can hold all three supported functions (filterFucntion,scoreFunction,balanceFunction) class SampleScore(): @@ -96,15 +97,13 @@ return hostScores -def scoreFunction(hosts, vm, args): +def do_score(hosts, vm, args): '''This is a simple score function that returns all given host ID with score 50''' try: scoreClassInstance = SampleScore() print scoreClassInstance.score(hosts, vm, args) except Exception as ex: print >> sys.stderr, ex - -regex_score = "" class SampleBalance(): @@ -117,12 +116,10 @@ return '33333333-3333-3333-3333-333333333333', ['11111111-1111-1111-1111-111111111111'] -def balanceFunction(hosts, args): +def do_balance(hosts, args): '''This is a fake balance function that always return the guid 33333333-3333-3333-3333-333333333333''' try: balanceInstance = SampleBalance() print balanceInstance.balance(hosts, args) except Exception as ex: - print >> sys.stderr, ex - -regex_balance = "" \ No newline at end of file + print >> sys.stderr, ex \ No newline at end of file diff --git a/src/ovirtscheduler/loader.py b/src/ovirtscheduler/loader.py index eebdaf3..32b9db5 100644 --- a/src/ovirtscheduler/loader.py +++ b/src/ovirtscheduler/loader.py @@ -20,15 +20,15 @@ retValue += \ getAttributes(mod, _utils.FILTER, - _utils.FILTER_REGEX) + _utils.REGEX) retValue += \ getAttributes(mod, _utils.SCORE, - _utils.SCORE_REGEX) + _utils.REGEX) retValue += \ getAttributes(mod, _utils.BALANCE, - _utils.BALANCE_REGEX) + _utils.REGEX) except Exception as ex: print >> sys.stderr, ex diff --git a/src/ovirtscheduler/utils.py b/src/ovirtscheduler/utils.py index 9ba203f..617c26d 100644 --- a/src/ovirtscheduler/utils.py +++ b/src/ovirtscheduler/utils.py @@ -25,15 +25,10 @@ def __init__(self): pass - FILTER = 'filterFunction' - FILTER_DESCRIPTION = 'desc_filter' - FILTER_REGEX = 'regex_filter' - SCORE = 'scoreFunction' - SCORE_DESCRIPTION = 'desc_score' - SCORE_REGEX = 'regex_score' - BALANCE = 'balanceFunction' - BALANCE_DESCRIPTION = 'desc_balance' - BALANCE_REGEX = 'regex_balance' + FILTER = 'do_filter' + SCORE = 'do_score' + BALANCE = 'do_balance' + REGEX = 'properties_validation' LOADER_MODULE = 'loader' LOADER_FUNC = 'analyze' -- To view, visit http://gerrit.ovirt.org/18397 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I85178aa5d6c67c76c20df3caed3ddc5cf9bc49cc Gerrit-PatchSet: 1 Gerrit-Project: ovirt-scheduler-proxy Gerrit-Branch: master Gerrit-Owner: Noam Slomianko <nslom...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches