'Ensure that an existing_ref is valid and return volume info
If the ref is not valid throw a ManageExistingInvalidReference
exception with an appropriate error.
Will return volume or snapshot information from the array for
the object specified by existing_ref.'

def _validate_manage_existing_ref(self, existing_ref, is_snap=False):

    if (('name' not in existing_ref) or (not existing_ref['name'])):
        raise exception.ManageExistingInvalidReference(existing_ref=existing_ref, reason=_("manage_existing    requires    a    'name'    key    to    identify    an    existing    volume."))
    if is_snap:
        (ref_vol_name, ref_snap_suffix) = existing_ref['name'].split('.')
    else:
        ref_vol_name = existing_ref['name']
    current_array = self._get_current_array()
    try:
        volume_info = current_array.get_volume(ref_vol_name, snap=is_snap)
        if volume_info:
            if is_snap:
                for snap in volume_info:
                    if (snap['name'] == existing_ref['name']):
                        return snap
            else:
                return volume_info
    except purestorage.PureHTTPError as err:
        with excutils.save_and_reraise_exception() as ctxt:
            if ((err.code == 400) and (ERR_MSG_NOT_EXIST in err.text)):
                ctxt.reraise = False
    raise exception.ManageExistingInvalidReference(existing_ref=existing_ref, reason=(_('Unable    to    find    Purity    ref    with    name=%s') % ref_vol_name))
