def create_volume_with_profile(self, dataset_id, size, profile_name):
        requested_size = int(Byte(size).to_GiB().value)
        try:
            volume_type, iops = _volume_type_and_iops_for_profile_name(
                profile_name, requested_size)
            requested_volume = self._create_ebs_volume(
                size=requested_size,
                zone=self.zone,
                volume_type=volume_type,
                iops=iops)
        except ClientError as e:
            # If we failed to create a volume with attributes complying
            # with requested profile, make a second attempt at volume
            # creation with default profile.
            # Compliance violation of the volume's requested profile
            # will be detected and remediated in a future release (FLOC-3275).
            if e.response['Error']['Code'] != INVALID_PARAMETER_VALUE:
                raise e
            CREATE_VOLUME_FAILURE(
                dataset_id=unicode(dataset_id),
                aws_code=e.response['Error']['Code'],
                aws_message=unicode(e.response['Error']['Message'])
            ).write()
            volume_type, iops = _volume_type_and_iops_for_profile_name(
                MandatoryProfiles.DEFAULT.value, requested_size)
            requested_volume = self._create_ebs_volume(
                size=requested_size,
                zone=self.zone,
                volume_type=volume_type,
                iops=iops)

        message_type = BOTO_LOG_RESULT + u':created_volume'
        Message.new(
            message_type=message_type, volume_id=unicode(requested_volume.id),
            dataset_id=unicode(dataset_id), size=unicode(size)
        ).write()

        # Stamp created volume with Flocker-specific tags.
        metadata = {
            METADATA_VERSION_LABEL: '1',
            CLUSTER_ID_LABEL: unicode(self.cluster_id),
            DATASET_ID_LABEL: unicode(dataset_id),
            # EC2 convention for naming objects, e.g. as used in EC2 web
            # console (http://stackoverflow.com/a/12798180).
            "Name": u"flocker-{}".format(dataset_id),
        }
        tags_list = []
        for key, value in metadata.items():
            tags_list.append(dict(Key=key, Value=value))
        requested_volume.create_tags(Tags=tags_list)

        message_type = BOTO_LOG_RESULT + u':created_tags'
        Message.new(
            message_type=message_type,
            requested_volume=requested_volume.id,
            tags=metadata
        ).write()

        # Wait for created volume to reach 'available' state.
        _wait_for_volume_state_change(VolumeOperations.CREATE,
                                      requested_volume)

        # Return created volume in BlockDeviceVolume format.
        return _blockdevicevolume_from_ebs_volume(requested_volume)
Create a volume on EBS. Store Flocker-specific
dataset/ETHPy150Open ClusterHQ/flocker/flocker/node/agents/ebs.py/EBSBlockDeviceAPI.create_volume_with_profile