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))
评论列表
文章目录