pstorage.py 文件源码

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

项目:kuberdock-platform 作者: cloudlinux 项目源码 文件源码
def _create_drive(self, name, size):
        """
        Actually creates a ceph rbd image of a given size.
        :param name: string -> drive name
        :param size: int -> drive size in GB
        :return: int -> return code of 'run'
        """
        mb_size = 1024 * int(size)
        try:
            self.run_on_first_node(
                'rbd {0} create {1} --size={2} --image-format=2'.format(
                    get_ceph_credentials(), name, mb_size
                )
            )
        except NodeCommandError:
            # FIXME: we use warning for all possible errors. This is wrong,
            # we should check whether retcode == 17 (already exists case) and
            # print correct message with appropriate level
            current_app.logger.warning(
                u"Failed to create CEPH drive '%s', size = %s. "
                u"Possibly it's already exists or other error has happened",
                name, size)
            return 1
        return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号