Fix common.scheduler.base_weight.BaseWeigher to be Python3 compatible
Use six.with_metaclass to create the metaclass. Change-Id: I35402d0ce81799fef23849bbb01fa183e145b954
This commit is contained in:
parent
db7390dc7b
commit
a2fa4878fb
|
@ -19,6 +19,8 @@ Pluggable Weighing support
|
|||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
from openstack.common.scheduler import base_handler
|
||||
|
||||
|
||||
|
@ -61,7 +63,7 @@ class WeighedObject(object):
|
|||
return "<WeighedObject '%s': %s>" % (self.obj, self.weight)
|
||||
|
||||
|
||||
class BaseWeigher(object):
|
||||
class BaseWeigher(six.with_metaclass(abc.ABCMeta, object)):
|
||||
"""Base class for pluggable weighers.
|
||||
|
||||
The attributes maxval and minval can be specified to set up the maximum
|
||||
|
@ -70,8 +72,6 @@ class BaseWeigher(object):
|
|||
from the calculated weights.
|
||||
"""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
minval = None
|
||||
maxval = None
|
||||
|
||||
|
|
1
tox.ini
1
tox.ini
|
@ -75,6 +75,7 @@ commands =
|
|||
tests/unit/rpc/test_dispatcher.py \
|
||||
tests/unit/scheduler/test_base_filter.py \
|
||||
tests/unit/scheduler/test_host_filters.py \
|
||||
tests/unit/scheduler/test_weights.py \
|
||||
tests/unit/test_cfgfilter.py \
|
||||
tests/unit/test_context.py \
|
||||
tests/unit/test_deprecated.py \
|
||||
|
|
Loading…
Reference in New Issue