'Create an attachment object.'

def _create_attachment(self, ctxt=None, volume_uuid=None, instance_uuid=None, mountpoint=None, attach_time=None, detach_time=None, attach_status=None, attach_mode=None):

    ctxt = (ctxt or self.ctxt)
    attachment = objects.VolumeAttachment(ctxt)
    attachment.volume_id = volume_uuid
    attachment.instance_uuid = instance_uuid
    attachment.mountpoint = mountpoint
    attachment.attach_time = attach_time
    attachment.detach_time = detach_time
    attachment.attach_status = (attach_status or 'reserved')
    attachment.attach_mode = attach_mode
    attachment.create()
    return attachment
