def _create_volume(self, snapshot_id, size, availability_zone, name, timeout):
        """Creates a volume according to specifications and blocks until done (or times out)"""

        self.log.debug("Creating volume with attributes: snapshot_id=%s size=%s availability_zone=%s name=%s timeout=%s", snapshot_id, size, availability_zone, name, timeout)

        if snapshot_id and not snapshot_id.startswith('snap-'):
            sid = self._find_snapshot(snapshot_id)
            if not sid and self.resource.snapshot_required:
                raise Fail("Unable to find snapshot with name %s" % snapshot_id)
            snapshot_id = sid

        availability_zone = availability_zone or self.resource.env.config.aws.availability_zone
        vol = self.ec2.create_volume(size, availability_zone, snapshot_id)
        self.log.info("Created new volume %s %s%s", name, vol.id, " based on %s" % snapshot_id if snapshot_id else "")

        start_time = time.time()
        end_time = start_time + timeout if timeout else 0

        while (not timeout) or (time.time() < end_time):
            if vol.update() in ('in-use', 'available'):
                break
            time.sleep(1)

        if name:
            vol.add_tag('Name', name)

        try:
            del self.resource.env.config.aws.resources._volumes
        except AttributeError:
            pass

        return vol
dataset/ETHPy150Open samuel/kokki/kokki/cookbooks/aws/libraries/providers.py/EBSVolumeProvider._create_volume/original