コード例 #1
0
ファイル: events.py プロジェクト: tomas-mazak/senlin
class EventListRequest(base.SenlinObject):

    action_name_list = list(consts.CLUSTER_ACTION_NAMES)
    action_name_list.extend(list(consts.NODE_ACTION_NAMES))

    fields = {
        'oid':
        fields.ListOfStringsField(nullable=True),
        'oname':
        fields.ListOfStringsField(nullable=True),
        'otype':
        fields.ListOfStringsField(nullable=True),
        'action':
        fields.ListOfEnumField(valid_values=action_name_list, nullable=True),
        'cluster_id':
        fields.ListOfStringsField(nullable=True),
        'level':
        fields.ListOfEnumField(valid_values=list(consts.EVENT_LEVELS.keys()),
                               nullable=True),
        'limit':
        fields.NonNegativeIntegerField(nullable=True),
        'marker':
        fields.UUIDField(nullable=True),
        'sort':
        fields.SortField(valid_keys=list(consts.EVENT_SORT_KEYS),
                         nullable=True),
        'project_safe':
        fields.FlexibleBooleanField(default=True)
    }
コード例 #2
0
ファイル: profiles.py プロジェクト: zhouqiang-cl/senlin
class ProfileListRequest(base.SenlinObject):

    fields = {
        'name': fields.ListOfStringsField(nullable=True),
        'type': fields.ListOfStringsField(nullable=True),
        'limit': fields.NonNegativeIntegerField(nullable=True),
        'marker': fields.UUIDField(nullable=True),
        'sort': fields.SortField(
            valid_keys=list(consts.PROFILE_SORT_KEYS), nullable=True),
        'project_safe': fields.FlexibleBooleanField(default=True),
    }
コード例 #3
0
ファイル: clusters.py プロジェクト: albertjone/senlin
class ClusterListRequest(base.SenlinObject):

    fields = {
        'name': fields.ListOfStringsField(nullable=True),
        'status': fields.ListOfEnumField(
            valid_values=list(consts.CLUSTER_STATUSES), nullable=True),
        'limit': fields.NonNegativeIntegerField(nullable=True),
        'marker': fields.UUIDField(nullable=True),
        'sort': fields.SortField(
            valid_keys=list(consts.CLUSTER_SORT_KEYS), nullable=True),
        'project_safe': fields.FlexibleBooleanField(default=True),
    }
コード例 #4
0
ファイル: receivers.py プロジェクト: tomas-mazak/senlin
class ReceiverListRequest(base.SenlinObject):

    # VERSION 1.0: Initial version
    # VERSION 1.1: Add field 'user'
    VERSION = '1.1'
    VERSION_MAP = {
        '1.4': '1.1',
    }

    fields = {
        'name':
        fields.ListOfStringsField(nullable=True),
        'type':
        fields.ListOfEnumField(valid_values=list(consts.RECEIVER_TYPES),
                               nullable=True),
        'action':
        fields.ListOfEnumField(valid_values=list(consts.CLUSTER_ACTION_NAMES),
                               nullable=True),
        'cluster_id':
        fields.ListOfStringsField(nullable=True),
        'limit':
        fields.NonNegativeIntegerField(nullable=True),
        'marker':
        fields.UUIDField(nullable=True),
        'sort':
        fields.SortField(valid_keys=list(consts.RECEIVER_SORT_KEYS),
                         nullable=True),
        'project_safe':
        fields.FlexibleBooleanField(default=True),
        'user':
        fields.ListOfStringsField(nullable=True),
    }

    def obj_make_compatible(self, primitive, target_version):
        super(ReceiverListRequest,
              self).obj_make_compatible(primitive, target_version)
        target_version = versionutils.convert_version_to_tuple(target_version)
        if target_version < (1, 1):
            if 'user' in primitive['senlin_object.data']:
                del primitive['senlin_object.data']['user']
