Bug 1002093 - External scheduler balancing don't work due to ClassCastException.
Summary: External scheduler balancing don't work due to ClassCastException.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ---
: 3.3.0
Assignee: Gilad Chaplik
QA Contact: Lukas Svaty
URL:
Whiteboard: sla
Depends On:
Blocks: 1019461
TreeView+ depends on / blocked
 
Reported: 2013-08-28 13:11 UTC by Ondra Machacek
Modified: 2016-02-10 20:19 UTC (History)
7 users (show)

Fixed In Version: is14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-21 22:12:26 UTC
oVirt Team: SLA
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 18802 0 None None None Never
oVirt gerrit 18820 0 None None None Never

Description Ondra Machacek 2013-08-28 13:11:53 UTC
Description of problem:
When user write it's own external balancer method, then balancing is never
called because of ClassCastException.

Version-Release number of selected component (if applicable):
is11

How reproducible:
always

Steps to Reproduce:
0. install ovirt-scheduler-proxy
1. Add balancer from addition info to /usr/share/ovirt-scheduler-proxy/plugins
2. rhevm-config -s ExternalSchedulerEnabled=true
3. service ovirt-scheduler-proxy start && service ovirt-engine restart
4. Create cluster policy and assing it external balancer.
5. Have at least 2 hosts in cluster, create and run vm.

Actual results:
Balance function doesn't take effect

Expected results:
Balance function is called properly.

Additional info:
Used ovirt-scheduler-proxy rpm build from current upstream.
After timeout to call balancing method is invoked, then this ERROR appears in engine.log

2013-08-28 14:46:53,896 ERROR [org.ovirt.engine.core.utils.timer.SchedulerUtilQuartzImpl] (DefaultQuartzScheduler_Worker-26) Failed to invoke scheduled method PerformLoadBalancing: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_25]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_25]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_25]
	at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_25]
	at org.ovirt.engine.core.utils.timer.JobWrapper.execute(JobWrapper.java:60) [scheduler.jar:]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz.jar:]
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz.jar:]
Caused by: java.lang.ClassCastException: java.util.LinkedList cannot be cast to java.util.ArrayList
	at org.ovirt.engine.core.bll.scheduling.SchedulingManager.PerformLoadBalancing(SchedulingManager.java:609) [bll.jar:]
	... 7 more



ovirt-scheduler-proxy.log
Wed, 28 Aug 2013 14:46:48 DEBUG    run_load_balancing::Waiting for balance to finish
Wed, 28 Aug 2013 14:46:48 DEBUG    running ['python', '-c', "import my_balancing2;my_balancing2.balanceFunction(['1fdb21fc-388e-4549-bf48-d0a5399fb1a6', 'ecc463cc-9179-4cd2-8f72-8fbfa737a26d'], {})"] in /usr/share/ovirt-scheduler-proxy/plugins
Wed, 28 Aug 2013 14:46:53 DEBUG    run_load_balancing::returning results


balancer code:
#!/bin/env python
from ovirtsdk.xml import params
from ovirtsdk import api
import ovirtsdk.infrastructure.brokers
import sys
import logging
import random

API = api.API(url='https://localhost/api', insecure=True, debug=False,
              username='admin@internal', password='')

class SampleBalance():
    def balance(self, hosts, args):
        for vm in API.vms.list():
            if vm.get_host() is not None:
                break
        return str(vm.get_id()), [str(hosts[(int)(random.random() * len(hosts))])]


def balanceFunction(hosts, args):
    ''' balFunc '''
    try:
        balanceInstance = SampleBalance()
        print balanceInstance.balance(hosts, args)
    except Exception as ex:
        print >> sys.stderr, ex

regex_balance = "

Comment 1 Lukas Svaty 2013-09-24 16:15:33 UTC
tested on is16

Comment 2 Itamar Heim 2014-01-21 22:12:26 UTC
Closing - RHEV 3.3 Released


Note You need to log in before you can comment on or make changes to this bug.