@classmethod
def create_volume(cls, image_ref=None, **kwargs):
    "Create a volume and wait for it to become 'available'.\n\n        :param image_ref: Specify an image id to create a bootable volume.\n        :param kwargs: other parameters to create volume.\n        :returns: The available volume.\n        "
    if ('size' not in kwargs):
        kwargs['size'] = CONF.volume.volume_size
    if ('display_name' not in kwargs):
        vol_name = data_utils.rand_name((cls.__name__ + '-volume'))
        kwargs['display_name'] = vol_name
    if (image_ref is not None):
        kwargs['imageRef'] = image_ref
    if CONF.compute.compute_volume_common_az:
        kwargs.setdefault('availability_zone', CONF.compute.compute_volume_common_az)
    volume = cls.volumes_client.create_volume(**kwargs)['volume']
    cls.addClassResourceCleanup(cls.volumes_client.wait_for_resource_deletion, volume['id'])
    cls.addClassResourceCleanup(test_utils.call_and_ignore_notfound_exc, cls.volumes_client.delete_volume, volume['id'])
    waiters.wait_for_volume_resource_status(cls.volumes_client, volume['id'], 'available')
    return volume
Create a volume and wait for it to become 'available'.

:param image_ref: Specify an image id to create a bootable volume.
:param kwargs: other parameters to create volume.
:returns: The available volume.
@classmethod
def create_volume(cls, image_ref=None, **kwargs):
    "Create a volume and wait for it to become 'available'.\n\n        :param image_ref: Specify an image id to create a bootable volume.\n        :param kwargs: other parameters to create volume.\n        :returns: The available volume.\n        "
    if ('size' not in kwargs):
        kwargs['size'] = CONF.volume.volume_size
    if ('display_name' not in kwargs):
        vol_name = data_utils.rand_name((cls.__name__ + '-volume'))
        kwargs['display_name'] = vol_name
    if (image_ref is not None):
        kwargs['imageRef'] = image_ref
    if CONF.compute.compute_volume_common_az:
        kwargs.setdefault('availability_zone', CONF.compute.compute_volume_common_az)
    volume = cls.volumes_client.create_volume(**kwargs)['volume']
    cls.addClassResourceCleanup(cls.volumes_client.wait_for_resource_deletion, volume['id'])
    cls.addClassResourceCleanup(test_utils.call_and_ignore_notfound_exc, cls.volumes_client.delete_volume, volume['id'])
    waiters.wait_for_volume_resource_status(cls.volumes_client, volume['id'], 'available')
    return volume