Fix init of pci_stats in resource tracker

Because pci_stats is list of dict, i.e., [{}, {}, ...],
if pci_stats is null, its field should be '[]' not '{}'.

When making object models, we found this bug in PCI stuffs.

Related to blueprint pci-extra-info.

Change-Id: I06564cb541b050060e87fd3d334299df66f23dec
Destroy docker container if spawn fails to set up network

If docker driver failed to set up network when spawn an instance,
then the docker driver should also destroy the container to make
sure no garbage container left for such case.

Change-Id: I4496182d9f6a9bfd86b0a32edb19dcd975467e91
Closes-Bug: #1242815
Fix scheduler_hints parameter of v3 API

"create a server" API contains a scheduler_hints parameter which is
a hint where a server should boot.
According to scheduler-hints-post-req.json API sample, the parameter
name is "os-scheduler-hints:scheduler_hints":
  {
    "server" : {
      "name" : "new-server-test",
      "image_ref" : "..",
      "flavor_ref" : "..",
      "os-scheduler-hints:scheduler_hints": {
        "hypervisor": "xen",
        "near": "48e6a9f6-30af-47e0-bc04-acaed113bb4e"
      }
    }
  }

However create() of SchedulerHintsController tries to get its value
from invalid position where is the same level as "server":
  {
    "server" : {
      [..]
    },
    "os-scheduler-hints:scheduler_hints": {
      "hypervisor": "xen",
      "near": "48e6a9f6-30af-47e0-bc04-acaed113bb4e"
    }
  }

As the result, Nova cannot get the value from the right parameter.
To fix the problem, this patch merges both the parameter parser and
the validation code to server_create() like the other API extensions.
SchedulerHintsController becomes unnecessary, then this patch removes
the class.

Partially implements bp v3-api-inconsistencies

Change-Id: I4e0bcbde8e2d2171d0b2e18b72d2c2b3d88d7239
Fixed naming issue of variable in a debug statement formatting

Closes-bug: 1275802

Change-Id: I5bf57290ff3023f6d3332a92114cc4f235e1f4af
Hyper-V: Change variable in debug log message

The variable used in the log message is incorrect. The log message
outputs the file size instead of the internal VHD size.

Closes-bug #1275805

Change-Id: I270709098e058cf51bbe6494b903a461b3938d15
VMware: update the default 'task_poll_interval' time

The original means that each operation against the backend takes at
least 5 seconds. The default is updated to 0.5 seconds.

DocImpact
    Updated default value for task_poll_interval from 5 seconds to
    0.5 seconds

Change-Id: I867b913f52b67fa9d655f58a2e316b8fd1624426
Closes-bug: #1274439
Update my mailmap

Using new email address.

Change-Id: Id8ead6a5e125c8daaf9d7550ae40e10c7caa2618
XenAPI: Monitor the GC when coalescing

Add a new host plugin to monitor whether the garbage collector is running.
This is then used by the wait_for_vhd_coalesce function to know whether
waiting any more is likely to produce the expected results.

Increased the number of times we loop waiting for coalesce as the loop
now has knowledge that something is still happening.

DocImpact
Change to parameter default.

Change-Id: Idcc0738945bd1aee8cdb52c9cfabd798f85c31db
Closes-bug: 1258169
Don't try to restore VM's in state ERROR.

We don't try to restore VM's that are in a failed BUILDING state, so
attempting to start ERROR VMs is more than a little weird. The one
exception to this rule are VMs that are in RESIZE_MIGRATING, since
recovery is already attempted. It's also a problem, because many ERROR
states aren't recoverable from (at the moment anyhow).

Closes-Bug: #1272623
Change-Id: I0599b83a82ad3ee67a92126d3b57df5b02e20539
Co-Authored-By: Robert Collins <rbtcollins@hp.com>
Fix typos in hacking check warning numbers

The typo in warning numbers was pointed out in review after
the original patch had already merged

Change-Id: I9a4fe8c4c4d4ca8b6dbe20d9db4f2e84dca6c67e
nova: use RequestContextSerializer for notifications

RequestContext should be serialized when sent via oslo.messaging. The
serializer is correctly used for the general RPC mechanism, but has been
forgotten in the notifier. This patch fixes that.

Change-Id: I56fa8022e34c0e80835e3bde940fda99ed0f9ba8
Closes-Bug: #1275771
Nova Docker: Metadata service doesn't work

The metadata services rejects the request because the remote IP address
belongs to the docker network. The remote IP address is correct by using
the nova network as default route.

Change-Id: I410a9bfea560f669515b31db7f007515b4d5c4e7
Closes-Bug: #1259267
Closes-Bug: #1261021
Sync latest db.sqlalchemy from oslo-incubator

The solution to bug 1272500 (Unit tests failing with sqllite 3.8.2-1)
is to use a newer version of db.sqlalchemy from oslo-incubator.
This sync introduces a few incompatible changes that also had to
be fixed for the unit tests to pass:

-_extra_keys in Models must be a property
-Additional utcnow calls were added, which broke some unit tests
that were incorrectly mocking timeutils.utcnow.  timeutils
provides an override method that allows fake times to be returned
in unit tests.

Change-Id: I99685c8a1086fa4e1354f1fa0a715d88d0468dc6
Closes-Bug: #1272500
Co-Authored-By: Ben Nemec <bnemec@redhat.com>
Default video type to 'vga' for PowerKVM

PowerKVM currently doesn't support 'cirrus' video type. For now, we can
detect if Nova compute is running on ppc64 or ppc architecture systems
and set the default to 'vga', which is supported on PowerKVM.

This patch did some reordering of the logic in
nova.virt.libvirt.driver.LibvirtDriver.get_guest_config in an attempt to
set the video.type depending on the compute host architecture and
implementation specifics. The video.type can still be set using
image_meta.

Change-Id: I49a1a8e6d9ebdc28d876d2f958c8cb960892f322
Closes-Bug: 1274367
Merge "Update my mailmap"
The object_compat decorator should come first.

Related to blueprint icehouse-objects.
Related to blueprint compute-manager-objects.

Change-Id: Ia5cc55aca5517359523ae71f4110b5f02a830b4d
Convert set_admin_password to objects

Related to blueprint icehouse-objects.
Related to blueprint compute-manager-objects.

Change-Id: Ibb8087579f290843dad4aa210e9e8fb2210c5058
Convert rescue_instance to objects

Related to blueprint icehouse-objects.
Related to blueprint compute-manager-objects.

Change-Id: I6448cb929e9afce814d0580eada91b8fd37befa3
Merge "Fix init of pci_stats in resource tracker"
Merge "Fix typos in hacking check warning numbers"