'Check whether the volume exists on the array.
If the volume exists on the array, return the LUN ID.
If not exists, raise or log warning.'

def _check_volume_exist_on_array(self, volume, action):

    (lun_id, lun_wwn) = huawei_utils.get_volume_lun_id(self.client, volume)
    if (not lun_id):
        msg = (_('Volume    %s    does    not    exist    on    the    array.') % volume.id)
        if (action == constants.VOLUME_NOT_EXISTS_WARN):
            LOG.warning(msg)
        if (action == constants.VOLUME_NOT_EXISTS_RAISE):
            raise exception.VolumeBackendAPIException(data=msg)
        return
    if (not lun_wwn):
        LOG.debug('No    LUN    WWN    recorded    for    volume    %s.', volume.id)
    if (not self.client.check_lun_exist(lun_id, lun_wwn)):
        msg = (_('Volume    %s    does    not    exist    on    the    array.') % volume.id)
        if (action == constants.VOLUME_NOT_EXISTS_WARN):
            LOG.warning(msg)
        if (action == constants.VOLUME_NOT_EXISTS_RAISE):
            raise exception.VolumeBackendAPIException(data=msg)
        return
    return lun_id
