coprhd_blockdevice.py 文件源码

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

项目:flocker-driver 作者: CoprHD 项目源码 文件源码
def create_volume_with_profile(self,dataset_id, size, profile_name):
        """
        Create a volume of specified size and profile on the COPRHD.
        The size shall be rounded off to 1GB, as COPRHD
        volumes of these sizes.

        profile can either 'PLATINUM' or 'GOLD' or 'SILVER' or 'BRONZE'

        See `IProfiledBlockDeviceAPI.create_volume_with_profile` for parameter and return type
        documentation.
        """

        Message.new(Info="coprhd create_volume size is " + str(size)).write(_logger)
        Message.new(Info="coprhd create_volume profile is " + str(profile_name)).write(_logger)

        volumesdetails = self.coprhdcli.get_volume_details("flocker-{}".format(dataset_id))
        if not volumesdetails:
           self.coprhdcli.create_volume("flocker-{}".format(dataset_id),size,profile_name=profile_name)
           Message.new(Debug="coprhd create_volume_with_profile done").write(_logger)
        return BlockDeviceVolume(size=size, attached_to=None, dataset_id=dataset_id, blockdevice_id=u"block-{0}".format(dataset_id))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号