class FilterScheduler(driver.Scheduler):
"""Scheduler that can be used for filtering and weighing."""
#...
def schedule_create_volume(self, context, request_spec, filter_properties):
backend = self._schedule(context, request_spec, filter_properties)
<span style="color: rgb(0, 128, 0); font-weight: bold; ">if</span> <span style="color: rgb(170, 34, 255); font-weight: bold; ">not</span> backend:
<span style="color: rgb(0, 128, 0); font-weight: bold; ">raise</span> exception<span style="color: rgb(102, 102, 102); ">.</span>NoValidBackend(reason<span style="color: rgb(102, 102, 102); ">=</span>_(<span style="color: rgb(186, 33, 33); ">"No weighed backends "</span>
<span style="color: rgb(186, 33, 33); ">"available"</span>))
backend <span style="color: rgb(102, 102, 102); ">=</span> backend<span style="color: rgb(102, 102, 102); ">.</span>obj
volume_id <span style="color: rgb(102, 102, 102); ">=</span> request_spec[<span style="color: rgb(186, 33, 33); ">'volume_id'</span>]
updated_volume <span style="color: rgb(102, 102, 102); ">=</span> driver<span style="color: rgb(102, 102, 102); ">.</span>volume_update_db(context, volume_id,
backend<span style="color: rgb(102, 102, 102); ">.</span>host,
backend<span style="color: rgb(102, 102, 102); ">.</span>cluster_name)
<span style="color: rgb(0, 128, 0); ">self</span><span style="color: rgb(102, 102, 102); ">.</span>_post_select_populate_filter_properties(filter_properties,
backend)
<span style="color: rgb(64, 128, 128); font-style: italic; "># context is not serializable</span>
filter_properties<span style="color: rgb(102, 102, 102); ">.</span>pop(<span style="color: rgb(186, 33, 33); ">'context'</span>, <span style="color: rgb(0, 128, 0); ">None</span>)
<span style="color: rgb(0, 128, 0); ">self</span><span style="color: rgb(102, 102, 102); ">.</span><font color="#0000ff"><b>volume_rpcapi.create_volume</b></font>(context, updated_volume, request_spec,
filter_properties,
allow_reschedule<span style="color: rgb(102, 102, 102); ">=</span><span style="color: rgb(0, 128, 0); ">True</span>)
<span style="color: rgb(64, 128, 128); font-style: italic; ">#...</span></pre></div></td></tr></tbody></table><table class="highlighttable"><tbody><tr><td><div class="linenodiv" style="background-color: rgb(240, 240, 240); padding-right: 10px; "><pre style="line-height: 16px; ">1
2
3
4
5