cinder filter_function takes string arguments?

asked 2019-06-10 10:09:34 -0500

balaramesh gravatar image

Has anyone tried to use the cinder filter_function to use string arguments? I am not able to get it to work if I am using a string for comparison.

filter_function = "stats.pool_name =="

The error I observe when attempting to create a Cinder volume that maps to the backend where the filter_function is defined is below:

2019-06-10 14:26:44.285 23772 WARNING cinder.scheduler.filters.driver_filter [req-43dd8725-af3c-448a-b207-03a1e77e854a 5fb8caadb3794155bf358dc0a678b80c c9a753e77bdd4bd0af2708f6a522745b - - -] Error in filtering function 'stats.pool_name ==' : 'ParseException: Expected end of text (at char 26), (line:1, col:27)' :: failing host

Looks like a pyparsing error.

edit retag flag offensive close merge delete


If you look at the column information (col 27), the problem starts at the second dot in the IP address. Pyparsing seems to think that 192.168 is a decimal number, and the second dot is obviously an error in this case.

My guess is that you have to put quotes around the pool name.

Bernd Bausch gravatar imageBernd Bausch ( 2019-06-10 23:25:57 -0500 )edit

Hi @Bernd-Bausch, I tried it after updating the filter_function as follows: filter_function = "stats.pool_name == ''" The ParseException now thrown is at char 16 (for the first space between 'e' and '==')

balaramesh gravatar imagebalaramesh ( 2019-06-12 12:03:29 -0500 )edit

It does not change even if the filter_function is defined as "stats.pool_name== ''". The ParseException is thrown at char 15

balaramesh gravatar imagebalaramesh ( 2019-06-12 12:04:33 -0500 )edit