Refactor unit tests for scheduler weights

Remove external depenencies from scheduler weight tests in an attempt
to make the tests cleaner and to only test the weight code itself.

FakeHostState() is used to avoid having to go through host manager and
then mock it's db calls. Additionally, weigher classes are referenced
directly instead of having the weight handler load them first.

Related to blueprint scheduler-optimization

Change-Id: Ifd3577aec6c5fc82e4864623e0545f380fb75b6e
Make scheduler filters/weighers only load once

Right now, filters/weighers are instantiated on every invocation of the
scheduler. This is both time consuming and unnecessary. In cases where
a filter/weigher tries to be smart and store/cache something in between
invocations this actually prohibits that.

This change make base filter/weigher functions take objects instead of
classes and then let schedulers create objects only once and then reuse
them.

This fixes a known bug in trusted_filter that tries to cache things.

Related to blueprint scheduler-optimization

Change-Id: I3174ab7968b51c43c0711033bac5d4bc30938b95
Closes-Bug: #1223450
libvirt: un-cruft _get_guest_numa_config

Several issues get cleaned up with this patch - all of which will make
adding CPU pinning into the mix a lot cleaner.

1) Unecessary context argument to the method is dropped.

2) Secondly - we pass in the InstanceNUMATopology object (or None)
instead of passing in the whole instance and then getting the topology
out - this is useful as we will need instance NUMA for generating topology
as well, and this avoids repetitive code in a lot of places.

3) Add missing tests for updated method the method
get_cpu_numa_config_from_instance

Change-Id: I829465d1612f42e7af92927584b31ca6a2349d5a
libvirt: Fix NUMA memnode assignments to host cells

This fix

  https://review.openstack.org/138128

breaks assignments for NUMA topologies where host cell ID
that the instance cell is pinned to is not in increasing order. The
reason for this is that the main loop of the method that will go through
the host cells (always in ascending order), and find instance cells that
match (may not be in ascending order depending on how the fitting logic
and usage of the host) but we simply append memnodes so they may end up
in the wrong order when we hit the normalization loop.

We fix this by "pre-allocating" the memnodes list and making sure to add
the matching memnode to the same position as the guest config cell
before hitting the normalization loop.

Change-Id: I91055dc705f2ef54c830e641f9cf9ba0683eb313
Closes-bug: #1397381
Merge "Refactor unit tests for scheduler weights"
Merge "Make scheduler filters/weighers only load once"
Merge "libvirt: un-cruft _get_guest_numa_config"
Merge "libvirt: Fix NUMA memnode assignments to host cells"