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
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
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
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
Add missing get_available_nodes() refresh arg

In commit 3d96f85 (review I22c8d70e3e70f2d2421915da66c2618688e0db2b)
we added a refresh=False kwarg to get_available_nodes() but forgot to
add the arg to the baremetal and vmware drivers.

Use the kwarg in tests to catch this case.

Change-Id: Ib7998aafefdeac47bfad53614927c0346f193adf
Add new-world Quota object

Adds a Quota object that can track reservations.  This allows us to be
more OOP-like.  No code uses this yet but a follow-up patch will fix a
bug where compute is querying the DB.

Related to blueprint unified-object-model

Change-Id: I9f435691f12c7c268f754bb23a6330a7a2c419e4
Fix quota direct DB access in compute

This fixes the quota direct DB access in compute by using the new Quota
object.

Related to blueprint unified-object-model

Change-Id: Ib6ed6cc3b3f3f49cca1e89c0fb6e501201febd24
Closes-Bug: 1226759
Merge "Add new-world Quota object"
Merge "Fix quota direct DB access in compute"
Merge "Add instance_flavor_id to the notification message"
Merge "Add missing get_available_nodes() refresh arg"
Merge "Fixes misuse of assertTrue in test scripts"
Merge "Should finish allocating network before VM reaches ACTIVE"
Merge "xenapi: Fix rescue"
Prune node stats at compute node delete time

This commit addresses the situation in which a compute node is deleted, but
its compute node stats still remain in the database as **not** deleted. This
causes ill side effects in compute_node_get_all when it's retrieving host stats
as it doesn't expect there to be compute node stats for which there is no
corresponding compute node (i.e., causing some nodes' stats to be empty).

As such, when a compute node is deleted, its stats should also be implicitly
deleted.

The new test case that's been created fails without the code changes, which
illustrates the problem that compute node stats are empty when they should
not be.

Also included is a simple DB migration script that will update old stats that
were not marked soft-deleted as they should have been.

Change-Id: Ief0f7cf1a506e71898b5a45a0513d34167432d67
Closes-Bug: #1224712
Merge "Edits for nova.conf.sample"
Remove print statement from test_quotas that fails H233 check

The nova.tests.objects.test_quotas module had a print statement which is
causing a hacking H233 check failure. It was probably just left there
from debugging the code while it was under development, so this patch
simply removes it.

Closes-Bug: #1227655

Change-Id: I25296d7f4a9d2242bfe3ed2e00df6d840a7b19cd
Merge "Prune node stats at compute node delete time"