Is there a way to determine if a ray is coming from a volume?
Okay I am not sure about using some sort of 'Is Volume Ray' value to make a light source only illuminate a volume, but if you simply want a lamp/meshlight to only illuminate a volume scatter material, in the ray visibility settings of that light, you can leave only the 'Volume Scatter' ticked and the rest unticked:



Keep in mind that the light source may still end up illuminating the scene due to multiple volume bounces and the density of the volume.

Here is a simple scene with a point lamp directly above suzanne with a volume scatter material and a maximum of 32 volume bounces. The ray visibility is of the lamp directly above suzanne.



Here is the same scene except with only the 'Volume Scatter' ticked for the point lamp.



Here is the same scene with only 8 volume bounces. You can see how there is more light exiting suzanne with 32 volume bounces than with 8, though it is a very small difference.