<div dir="ltr">We put this in a filter (/usr/share/pyshared/nova/scheduler/filters/hostname_filter.py)<div><br></div><div style>In our case, we have several different classes of hardware. (gpu, idp, mem) We've created a series of instance types for each chassis type (mem.100, idp.50, etc, with the appropriate resource definitions). Our users mostly use these.</div>
<div style><br></div><div style>I just realized that the basic instance types aren't being filtered from running on special chassis types (mem, and gpu). We haven't hit this so far because we have 50X more IDP nodes than mem or GPU, but we've just been lucky.</div>
<div style><br></div><div style>To fix that, you could remove the blank lines between clauses and bottom out with a case that enforces that the node name is one of your lowmem nodes for the generic instance types.</div><div style>
-nld</div><div><br><div><div>from nova.scheduler import filters</div><div><br></div><div>from nova import log as logging</div><div>from nova import utils</div><div><br></div><div>LOG = logging.getLogger(__name__)</div><div>
<br></div><div>class HostnameFilter(filters.BaseHostFilter):</div><div> """Assign instance type name prefix to specific hostnames"""</div><div><br></div><div> def host_passes(self, host_state, filter_properties):</div>
<div> #LOG.warning("Flavor name %s", filter_properties.get('instance_type')['name'].split('.')[0])</div><div> #LOG.warning("host_state %s", host_state)</div><div> #LOG.warning("host name %s", host_state.host)</div>
<div><br></div><div> if filter_properties.get('instance_type')['name'].split('.')[0] == 'mem':</div><div> if host_state.host.startswith('m',1):</div><div> return True</div>
<div><br></div><div> if filter_properties.get('instance_type')['name'].split('.')[0] == 'idp':</div><div> if host_state.host.startswith('c',1):</div><div> return True</div>
<div><br></div><div> if filter_properties.get('instance_type')['name'].split('.')[0] == 'gpu':</div><div> if host_state.host.startswith('g',1):</div><div> return True</div>
</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 2, 2013 at 4:56 PM, Ahmad Ahmadi <span dir="ltr"><<a href="mailto:ahmadidamha@yahoo.com" target="_blank">ahmadidamha@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif">This is exactly what I'm looking for, but don't know how!<br>
Would you please describe a bit more?<br><br>Thanks<br><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div class="hm HOEnZb"> </div><div style="font-family:times new roman,new york,times,serif;font-size:12pt">
<div class="hm HOEnZb"> <div dir="ltr"> <hr size="1"> <font face="Arial"> <b><span style="font-weight:bold">From:</span></b> Narayan Desai <<a href="mailto:narayan.desai@gmail.com" target="_blank">narayan.desai@gmail.com</a>><br>
<b><span style="font-weight:bold">To:</span></b> Ahmad Ahmadi <<a href="mailto:ahmadidamha@yahoo.com" target="_blank">ahmadidamha@yahoo.com</a>> <br><b><span style="font-weight:bold">Cc:</span></b> "<a href="mailto:openstack-operators@lists.openstack.org" target="_blank">openstack-operators@lists.openstack.org</a>" <<a href="mailto:openstack-operators@lists.openstack.org" target="_blank">openstack-operators@lists.openstack.org</a>> <br>
<b><span style="font-weight:bold">Sent:</span></b> Tuesday, July 2, 2013 3:30 PM<br> <b><span style="font-weight:bold">Subject:</span></b> Re:
[Openstack-operators] Instance Scheduling on Hosts<br> </font> </div></div><div><div class="h5"> <div><br>
<div><div dir="ltr">We accomplished with a scheduler filter that only routes big mem requests to nodes with large memory footprint and doesn't consider these for smaller instance types.<div> -nld</div></div><div>
<br><br><div>On Tue, Jul 2, 2013 at 3:55 PM, Ahmad Ahmadi <span dir="ltr"><<a rel="nofollow" href="mailto:ahmadidamha@yahoo.com" target="_blank">ahmadidamha@yahoo.com</a>></span> wrote:<br><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div>I have two groups of hosts as compute nodes:</div><div><br>BigGroup: a few machines with very big RAM</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:times new roman,new york,times,serif">
<span>SmallGroup: a lot of machines with smaller RAM each.</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:times new roman,new york,times,serif"><br><span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:times new roman,new york,times,serif">
<span>My goal is to assigne bigger instances (from bigger flavors) to BigGroup and </span><span>smaller instances to SmallGroup.</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:times new roman,new york,times,serif">
<span>I tried the "AggregateInstanceExtraSpecsFilter" filtering with assigning different keys to instances and making aggregated hosts (<a href="http://docs.openstack.org/folsom/openstack-compute/admin/content/host-aggregates.html" target="_blank">http://docs.openstack.org/folsom/openstack-compute/admin/content/host-aggregates.html</a>), but didn't work and all the instance boots will end up to error.</span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:times new roman,new york,times,serif">Any idea?</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:times new roman,new york,times,serif">
<br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:times new roman,new york,times,serif">More over does anyone know how can I assign higher cost to
bigger nodes for weighting?</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:times new roman,new york,times,serif"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:times new roman,new york,times,serif">
Thanks,<br><span></span></div></div></div><br>_______________________________________________<br>
OpenStack-operators mailing list<br>
<a rel="nofollow" href="mailto:OpenStack-operators@lists.openstack.org" target="_blank">OpenStack-operators@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators</a><br>
<br></blockquote></div><br></div>
</div><br><br></div> </div></div></div> </div> </div></div></blockquote></div><br></div>