Fix instance can not be deleted after soft reboot

The reason is that:
1. soft reboot will wait for instance become to 'shutdown', and then start it
2. delete operation also wait for this, and then clean up the instance
3. if soft reboot found the instance become to 'shutdown' firstly, it will
start it immediately
4. then the delete operation will go to the _wait_for_destroy loop, and the
loop may be endless
5. when we delete the instance again, because the lock was hold by the delete
operation before, this one will wait the lock and don't implement actually.
So the domain id is checked during _wait_for_destroy loop, if it changed and
the instance is still running, we need to destroy it again.
If the domain is booted after _wait_for_destroy, it may result in
unfilter_instance failed because the nwfilter is in use, so doing the same
thing as above.

Fixes Bug #1111213

Change-Id: I98dc902dd86fa828f5821465c611953e08f9f637
Retry bw_usage_update() on innodb Deadlock

Adds a new decorator _retry_on_deadlock() to sqlalchemy api.  This patch
makes bw_usage_update() use it.

Fixes bug 1129622

Change-Id: I0293c62d2dd5ac036445bc639cabbd05ba016e83
Add an extension to show image size.

Adds image size data that is returned from Glance into the API response.
This becomes really useful for users when they take a snapshot and want
to track the storage used by it.  Since this information is already
being pulled by Nova we should display it.

DocImpact
Change-Id: I8a2d4001c21bcc54cac1a2992034dfc9fbe39d7e
Fix instance directory path for lxc

Commit 12b8bd380e22a40e10e9d2758f5a0d594517de51 triggers a regression
when starting a STOPPED LXC instance. Instance referecne is needed to
correctly setup container rootfs path.

Change-Id: Id55b7f3a631e80a0da3f52c55784414105a61142
Make add-fixed-ip update nwfilter wth in libvirt

Add inject_network_info to the libvirt driver  so that the
add-fixed-ip call will trigger a refresh of the nwfilters.

Change-Id: I00eccf34b8f92fb1e26a72e4bddb47dd39c4558f
Fixes: bug #1124722
Improve I/O performance for periodic tasks

Unfortunately, periodic tasks to update local resource and
driver status come with performance penalties, especially on LVM
image backend type.

This is because low level implementation relies 'vgs' command to
query LVM info, which itself has a I/O performance price and
extravagant use of local_gb_xxx query make things even worse.

This commit centralize such query in one single call
(volume_group_info) and reduce invocation times in periodic tasks
accordingly.

Partially resolves LP #1130697

Change-Id: I165f96dd3e4fdad770b8a9643f5a038d353312ff
Merge "Retry bw_usage_update() on innodb Deadlock"
Merge "Add an extension to show image size."
Merge "Make add-fixed-ip update nwfilter wth in libvirt"
Move DB thread pooling to DB API.

The eventlet db_pool wrapping done in sqlalchemy is wrong.  It needs to
be around the whole DB API call.

Fixes bug 1128605

Syncs nova with the fix in oslo.  Moves nova to use the oslo version of
db/api.py to import the DB API implementation.

Renames configuration option sql_dbpool_enable to dbapi_use_tpool

NOTE: tpool will not work without a fix to eventlet for Threads + locking.

DocImpact

Change-Id: I6c75b6138d38d12261d133f2cb2f5e59c667f837
Merge "Move DB thread pooling to DB API."
Merge "Fix instance directory path for lxc"
Merge "Improve I/O performance for periodic tasks"
Merge "Fix instance can not be deleted after soft reboot"