Add shelve and unshelve info into devref doc

The diagram on http://docs.openstack.org/developer/nova/devref/vmstates.html
does not currently show the "SHELVED_OFFLOADED" state and the
associated "shelve", "shelveOffload" and "unshelve" state transitions.

Change-Id: I50eb07a84336160b8120ca294598576eeb982d28
Closes-Bug: #1394215
Parse "networks" attribute if loading os-networks

"networks" attribute of "create a server" API should be used when
Neutron/os-network extension is loaded as TODO which is removed with
this patch mentions. V2.1 os-network extension has been implemented
with I94b7b476cbb02725a396725a379417b64afd58a7 already, so this patch
enables "networks" attribute for os-network extension.

Partially implements blueprint v2-on-v3-api

Change-Id: Ibe59ddc53d074f5b8147e24b35066d38d73c7c33
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
Extend clean_shutdown to the compute rpc layer

Adds the clean_shutdown parameter added to stop, resize, rescue,
shelve and shelve_offload in Juno to the compute rpc layer.  This
will in turn allow us to extend the API to provide a
forced-shutdown option to those operations.

Change-Id: Ie24c66e5006e64ef8b45d9d5056cc7876481a2f8
Partially-Implements: blueprint user-defined-shutdown
Add support for clean_shutdown to stop in compute api layer

Change Iec3dfd17725440958aac395ebc471e51afd6522e added
clean_shutdown support to the compute manager in Juno.
This change is part of a set to extend that to the compute
API layer, which will in turn allow us to extend the REST API
to provide a forced-shutdown option to those operations.

Change-Id: I38707cf869705f983ab35e549d95dc4be4811ece
Partially-Implements: blueprint user-defined-shutdown
Add support for clean_shutdown to shelve in compute api layer

Change Iec3dfd17725440958aac395ebc471e51afd6522e added
clean_shutdown support to the compute manager in Juno.
This change is part of a set to extend that to the compute
API layer, which will in turn allow us to extend the REST API
to provide a forced-shutdown option to those operations.

Change-Id: I24dfef04cd0cddbff72267b93e0148b8fb204717
Partially-Implements: blueprint user-defined-shutdown
Add support for clean_shutdown to rescue in compute api layer

Change Iec3dfd17725440958aac395ebc471e51afd6522e added
clean_shutdown support to the compute manager in Juno.
This change is part of a set to extend that to the compute
API layer, which will in turn allow us to extend the REST API
to provide a forced-shutdown option to those operations.

Also adds a couple of missing unit test cases for rescue to the
compute_api tests

Change-Id: I5f00f63742fac89fea65149582f36866146e86f5
Partially-Implements: blueprint user-defined-shutdown
Merge "Parse "networks" attribute if loading os-networks"
Merge "Extend clean_shutdown to the compute rpc layer"
Merge "Add support for clean_shutdown to stop in compute api layer"
Merge "Add support for clean_shutdown to shelve in compute api layer"
Merge "Add support for clean_shutdown to rescue in compute api layer"
Merge "Add shelve and unshelve info into devref doc"
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"