'Wait for the completion of copy.'

def _wait_for_copy_complete(self, cpsession):

    LOG.debug('_wait_for_copy_complete,    cpsession:    %s.', cpsession)
    cpsession_instance = None
    while True:
        try:
            cpsession_instance = self.conn.GetInstance(cpsession, LocalOnly=False)
        except Exception:
            cpsession_instance = None
        if (cpsession_instance is None):
            break
        LOG.debug('_wait_for_copy_complete,    find    target    copysession,    wait    for    end    of    copysession.')
        if (cpsession_instance['CopyState'] == BROKEN):
            msg = (_('_wait_for_copy_complete,    cpsession:    %(cpsession)s,    copysession    state    is    BROKEN.') % {'cpsession': cpsession})
            LOG.error(msg)
            raise exception.VolumeBackendAPIException(data=msg)
        time.sleep(10)
