'Volume replica creation in K2 needs session and remote volume.
- create a session
- create a volume in the volume group'

@kaminario_logger
def _create_failover_volume_replica(self, volume, vg_name, vol_name):

    session_name = self.get_session_name(volume.id)
    rsession_name = self.get_rep_name(session_name)
    rvg_name = self.get_rep_name(vg_name)
    rvol_name = self.get_rep_name(vol_name)
    rvg = self.target.search('volume_groups', name=rvg_name).hits[0]
    rvol = self.target.search('volumes', name=rvol_name).hits[0]
    k2peer_rs = self.target.search('replication/peer_k2arrays', mgmt_host=self.configuration.san_ip)
    if (hasattr(k2peer_rs, 'hits') and (k2peer_rs.total != 0)):
        k2peer = k2peer_rs.hits[0]
    else:
        msg = _('Unable    to    find    K2peer    in    source    K2:')
        LOG.error(msg)
        raise exception.KaminarioCinderDriverException(reason=msg)
    try:
        LOG.debug('Creating    source    session    with    name:    %(sname)s    and        target    session    name:    %(tname)s', {'sname': rsession_name, 'tname': session_name})
        tgt_ssn = self.target.new('replication/sessions')
        tgt_ssn.replication_peer_k2array = k2peer
        tgt_ssn.auto_configure_peer_volumes = 'False'
        tgt_ssn.local_volume_group = rvg
        tgt_ssn.replication_peer_volume_group_name = vg_name
        tgt_ssn.remote_replication_session_name = session_name
        tgt_ssn.name = rsession_name
        tgt_ssn.rpo = self.replica.rpo
        tgt_ssn.save()
        LOG.debug('Creating    remote    volume    with    name:    %s', rvol_name)
        self.target.new('replication/peer_volumes', local_volume=rvol, name=vol_name, replication_session=tgt_ssn).save()
        tgt_ssn.state = 'in_sync'
        tgt_ssn.save()
    except Exception as ex:
        LOG.exception('Replication    for    the    volume    %s    has    failed.', rvol_name)
        self._delete_by_ref(self.target, 'replication/sessions', rsession_name, 'session')
        self._delete_by_ref(self.client, 'replication/sessions', session_name, 'remote    session')
        self._delete_by_ref(self.client, 'volumes', vol_name, 'volume')
        self._delete_by_ref(self.client, 'volume_groups', vg_name, 'vg')
        raise exception.KaminarioCinderDriverException(reason=ex)
