fix the function named get_count_all

To achieve a unified style in the cluster.py,add function annotation
and rename the third parameter

Change-Id: I271910695d32c06c46e9cf01e072fb756a33cd76
This commit is contained in:
jinzhenguo 2017-06-07 15:48:12 +08:00
parent 24510b20e2
commit 4377e0d5ab
2 changed files with 12 additions and 3 deletions

View File

@ -139,8 +139,17 @@ class Cluster(base.MagnumPersistentObject, base.MagnumObject,
return cluster
@base.remotable_classmethod
def get_count_all(cls, context, **kwargs):
return cls.dbapi.get_cluster_count_all(context, **kwargs)
def get_count_all(cls, context, filters=None):
"""Get count of matching clusters.
:param context: The security context
:param filters: filter dict, can includes 'cluster_template_id',
'name', 'node_count', 'stack_id', 'api_address',
'node_addresses', 'project_id', 'user_id',
'status'(should be a status list), 'master_count'.
:returns: Count of matching clusters.
"""
return cls.dbapi.get_cluster_count_all(context, filters=filters)
@base.remotable_classmethod
def get_by_name(cls, context, name):

View File

@ -355,7 +355,7 @@ class TestObject(test_base.TestCase, _TestObject):
# For more information on object version testing, read
# http://docs.openstack.org/developer/magnum/objects.html
object_data = {
'Cluster': '1.13-87f9b6ff2090663d69a1de2e95c50a27',
'Cluster': '1.13-5da08d5f023eab4c5657c3fb6997e44c',
'ClusterTemplate': '1.17-74e4e6b1faca768714be809a828599c2',
'Certificate': '1.1-1924dc077daa844f0f9076332ef96815',
'MyObj': '1.0-34c4b1aadefd177b13f9a2f894cc23cd',