flavor.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:Trusted-Platform-Module-nova 作者: BU-NU-CLOUD-SP16 项目源码 文件源码
def get_all(cls, context, inactive=False, filters=None,
                sort_key='flavorid', sort_dir='asc', limit=None, marker=None):
        try:
            api_db_flavors = _flavor_get_all_from_db(context,
                                                     inactive=inactive,
                                                     filters=filters,
                                                     sort_key=sort_key,
                                                     sort_dir=sort_dir,
                                                     limit=limit,
                                                     marker=marker)
            # NOTE(danms): If we were asked for a marker and found it in
            # results from the API DB, we must continue our pagination with
            # just the limit (if any) to the main DB.
            marker = None
        except exception.MarkerNotFound:
            api_db_flavors = []

        if limit is not None:
            limit_more = limit - len(api_db_flavors)
        else:
            limit_more = None

        if limit_more is None or limit_more > 0:
            db_flavors = db.flavor_get_all(context, inactive=inactive,
                                           filters=filters, sort_key=sort_key,
                                           sort_dir=sort_dir, limit=limit_more,
                                           marker=marker)
        else:
            db_flavors = []
        return base.obj_make_list(context, cls(context), objects.Flavor,
                                  api_db_flavors + db_flavors,
                                  expected_attrs=['extra_specs'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号