'Creates a database entry for the given inputs and returns details.
Accesses the database and creates a new entry for the to be created
volume using the given volume properties which are extracted from the
input kwargs (and associated requirements this task needs). These
requirements should be previously satisfied and validated by a
pre-cursor task.'

def execute(self, context, optional_args, **kwargs):

    src_volid = kwargs.get('source_volid')
    src_vol = None
    if (src_volid is not None):
        src_vol = objects.Volume.get_by_id(context, src_volid)
    bootable = False
    if (src_vol is not None):
        bootable = src_vol.bootable
    volume_properties = {'size': kwargs.pop('size'), 'user_id': context.user_id, 'project_id': context.project_id, 'status': 'creating', 'attach_status': fields.VolumeAttachStatus.DETACHED, 'encryption_key_id': kwargs.pop('encryption_key_id'), 'display_description': kwargs.pop('description'), 'display_name': kwargs.pop('name'), 'multiattach': kwargs.pop('multiattach'), 'bootable': bootable}
    volume_properties.update(kwargs)
    volume = objects.Volume(context=context, **volume_properties)
    volume.create()
    volume_properties = objects.VolumeProperties(**volume_properties)
    return {'volume_id': volume['id'], 'volume_properties': volume_properties, 'volume': volume}
