Delete instance faults when deleting instance

Instance delete should also delete related record from the
instance_faults table.

Change-Id: I9c845bce6cf39003858a1b2a726734db9fb9e584
Closes-bug: #1237155
Remove redundant body validation for createBackup

The body validation is redundant for createBackup, should remove it. In
fact that this extension is registered as WSGI action implies that the
body must contain a key with the same name as action.

Change-Id: I327688b2df50782bc38b97a4750f83a607623ce4
Closes-Bug: #1254988
Add boolean convertors for migrate_live API

migrate_live API contains "block_migration" and "disk_over_commit" as
the parameters. They should be boolean.
There are the other boolean parameters such as "on_shared_storage" of
evacuate API, they can be passed with either boolean or string(e.g. "True").
For API consistency, this patch adds boolean convertors to migrate_live
API.

Change-Id: Ic3040811977c834bfd4b0b4527795382e11227ed
Closes-Bug: #1257661
Return client tokens in EC2 DescribeInstances

EC2 instances can be instantiated with a client token, a per-instance
unique token that enforces idempotency for RunInstance calls.
If a client token exists, DescribeInstances will return it wrapped
in <clientToken></clientToken>.

Change-Id: I1deb2c0666d0274ed3c181ecb0e0dc65112605ec
Closes-Bug: #1260853
Cleanup object usage in the delete path

This patch cleans up some dict-like usage of instances in the compute
api path, as well as removes a redundant direct call to fetch the
instance's system_metadata.

Related to blueprint icehouse-objects

Change-Id: I1cf89f0a46280b53d7d929ca61dde1cb3ea3cace
Add wsgiref to requirements.txt

Baremetal deploy helper (nova/cmd/baremetal_deploy_helper.py) uses
wsgiref module, so it should be in requirements.

Closes-bug: #1263480
Change-Id: Ibdd917d8065c085411a21a65e2d9ae016e265ee5
VMware: clean up unnecessary help message of options

Configuration options were grouped into [vmware]. So we don't need
point out that these options are used only for vmwareapi.VMwareESXDriver
or vmwareapi.VMwareVCDriver. This patch also corrects docstring for
vCenter related classes.

Change-Id: I77d95250ce1351bad60664ec7313d8e18d76332a
libvirt: Set "Disabled Reason" to None when enable nova compute

When use "nova host-update" to enable nova compute, the column of
"Disabled Reason" will be set as empty, this will make the
"Disabled Reason" is not consistent with other services.

+------------------+------+----------+---------+-----------------+
| Binary           | Host |   Zone   |   ...   | Disabled Reason |
+------------------+------+----------+---------+-----------------+
| nova-conductor   | jay1 | internal |   ...   | None            |
| nova-cert        | jay1 | internal |   ...   | None            |
| nova-scheduler   | jay1 | internal |   ...   | None            |
| nova-compute     | jay1 | nova     |   ...   |                 |
| nova-consoleauth | jay1 | internal |   ...   | None            |
+------------------+------+----------+---------+-----------------+

The fix was set the "Disabled Reason" to None when enable a nova
compute.

Change-Id: Ief1f21ba450812a240d30104624bcec92e3f989e
Partial-Bug: #1251803
lxc: Fix a bug of baselineCPU parse failure

When starting nova-compute on compute node with lxc hypervisor,
a valueError exception will be raised because a libvirt bug of
the incorrect return value of baselineCPU() function, in function
get_host_capabilities, which introduced by commit
3b8c26321bce07b8ad588099c1fdcef858e748a8.

For libvirt interface baselineCPU() in python library, -1 will be
returned if basecpu info is None from version 1.1.2, and the return
value of this interface is corrected to None from version 1.2.0.

So a checking is added to make sure the return value of baselineCPU()
is not -1, and also a test case is added.

Closes-bug: #1259796

Co-authored-by: Wangpan <hzwangpan@corp.netease.com>

Change-Id: I5e4cb4a8d09b660edc4f6c6a4ad4bfe58a4dd5cb
Fix interprocess locks for run_tests.sh

