<div dir="ltr">Hi Thomas,<br><div class="gmail_extra"><br></div>Are you running multiple cinder scheduler services in different machines? If this is the case then you need to have your new file in each of the nodes and change cinder.conf everywhere.<br><div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks,<br></div><div class="gmail_extra">Xinyuan<br><br></div><div class="gmail_extra"><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Date: Sat, 29 Aug 2015 19:41:43 +0200<br>
From: Thomas Zilio <<a href="mailto:zilio@efficit.com">zilio@efficit.com</a>><br>
To: Erlon Cruz <<a href="mailto:sombrafam@gmail.com">sombrafam@gmail.com</a>><br>
Cc: OpenStack Mailing List <<a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a>><br>
Subject: Re: [Openstack] Cinder, custom filters and weighers.<br>
Message-ID: <<a href="mailto:C703C005-D0A8-4336-9EDF-F8067BDC3E24@efficit.com">C703C005-D0A8-4336-9EDF-F8067BDC3E24@efficit.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hello,<br>
<br>
I did some more testing (on Icehouse and Juno) and the only way I was able to test my filter (or weigher) was by editing an existing filter (capacity_filter.py) and putting the content of my filter into it.<br>
I had to keep the class name (CapacityFilter) otherwise I had an error because the class CapacityFilter was not found (even if the CapacityFilter wasn't used in cinder.cfg).<br>
<br>
So it looks like it only loads its default filters and somehow wants its default filters classes if the file.py is present (removing capacity_filter.py was not a problem).<br>
<br>
Anyone ever managed to use custom Cinder filters ?<br>
And yes, everything is working as intended with Nova filters/weighers.<br>
<br>
Thanks and regards,<br>
Thomas<br>
<br>
> Le 25 ao?t 2015 ? 14:59, Shinobu <<a href="mailto:shinobu.kj@gmail.com">shinobu.kj@gmail.com</a>> a ?crit :<br>
><br>
> Sorry, my reply was to intended to different question.<br>
> Please ignore me -;<br>
><br>
> Shinobu<br>
><br>
> On Tue, Aug 25, 2015 at 9:42 PM, Thomas Zilio <<a href="mailto:zilio@efficit.com">zilio@efficit.com</a> <mailto:<a href="mailto:zilio@efficit.com">zilio@efficit.com</a>>> wrote:<br>
> Hello Erlon,<br>
><br>
> Yes, my class inherits from filters.BaseHostFilter.<br>
> That's what I though for 'scheduler_available_filters' , is this option required for newer release ?<br>
> This option is mentioned here : <a href="http://docs.openstack.org/developer/cinder/devref/filter_scheduler.html" rel="noreferrer" target="_blank">http://docs.openstack.org/developer/cinder/devref/filter_scheduler.html</a> <<a href="http://docs.openstack.org/developer/cinder/devref/filter_scheduler.html" rel="noreferrer" target="_blank">http://docs.openstack.org/developer/cinder/devref/filter_scheduler.html</a>><br>
><br>
> The test filter is:<br>
>> from cinder.openstack.common..scheduler import filters<br>
>> from cinder.openstack.common import log as logging<br>
>><br>
>> LOG = logging.getLogger(__name__)<br>
>><br>
>> class CustomFilter(filters.BaseHostFilter):<br>
>> def host_passes(self, host_state, filter_properties):<br>
>> LOG.warn("Attributes of host_state: " + str(dir(host_state)))<br>
>><br>
>> if host_state.host == "host1.xxx.xxx":<br>
>> LOG.warn("Don't want you: " + host_state.host)<br>
>> return False<br>
>> return True<br>
><br>
><br>
> I'll look into host_manager.py but I'm not sure what more it can give me.<br>
><br>
> Thanks,<br>
> Thomas<br>
><br>
><br>
>> Le 25 ao?t 2015 ? 14:16, Erlon Cruz <<a href="mailto:sombrafam@gmail.com">sombrafam@gmail.com</a> <mailto:<a href="mailto:sombrafam@gmail.com">sombrafam@gmail.com</a>>> a ?crit :<br>
>><br>
>> Hi Thomas,<br>
>><br>
>> Is you class inheriting from 'filters.BaseHostFilter'? Also, there's no such option 'scheduler_available_filters' in openstack/icehouse.<br>
>> A good way to have an insight of your problem is to put logs into 'cinder/scheduler/host_manager.py -> _choose_host_filters'.<br>
>><br>
>> Erlon<br>
>><br>
>> On Tue, Aug 25, 2015 at 9:02 AM, Shinobu <<a href="mailto:shinobu.kj@gmail.com">shinobu.kj@gmail.com</a> <mailto:<a href="mailto:shinobu.kj@gmail.com">shinobu.kj@gmail.com</a>>> wrote:<br>
>> Yes, it's possible using inspectors.<br>
>><br>
>> Shinobu<br>
>><br>
>> On Tue, Aug 25, 2015 at 8:32 PM, Thomas Zilio <<a href="mailto:zilio@efficit.com">zilio@efficit.com</a> <mailto:<a href="mailto:zilio@efficit.com">zilio@efficit.com</a>>> wrote:<br>
>> Hello,<br>
>><br>
>> I'm trying to test some custom cinder filters and weighers but I can't manage to make it work.<br>
>> I did the same for Nova and everything is working but the Cinder scheduler can't seem to find my custom classes.<br>
>><br>
>> My tests are made on a Icehouse installation.<br>
>><br>
>> The error message appearing in the log is the following one:<br>
>> > SchedulerHostFilterNotFound: Scheduler Host Filter CustomFilter could not be found.<br>
>><br>
>> The filter file is in the directory : /usr/lib/python2.6/site-packages/cinder/scheduler/filters<br>
>> And I added these lines to the cinder.conf file (not sure if the first one is required).<br>
>> > scheduler_available_filters=custom_filter.CustomFilter<br>
>> > scheduler_default_filters=AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter,CustomFilter<br>
>><br>
>> My filter file name is custom_filter.py and the class is CustomFilter.<br>
>><br>
>> I don't think it's related to what my filter does since it's not even found by the scheduler.<br>
>> I'm encountering the same issues with the weighers (and everything is working just fine on the Nova scheduler side).<br>
>><br>
>> If anyone has any idea how I could make this work I would be really grateful !<br>
>><br>
>> Thanks and regards,<br>
>> Thomas<br>
>> _______________________________________________<br>
>> Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a> <<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a>><br>
>> Post to : <a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a> <mailto:<a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a>><br>
>> Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a> <<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Email:<br>
>> <a href="mailto:shinobu@linux.com">shinobu@linux.com</a> <mailto:<a href="mailto:shinobu@linux.com">shinobu@linux.com</a>><br>
>> <a href="mailto:skinjo@redhat.com">skinjo@redhat.com</a> <mailto:<a href="mailto:skinjo@redhat.com">skinjo@redhat.com</a>><br>
>><br>
>> ?Life w/ Linux <<a href="http://i-shinobu.hatenablog.com/" rel="noreferrer" target="_blank">http://i-shinobu.hatenablog.com/</a>><br>
>><br>
>> _______________________________________________<br>
>> Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a> <<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a>><br>
>> Post to : <a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a> <mailto:<a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a>><br>
>> Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a> <<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a>><br>
>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a> <<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a>><br>
> Post to : <a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a> <mailto:<a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a>><br>
> Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a> <<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a>><br>
><br>
><br>
><br>
><br>
> --<br>
> Email:<br>
> <a href="mailto:shinobu@linux.com">shinobu@linux.com</a> <mailto:<a href="mailto:shinobu@linux.com">shinobu@linux.com</a>><br>
> <a href="mailto:skinjo@redhat.com">skinjo@redhat.com</a> <mailto:<a href="mailto:skinjo@redhat.com">skinjo@redhat.com</a>><br>
><br>
> ?Life w/ Linux <<a href="http://i-shinobu.hatenablog.com/" rel="noreferrer" target="_blank">http://i-shinobu.hatenablog.com/</a>><br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.openstack.org/pipermail/openstack/attachments/20150829/592b0aa1/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.openstack.org/pipermail/openstack/attachments/20150829/592b0aa1/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Openstack mailing list<br>
<a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a><br>
<br>
<br>
End of Openstack Digest, Vol 26, Issue 29<br>
*****************************************<br>
</blockquote></div><br></div></div></div>