Don't mask out HostState details in WeighedHost

WeighedHost's __repr__ was poking under the HostState hood to use
.host in its own __repr__ but this hides some important details.
Specifically it hides the hypervisor_hostname, which is important for
Ironic as one 'node' can have thousands of hostnames. The other
details such as available RAM and so on are also useful for ops trying
to debug scheduling issues, so rather than add hypervisor_hostname, I
am just delegating to the underlying __repr__.

Change-Id: I79e55c32b3d0768430132275ebe050f38c63bc87
Fix duplicated images in test_block_device_mapping

In test_block_device_mapping, each test can select to specify
image_ref, block_device_mapping or both. The "both" should be
negative tests because nova API gets image_id from either image_ref
or block_device_mapping.
However, there are some "both" tests which are not their purposes.
This patch fixes these tests for their purposes by passing True as
no_image.

These bugs were found through jsonschema validation framework
development, because the schema could detect "both" cases fastly
and these tests could not get their purposes.

Change-Id: I73f1a15d8e08a3eda3190e660338e274358ddd33
Add extensible resources to resource tracker (2)

A resource plugin extension point is added to the resource
tracker to allow the types of resources allocated at the compute
node to be extensible. Information maintained by these plug-ins
is written to the compute_nodes table in the database. The
scheduler uses the information in the compute_nodes table to
determine scheduling decisions.

A plugin that implements vcpu resource tracking is included
and all other code for tracking vcpu has been removed. This
example ensures the plugins are tested in gate jobs.

This was previously merged and reverted due to a bug affecting
ironic CI. The bug was pre-existing but was exposed by the
that patch. This change is based on the bug fix here:
Icb19148660bca542a8120ecab064551d67ac28af and the previous
version of this change is here:
I64108338e3c958ba1276aaf113a68861cbe286f5

Co-Authored-By: Andrea Rosa  <andrea.rosa@hp.com>
Co-Authored-By: Paul Murray  <pmurray@hp.com>
This is part of: blueprint extensible-resource-tracking

Change-Id: If1381f99fd7db420380288faf7b2f57553f69136
Make network/api.py use Network object for associations

This makes the network/api.py module use the Network object for
network host and project associate/disassociate operations. There
was very little testing of this, so this patch adds/corrects tests
to verify object behavior.

Related to blueprint compute-manager-objects-juno

Change-Id: I5c0d61be35fc4edf647e572c746515988651bcc0
Fixes wrong usage of mock.assert_not_called()

There is no method assert_not_called in mock, use
assertFalse(mock.called) instead of that.

Change-Id: I846c37fe79931c85384950f6ad6ecd79d4071fec
Optimize db.floating_ip_deallocate

'select for update' and 'update' operations
were combined into a single 'update' operation

problems with 'select for update' relate to
spec https://review.openstack.org/#/c/97310/1

now 'floating_ip_deallocate' function returns
number of updated rows in db

Partial-Bug: #1343613

Change-Id: I60f5a8f3e1541983dea1589783927107c00c5fa4
makes sure correct PCI device allocation

With this patch, on the compute node, a stats pool will be associated with a
list of devices that belongs to the pool. This makes sure that PCI devices are
allocated out of the same stats pools that are used by the nova scheduler to
satisfy the PCI requests. And therefore, stats pools on the compute nodes will
be kept in sync with their counterparts in the nova scheduler.

Change-Id: I2d97c6354215e2ac5ff659e3203c33771abe1c09
Closes-bug: #1288809
Merge "Fix duplicated images in test_block_device_mapping"
Return 404 when floating IP pool not found

The FloatingIPPoolNotFound exception is raised only by the
Neutron integration API. When that happens, the exception
handling code should ensure a 404 response code is returned
in order to guarantee consistency with nova-network.

Change-Id: Id8ef7ee2c0d85f8b784b8d1d46c7120331f1e01a
Closes-Bug: 1353936
Merge "Make network/api.py use Network object for associations"
Merge "Don't mask out HostState details in WeighedHost"
Merge "Fixes wrong usage of mock.assert_not_called()"
Merge "Optimize db.floating_ip_deallocate"
Merge "Add extensible resources to resource tracker (2)"
Merge "makes sure correct PCI device allocation"
Merge "Return 404 when floating IP pool not found"