In recent change of commit 78d62186e5b0388f740d42cb8da5798cd67d7880 tox
test has been switched to use openstack.common.lockutils module for
interprocess locks. However, run_tests.sh is left unchanged, which hit a
regression when running tests with run_tests.sh

This change applies the same change in commit 78d621 for tox.ini to
run_tests.sh, i.e. using openstack.common.lockutils to create temporary
directory for locks and pass it as env variables to all tests.

Closes-Bug: #1264058
Change-Id: I007bd39e4d9aad7539b4b7389eb5189b5d1f10e2
Remove duplicated test

Commit 65a870465fecdb65e3bd3a709c6ad2d06075f35d introduced
a test with a duplicate name (test_create),
shadowing the original one.
Remove the new test, since it's a subset of test_create test.

Change-Id: I2bc97ca4d086242f741c4ec5bbf4079b066f94d5
Add unit test for ListOfStrings field in object models

The unit test for ListOfStrings is missing in test_fields.py.

Related to blueprint icehouse-objects.

Change-Id: I731557238f64dd17ab4d7f26300e32bbbec62476
Make scheduler rpcapi use object serializer

The scheduler rpcapi is still using NoOpSerializer which can't serialize
objects. When testing with objects for instance flavor, filter_properties
can not be serialized because its structure is:

{'instance_type': <nova.objects.flavor.Flavor object at 0x6862d10>,
'scheduler_hints': {}}

If the scheduler uses objects, its serializer can not be NoOPSerializer.

Related to blueprint icehouse-objects.

Change-Id: I0a9a02eefc051738183e0393ae0c462d60c74fef
Adds a PREPARED state after baremetal node power on.

During a baremetal deployment there is a middle step which
is not currently represented. If the baremetal node powers on
but never connects to the deploy-helper, it is impossible to tell
from the database whether the deploy environment was not created
or whether the machine is dead.

Change-Id: I6be3d45fee28970cbb02945c518be34b2bc74689
Closes-Bug: #1184470
Fix inconsistent "image" value on _get_image()

The type of "image" value is different on showing details of a server,
such as:
1. It's a dict while creating a server from a image
2. It's a empty string while creating a server from a volume

We should modify the type to dict, otherwise someone who call
the api will be confused about the value or can't parse the value
in the same way.

The patch just modifies the v3 api.

Change-Id: I0d7ce59f64adec0933353af58dc5b5170390674b
Closes-Bug: #1262039
Disable libguestfs' default atexit handlers.

These aren't safe for multi-threaded applications, per the bug
report from Daniel Berrange.

Closes-bug: #1261475

Change-Id: I4cc5eaded2e21f1b2cd55615242a27b9773f0b42
Fix typo'ed deprecated flag names in libvirt.imagebackend

In nova/virt/libvirt/imagebackend.py, the images_rbd_pool
and images_rbd_ceph_conf have deprecated_name set to
libvirt_images_rdb_pool and libvirt_images_rdb_ceph_conf,
respectively, but the actual option names prior to commit
25a7de2054ba6ae5eb318c86fe165f4302fbfff8 are
libvirt_images_rbd_pool and libvirt_images_rbd_ceph_conf.
(Note the transposition of the d and b in rbd.)

Closes-bug: #1262858

Change-Id: I47f4ff6e03674c825336d26b610eeff89e48d21e
Removes disk-config extension from v3 api

This patch removes disk-config extension for v3 api, and also
remove related tests. And remove resize extension point for
servers core because there isn't any extension using it anymore
and there isn't good way to test resize extension point.

Implements bp api-v3-remove-disk-config
DocImpact

Change-Id: I894ae6f4e0d6c9f956a71e8e061ccb3fa1b039d8
Fix for qemu-nbd hang

NBD device once used seem to run into intermittent trouble when
used with mount repeatedly. Adding code to explicitly flush the
device buffers using 'blockdev --flushbufs'.

Closes-Bug: #973413
Partial-Bug: #1254890
Change-Id: I2b7053b9a069d6e82f6f6baf9ad480efa4388d91
Merge "Fix typo'ed deprecated flag names in libvirt.imagebackend"