convert min_count and max_count to type int in nova v3 api

this converts min_count and max_count to type:int in nova
v3 api.
If the string type hasn't been converted, in the method
_check_num_instances_quota of nova/compute/api.py, something
like req_ram = '2'*128 will occur. That's why the issue in
bug 1254616 arise.

Change-Id: I567b249e7a30681980ed760d5d09aad4c8e603b9
Closes-bug: 1254616
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
Remove middleware ratelimits from v3 api

The ratelimit middleware isn't really useful. That is pointed out
by https://review.openstack.org/#/c/34821/. And it didn't get any
object from mail-list:
http://lists.openstack.org/pipermail/openstack-dev/2013-November/020291.html

This patch remove ratelimit middleware and limits extension. The config option
'api_rate_limit' is only valid in v2 api. The pipeline factory for v3 api won't
check that option anymore. For compatibility, if user is still using old
'api-paste.init', pipeline factory will ignore to load ratelimit middleware, and
print warning message to user for notice ratelimit is deprecated in v3 api.

Closes-bug: 1255471
DocImpact

Change-Id: Ifeae0504e11089f95e4d8af58bcb7372dca87f81
Fix incorrect exception on os-migrateLive

If the server state is conflict to live-migrate, it raises
400(HTTPBadRequest)exception.We should raise HTTPConflict instead of
HTTPBadRequest.

Change-Id: I40ccb0f268716da20ae4b3de9d295a41a2dba18d
Closes-Bug: #1255001
ValueError should use '%' instead of ','

ValueError do not support using ',' to connect log and variables,
we should use '%' instead.

Change-Id: I04c2002a970465d8250e5550f6bf992b48845a0d
Closes-Bug: #1261621
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
Remove unused variables in test_conductor.py

There are two variables in test_conductor.py that are not used
by anyone, just remove it.

Change-Id: I5086c02004aa70f2393ee3f5a8e25609cc466afa
Add apache2 license header to appropriate files for enabling H102

Apache2 license says that each source file should include the license
header. However, some non empty files don't have it. And we already have
a hacking rule (H102) for this.
This commit fixes them and enables the rule.

Change-Id: I68fa0e1ee43ed28d6b470c0ffff963c095be8283
Don't use deprecated module commands

The commands module was deprecated since version 2.6 and it has been
removed in Python 3.

See http://docs.python.org/2/library/commands#module-commands

Closes-Bug: #1248216
Change-Id: I0ae40c7683ca58ede75f493d020e5c80a6434fef
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
Imagecache: fix docstring

Original docstring had incorrect information. That is,
the method did not return None.

Change-Id: I7519259b99e21e24723c566e8e7d04e32e0d2c07
platform independence for test_virt unit tests

Uses mock to avoid direct use of /proc file system
in the unit tests. This makes these tests platform
independent.

Change-Id: I21986681a9a1a6db516957246b71d7fd2055d44b
Merge "ValueError should use '%' instead of ','"
Merge "Fix incorrect exception on os-migrateLive"
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