<div dir="ltr">Still on PTO for one day, but I'll try to answer. Sorry for the delay, was out traveling.<div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-08-21 23:09 GMT+02:00 Matt Riedemann <span dir="ltr"><<a href="mailto:mriedemos@gmail.com" target="_blank">mriedemos@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I don't dabble in the RequestSpec code much, but in trying to fix bug 1712008 [1] I'm venturing in there and have some questions. This is mostly an email to Sylvain for when he gets back from vacation but I wanted to dump it before moving forward.<br>
<br></blockquote><div><br></div><div>Heh :-)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Mainly, what is the difference between RequestSpec.force_hosts/force_<wbr>nodes and RequestSpec.requested_destinat<wbr>ion?<br>
<br></blockquote><div><br></div><div>force_[hosts/nodes] was a former key in the legacy filter_properties dictionary that was passed to the scheduler. When I designed the RequestSpec object, I just provided the same names for the fields that were related to those keys.</div><div>requested_destination is a new field that wasn't previously in the legacy dictionaries but was just added when I wrote in Newton a new feature about verifying a target when moving.</div><div><br></div><div>There is a main behavioural difference between those two RequestSpec fields, that is because the behaviours are different between a boot request and a move operation.</div><div>When you boot an instance, you can pass (weirdly and terribly from an API point) a target for that instance by using the availability_zone flag. Some request  like nova boot inst1 --availability_zone nova:foo:bar will actually call the scheduler to just verify if host "foo" (and node "bar") is alive *without* verifying filters.</div><div>When you move that instance by passing a target (something like "nova live-migrate inst1 foo2") will rather call the scheduler to verify only that host (and not the others) *by running filters*.</div><div><br></div><div>TBC, if you 'force' a boot, it won't be a real forced boot because it will still call the scheduler but it will dumbly accept the proposed destination.</div><div>If you want to *propose* a destination for a move, it will ask the scheduler to *really* verify that destination (or end up the migration if not possible). You can still want to *force* a move, but in that case, it just bypasses the scheduler.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When should one be used over the other? I take it that requested_destination is the newest and coolest thing and we should always use that first, and that's what the nova-api code is using, but I also see the scheduler code checking force_hosts/force_nodes.<br>
<br></blockquote><div><br></div><div>MHO is that force_hosts is just a technical hack based on an unclear API contract about guarantting a boot request to succeed against a specific target. I'd rather propose a new API contract for providing a destination exactly based on the same semantics that the ones we have for move operations, ie. :</div><div>- if a destination is proposed, run scheduler filters only against that destination and error out the boot request if the host can't sustain the request.</div><div>- if a destination is proposed and a 'force' flag is used, then just pass the RPC request to the target compute service and magically expect everything will work. </div><div><br></div><div>That said, there is a corner case now we have allocations made by the scheduler. If we go straight to the compute service, we won't create the allocation if a force operation is made. In that case, something (that has to be discussed in the spec mentioning the API change) has to reconcile allocations for the compute service. Maybe it's just a technical detail, but that has to be written in the spec tho.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is that all legacy compatibility code? And if so, then why don't we handle requested_destination in RequestSpec routines like reset_forced_destinations() and to_legacy_filter_properties_di<wbr>ct(), i.e. for the latter, if it's a new style RequestSpec with requested_destination set, but we have to backport and call to_legacy_filter_properties_di<wbr>ct(), shouldn't requested_destination be used to set force_hosts/force_nodes on the old style filter properties?<br>
<br>
Since RequestSpec.requested_destinat<wbr>ion is the thing that restricts a move operation to a single cell, it seems pretty important to always be using that field when forcing where an instance is moving to. But I'm confused about whether or not both requested_destination *and* force_hosts/force_nodes should be set since the compat code doesn't seem to transform the former into the latter.<br>
<br></blockquote><div><br></div><div>I agree, that sounds important to me to have consistent behaviours between all nova operations that require a placement decision. I have that in my pipe for a very long time (I mean, writing the spec for modifying the API contract on instance creation) so I push it a bit more.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If this is all transitional code, we should really document the hell out of this in the RequestSpec class itself for anyone trying to write new client side code with it, like me.<br>
<br></blockquote><div><br></div><div>That sounds a very good short win to me.</div><div><br></div><div>-Sylvain</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
[1] <a href="https://bugs.launchpad.net/nova/+bug/1712008" rel="noreferrer" target="_blank">https://bugs.launchpad.net/nov<wbr>a/+bug/1712008</a><span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
<br>
Thanks,<br>
<br>
Matt<br>
<br>
______________________________<wbr>______________________________<wbr>______________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.op<wbr>enstack.org?subject:unsubscrib<wbr>e</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi<wbr>-bin/mailman/listinfo/openstac<wbr>k-dev</a><br>
</font></span></blockquote></div><br></div></div>