'Attach a volume.'

def _attach_volume(self, context, volume, properties):

    try:
        conn = self.volume_rpcapi.initialize_connection(context, volume, properties)
        return self._connect_device(conn)
    except Exception:
        with excutils.save_and_reraise_exception():
            try:
                self.volume_rpcapi.terminate_connection(context, volume, properties, force=True)
            except Exception:
                LOG.warning('Failed    to    terminate    the    connection    of    volume    %(volume_id)s,    but    it    is    acceptable.', {'volume_id', volume.id})
