Should finish allocating network before VM reaches ACTIVE

This patch can fix issues like tempest caused by async
network allocation. Nova uses NetworkInfoAsyncWrapper
to allocate network in an async manner, and this allows
one to start querying for network info before you know
you will need it. Nova will invoke refresh_cache method
to update instance_cache_info after excuting the
allocate_for_instance method as well.

However, nova rest api will query instance_cache_info
directly, thus maybe get the empty network info before
instance_cache_info table has been updated asynchronously.
Thus will cause VM can exist without a known address
accidentally, the caller is difficult to distinguish
this situation, unless waiting for some internal process
or it will not have an address. So should finish
allocating network before the VM reaches ACTIVE status.
For more detail can refer the bug description.

BTW, almost all create server related unit tests have
coverred this case.

Closes-Bug: #1210483
Change-Id: Iab542df1be7d5c9661d717ec596d2a37b975169a
Add test cases for resume_state_on_host_boot

part of blueprint libvirt-driver-tests

Co-authored-by: Hirofumi Ichihara <ichihara.hirofumi@lab.ntt.co.jp>
Change-Id: I234c3613eb30a593fd1b0e29655551694b7e24f7
Increase volume created checking retries to 60

In some cases 30 retries with 1 sec interval is not enough for
volume to be created.
Increased max tries to 60

Fixes bug 1213953

Change-Id: I6bcd395a4bac940387384cc85691d7219cf90e63
Add V3 API samples for instance-actions,extenions

Partially implements blueprint v3-api-unittests

Change-Id: Ie90973734943b3d22cb288b18916a6ef2d9f51de
Add V3 API samples for flavors,flavor-rxtx,flavor-access

Partially implements blueprint v3-api-unittests

Change-Id: I2b572ec13190b946daebec4e64f9b9b362d5ac6e
Fix console api pass tuple as topic to console rpc api

The topic should be string, not a tuple

Fix bug 1221541

Change-Id: I4bbb9bdeb5108436fe76db69f1546ac2bd0c7a40
Fix migration 211 to downgrade with MySQL

Suspend the Foreign Key Constraint and add it back in to stop from
preventing the unique constraint from being deleted.

Fixes bug/1216706

Change-Id: I7e77c9c5e50ec3580bca3f95f59189b33d9af306
Fix the order of query output for postgres

Sorts the query results and dictionary of expected results by two columns
rather than one which isn't unqiue.

Fixes bug 1208701

Change-Id: Icd21a008f7736a4d9027effb0633a506aae0f602
Fixes misuse of assertTrue in test scripts

Misuse of assertTrue in places where assertEqual or assertIn should be used.

If assertTrue is used, the test will always pass
if the first argument's boolean cast is True. The second argument
passed to assertTrue() will be regarded as the error message
when the assertion fails.

Fixes bug #1223620

Change-Id: I46b51bf944ba22247901172650ea6867dd525aa7
Add alias as prefix to request params for config_drive v3

fix bug 1215705

DocImpact

Change-Id: Ic236e306c64000a5556a55a0d168f15692c0106b
Change the duplicate class name TestDictMatches in test_matches.py

There are two classes with the same name 'TestDictMatches' ,let's change one to
TestIsSubDictOf.

Change-Id: I1f1059054070228265bca74cb8aaad2c8d3f8812
VMware: nova-compute crashes if VC not available

The ESX driver gets a connection to vCenter Server on startup.
Currently, if vCenter Server is not available, nova-compute crashes.
This fix adds slow retry when nova-compute starts before vCenter
Server is available.  The errors are logged in case the issue is
a mis-confiugration of vCenter Server

Fixes: bug #1192016

Change-Id: I0801ab4a4e4bf32b8119e131a45a2fdb7884a4fd
Remove extra 'console' key for index in extensions consoles v3

Fix bug 1224294

* remove the extra 'console' key
* remove xml template serializer, because default serializer is enough

Change-Id: If6f17ea7301a06fa6f9400549f875aebdef2ee93
Edits for nova.conf.sample

- replace "quotaing" with "quota checking"
- add space so shouldalways becomes "should always"

Modifies docstrings that we use to generate docs for config option
descriptions.

Change-Id: Ieca85ee997b9f85e9748387ee031714ad1b73f6b
Add instance_flavor_id to the notification message

Through Ceilometer,We can see the notification message just has
instance_type_id, for example,
    "instance_type" :"m1.nano"
    "instance_type_id": "6",
There is some confusion ,flavorid "42" should be added to the message.

bug 1217429

Change-Id: Id71e9480d243e7fc343bf9f7ea1faf2d87f01541
Remove unused and duplicate code

Remove some unused and duplicate code from test_libvirt.py
and test_db_api.py

Change-Id: Ia9e68b68abbf391017a1127c0a15b97d50f147e9
Fix hyper-v vhd real size bigger than flavor issue

In hyper-v, after deploy the image, real vhd file size will be
extended from flavor size plus vhd metadata size, this patch
fix this issue by check the vhd type and minus the vhd metadata
size according to the specific vhd type.

Fixes bug #1177927

Change-Id: I51223f4f778f33e73dce1e0f53e23e8d7ac77904
Better help for generate config

This just adds a sample command line for how to generate the
nova.conf.sample because I keep forgetting how to do it.

Change-Id: Id8bfb859f90d7fde51dd1ffdb40ec383ed5193e6
xenapi: Fix rescue

commit 4389f2292a0177c8eedc0a398ceb3c5535a9ef82 appears to have broken
rescue on xenapi. The xenapi driver requires the actual image id to be
in the "image_meta" parameter to the rescue driver.

bug 1227350

Change-Id: Ifce27ab26eb5f998850faeefe5f21a4705439821
delete a non existent flavor extra spec returns 204

Attempting to delete a non existent flavor extra spec returns
204 instead of 404, the fix was return 404 for such case.

Fix bug 1219445

Change-Id: I61db53486b5696fe74f16ac2d98971092137fadf