Change unit test for availability_zones.reset_cache

Test_rest_availability_zone_reset_cache can not make sense
because the result of az._get_cache().get('cache') before
executing az.reset_cache() and after az.reset_cache() are
same.

This Patch will provide a reasonable test for it.

Change-Id: I7a27998bdf70f39077a5d79fc460974fc5806c3e
Closes-bug: #1258041
Set a sane default for state_path

This change sets a sane default to state_path and puts the previous
state_path for tests only.

Because the default value of state_path changed, if this one isn't set in the
configuration file, pybasedir is not more used as replacement but /var/lib/nova
is used instead.

UpgradeImpact
DocImpact
Closes bug: #1240879

Change-Id: I94502bcfac8b372271acd0dbc1710c0e3009b8e1
fix log message in APIRouter

In _setup_ext_routes(...) and _setup_extensions(...)[0], there are three
logs telling that I'm setuping extensions routes, and these are done,
those failed. At line3 in [0], every resource woulld be logged before
the line 6-7 skip (conintue in Python). So here should be that I'm
'extending' resource, not 'extended'. Similiar in line 38 and line 43,
these two should be what is done and what is failed.

So this patch fix the first log from 'Extended' to 'Entending', and in
third log, 'extending' to 'extended' instend which makes context log
more reasonable.

[0] http://paste.openstack.org/show/60246/

Change-Id: I2de66f1a8e09945e1915b61771a55af6b630369c
fix ips to 'ips' in APIRouter

Actually ips in `ips in init_only` would not be valued as True because
ips is a moudle object not a string. Fixing this to string 'ips' could
prevent potential issues and improve readability.

Change-Id: I74564349e1fef00e7430cfb0547b3ad87c8e471c
Remove unused code in test_attach_interfaces.py

"body = jsonutils.dumps({'port_id': FAKE_PORT_ID1})" is unused in
test_attach_interface_without_network_id(). We should remove it.

Change-Id: Id31b559752d57c9f55fd2bf0de909b8d8f9a0333
Closes-Bug: #1266617
Use the full string for localisation

Concatenating localized strings is bound to be confusing.
Give the full string so that translations can be tuned accordingly.

Change-Id: I84a5fa2939c02add5468c4ab4b6f2c4ea1a5f8f0
Abstract add_timestamp out of ComputeDriverCPUMonitor class

Move add_timestamp decorator into ResourceMonitorBase class,
then other monitor metrics can reuse it.

Change-Id: I060353b9e194b1882549fec07fc2a486aeb1fce0
replace type() to isinstance() in nova

In nova/utils.py, a func use the "type" method to
determine the type. It's bertter to use the "isinstance"
method instead.this bug is fixed in glance:
https://review.openstack.org/#/c/65611/4

Change-Id: I10d25d2308436239c50cf3932c212e22c45f92a8
Closes-Bug: #1267300
XenAPI: Use direct IO for writing config drive

If you don't use direct IO when writing to the device, the unplug
immediately following this may not succeed as the device may still
be in use.

Also add a sync to ensure the device is not being used at the point
of unplug.

Closes-bug: 1259163

Change-Id: I68f09835648b36772a7839af9718123a4c60734f
Make image props filter handle old vm_modes

The ImagePropertyFilter would fail to build an instance if the image
used an older style vm_mode (e.g. 'pv') as described in
nova.compute.vm_mode.  This change will convert the vm mode string to
the current form.

Change-Id: Ibde37e28b02d9e866b286ea14c47a6a8411d94b4
Closes-Bug: #1276773
Fix potential fd leak

Always close the test socket.

Change-Id: Ic87b713a7791cf39ed5146754e1345fc662c894e
ec2 api should check 'max_count'&'min_count' para

in ec2 api,run_instance method have not check para
about 'max_count' and 'min_count'

Change-Id: I852dac71e56c658a54b127053cba155e1a260a73
Closes-Bug: #1267382
Capture exception for JSON load in virt.storage_users

If CONF.instances_path/compute_nodes is empty when the storage_users
tries to register the storage use (virt.storage_users.register_storage_use)
the exception is uncaught and raised. As a consequence, the image cache
manager won't run.

Closes-Bug: #1252659

Change-Id: If9ed5e75b0bc0b8f3a7c5fd7ec88f6399e4e59c6
Merge same db calls for some quota methods

db.quota_get_all_by_project is called twice in method limit_check()
and reserve(),
db.quota_get_all_by_project_and_user is called twice in method
get_settable_quotas() in nova/quota.py

Change-Id: Ie5e3a414d3d52964c16613f44fe60a7f68bc0c66
Closes-bug: 1277068
Add API schema for v3 rescue API

By defining the API schema, it is possible to separate the validation
code from the API method. The API method can be more simple.
In addition, a response of API validation error can be consistent for
the whole Nova API.

Partially implements blueprint nova-api-validation-fw

Change-Id: I3d08bc20e4c585dca1e218e8d97b208d158a3096
Fixed incorrect test case of test_server_metadata.py

Fixed incorrect test case about following points.
 * delete 2 test case because same test will be done
   in other part of same class.
 * fixed parameter according to test purpose.
 * fixed expected exception code.

Change-Id: I3116e9b4e22a86c583a531c8b8e46069f876296e
Corrected typo in metrics

Change-Id: If23292d83776be50f22f45c849fd45b7b04da7d9
Fix multi availability zone issue part 2

In order to keep consistency with fixing in
code review:
I788782a9f21ec2672551f75123753175bb268586

adding aggregate az checking logic to guarantee
that aggregate updating and aggregate metadata
updating shouldn't be done when aggregate's hosts
belong to other az. So, when az conflict exist,
user should remove those hosts.

sync the changes into V3 aggregate APIs.

Fixes: bug #1200479
Change-Id: I18ad1ac22c6aee298ccc75c978b85241ae1ac616
VMware: Fix incorrect comment indentation

Change-Id: I60ae70701af2506753ded5ef3d25f17cc36a0b1b
VMware: improve exception logging in driver.py

Change-Id: Id46860d269462673bc935653b2ce1ea1036db002