コード例 #5
0
class ReceiverListRequest(base.SenlinObject):

    fields = {
        'name':
        fields.ListOfStringsField(nullable=True),
        'type':
        fields.ListOfEnumField(valid_values=list(consts.RECEIVER_TYPES),
                               nullable=True),
        'action':
        fields.ListOfEnumField(valid_values=list(consts.CLUSTER_ACTION_NAMES),
                               nullable=True),
        'cluster_id':
        fields.ListOfStringsField(nullable=True),
        'limit':
        fields.NonNegativeIntegerField(nullable=True),
        'marker':
        fields.UUIDField(nullable=True),
        'sort':
        fields.SortField(valid_keys=list(consts.RECEIVER_SORT_KEYS),
                         nullable=True),
        'project_safe':
        fields.FlexibleBooleanField(default=True)
    }
コード例 #6
0
class ActionListRequest(base.SenlinObject):
    action_name_list = list(consts.CLUSTER_ACTION_NAMES)
    action_name_list.extend(list(consts.NODE_ACTION_NAMES))

    VERSION = '1.1'
    VERSION_MAP = {'1.14': '1.1'}

    fields = {
        'name':
        fields.ListOfStringsField(nullable=True),
        'cluster_id':
        fields.ListOfStringsField(nullable=True),
        'action':
        fields.ListOfEnumField(valid_values=action_name_list, nullable=True),
        'target':
        fields.ListOfStringsField(nullable=True),
        'status':
        fields.ListOfEnumField(valid_values=list(consts.ACTION_STATUSES),
                               nullable=True),
        'limit':
        fields.NonNegativeIntegerField(nullable=True),
        'marker':
        fields.UUIDField(nullable=True),
        'sort':
        fields.SortField(valid_keys=list(consts.ACTION_SORT_KEYS),
                         nullable=True),
        'project_safe':
        fields.FlexibleBooleanField(default=True)
    }

    def obj_make_compatible(self, primitive, target_version):
        super(ActionListRequest,
              self).obj_make_compatible(primitive, target_version)
        target_version = versionutils.convert_version_to_tuple(target_version)
        if target_version < (1, 14):
            if 'cluster_id' in primitive['senlin_object.data']:
                del primitive['senlin_object.data']['cluster_id']
コード例 #7
0
ファイル: actions.py プロジェクト: supreeth90/senlin
class ActionListRequest(base.SenlinObject):
    action_name_list = list(consts.CLUSTER_ACTION_NAMES)
    action_name_list.extend(list(consts.NODE_ACTION_NAMES))

    fields = {
        'name':
        fields.ListOfStringsField(nullable=True),
        'action':
        fields.ListOfEnumField(valid_values=action_name_list, nullable=True),
        'target':
        fields.ListOfStringsField(nullable=True),
        'status':
        fields.ListOfEnumField(valid_values=list(consts.ACTION_STATUSES),
                               nullable=True),
        'limit':
        fields.NonNegativeIntegerField(nullable=True),
        'marker':
        fields.UUIDField(nullable=True),
        'sort':
        fields.SortField(valid_keys=list(consts.ACTION_SORT_KEYS),
                         nullable=True),
        'project_safe':
        fields.FlexibleBooleanField(default=True)
    }
コード例 #8
0
ファイル: cluster_lock.py プロジェクト: zhouqiang-cl/senlin
class ClusterLock(base.SenlinObject, base.VersionedObjectDictCompat):
    """Senlin cluster lock object."""

    fields = {
        'cluster_id': fields.UUIDField(),
        'action_ids': fields.ListOfStringsField(),
        'semaphore': fields.IntegerField(),
    }

    @classmethod
    def acquire(cls, cluster_id, action_id, scope):
        return db_api.cluster_lock_acquire(cluster_id, action_id, scope)

    @classmethod
    def release(cls, cluster_id, action_id, scope):
        return db_api.cluster_lock_release(cluster_id, action_id, scope)

    @classmethod
    def steal(cls, cluster_id, action_id):
        return db_api.cluster_lock_steal(cluster_id, action_id)