Rollback quota when confirm resize concurrently completed

quota is reserved when confirm_resize is executed, if a concurrent
operation updated the status of migration, currently compute layer
will directly return back without rollback the quota and it can
lead to quota inconsistent issue layer.

Change-Id: I2217e9a4523d2783eccd8ef31c1fd65a604e2cc3
Closes-Bug: #1301690
Add _security_group_ensure_default() DBAPI method

According to the convention we use for DB API methods, every public
method should have a private counterpart. The difference between
those two is that the latter accepts an optional 'session' argument,
which makes it possible for the method to participate in the existing
database transaction.

security_group_ensure_default() was called inside instance_create()
and thus implicitly created a new concurrent db transaction, which
is now fixed by making a call to a private counterpart and passing
the session instance.

Closes-Bug: #1362233

Change-Id: Ifa1b6430328fde1ab0984f726bd8392bbd3f7ee5
Allow hard reboots when still attempting a soft reboot

Commit cc0be157d005c5588fe5db779fc30fefbf22b44d introduced a
regression in the reboot code. Previously, a hard reboot could be
performed when an instance was in soft reboot.

This fixes the regression by allowing a hard reboot when the instance
is in one of the two new task states.

Closes-bug: 1362799
Change-Id: Id8aaf852b0cccb75a79794a8bf9eb94e21550b81
the headroom infomation is incomplete

If multiple resources beyond the quotas in 'limit_check' from
nova/quota.py. The headroom information about the resources
beyond the quotas in OverQuota Exception is incomplete.

Change-Id: I790c22e3618a3558dfad64bf46e37e4e49f6385e
Closes-Bug: #1334965
Return hydrated net info from novanet add/remove_fixed_ip calls

Compute manager expects hydrated network info from network_api

Change-Id: I36e48742144555004cbd1f71429a943c7e2952b0
Closes-bug: #1350846
always set --no-hosts for dnsmasq

Many network modes in nova-network disable reading host entries from
/etc/hosts. This includes running vish-ha (multihost), or if you ever
set a dns server. However if you don't do these things we continue to
use /etc/hosts.

It's not clear that this does anything other than create
inconsistency. There is a long standing bug that exists around this
because the impacts include exposing localhost as a dns entry on the
network.

Change-Id: Ibccf0999bfd4b37f2d948af34640260f95c54572
Closes-Bug: #1201873
Update invalid state error message on reboot API

This change adds more detail to the error message
when a request to soft reboot an instance in an
invalid state fails, indicating that specifically
soft reboot is the request that failed, when
a hard reboot might still succeed.

Closes-Bug: 1365683

Change-Id: I4b12aa261d1c4fa05bacd5311793ed6e0478e59b
Don't elevate context when rescheduling

The rescheduled launch should be executed with the same context
as the original request, so make sure that we aren't passing an
elevated context to reschedule.

Change-Id: Ic528f10067fa2977cc375c41b9c65d3517524ff8
Resolves-bug: 1366181
Fix integrated test cases for assisted-volume-snapshots

qcow is not a valid type of snapshot in real environment,
the require type should be qcow2 instead of qcow.
Change-Id: I0fc8e90913699074cd997f5c1e0693372436d14f
Add unit test to aggregate api

Add unit test to aggregate update api.

Change-Id: Iecaacdec726200ecd6e486e02474280f7e9e4c57
check the block_device_allocate_retries

we need to check the value of the configuration item
block_device_allocate_retries in order to ensure to
retry at least once,done like that configuration
item network_allocate_retries

Change-Id: Ia5b65bd160cb4e740d21c1b51d234e14e33135e7
Closes-Bug:#1363558
Add unit test to os-agent API

This patch adds unit tests for os-agent API to test updating
and deleting a agent with not existing agent id.

Change-Id: Id266b0449deff6bd3715cbd2b5403031a2e34eeb
Fixes AttributeError with api sample test fail

Avoid AttributeError which could be raised with api sample tests
when a string is expected but a non string type is returned
instead. This makes debugging api sample test failures easier as
the expected and actual values are displayed in the error message
rather than an AttributeError exception.

Change-Id: I4d124e4d80779c4431926619f0ca876a513a8462
Remove unused config "service_down_time" reference

service_down_time was used in service API and it's not used.
It was removed at commit I1e7e8f7519ec627b96736f74ee7123d101973544.

Change-Id: Ibf9c7082e148a3253051e5d60eacc4d891420ae7
Fixes network_get_all_by_host to use indexes

The OR in the subquery was constructed in a way that didn't allow
the fixed_ips without instances allocated to be filtered out. It
also had an unnecessary join through virtual interfaces. We have a
denormalized field for instance_uuid with an index in the fixed_ips
table that we can use. This patch removes the unnecessary join and
ads an extra filter inside the OR to reject fixed_ips without
instances. In my test with 300000 fixed ips, this reduced the query
time from about 2.5 seconds to less than 0.01 seconds.

Change-Id: I26fb0dfaf5ff64bd70c947982de4ec1728c84856
Resolves-bug: #1369009
Always log the releasing, even under failure

Cherry picked from oslo-incubator change id:
I4b87b5d9e5c42a1ab4c837ebb4d45b86faf87c21

Change-Id: Iae1b9035398e283b5837a3214cf0097022af54a9
Related-Bug: #1367941
NIST: increase RSA key length to 2048 bit

According to NIST 800-131A, RSA key lenght for digital signature
must >= 2048 bit. Now we use 1024 bit key to generate x509 cert
file. Need to increase the key length to 2048 bit.

Change-Id: I59f614b5d8a79f9e0a96503867cfca176be5c757
Closes-Bug: 1369487
disk/vfs: make docstring conventional to python

Updates docstring to make it conventional to Python

Change-Id: I5a9383be77a639a3cc25f727f59cddfd22889d70
ironic/baremetal: add validation of host manager/state APIs

Add tests to ensure the ironic & baremetal HostManager and
HostState sub-classes comply with the API contract defined
in their parent class.

Related-bug: #1369151
Change-Id: Ic2cf17c59c06fe2222db4bc5ea0e68f87c4399e9
Record instance faults during boot process

Once a build makes it to the compute manager build_and_run_instance
method no instance faults were being recorded.  This stores the instance
faults appropriately when an instance is placed into the ERROR state.

Change-Id: I348b539d0b5874bac3f7443e6dd4524264ce9766
Closes-Bug: #1355922