Accurate exception info in api layer for aggregate

Adjust log information for exceptions in api layer for aggregate
according to
https://wiki.openstack.org/wiki/LoggingStandards#INFO_log_level_is_for_Operators
the LOG.info was removed because nova api already reported error to operator

Change-Id: I89394407495cf2d346e1f532ada236a4364aab24
VMware: deprecate ESX driver from virt configuration

Remove the VMware ESX driver configuration from the virt driver
configuration help options.

The commit d041b95b8977e77a51e6031c38f0011b44d3266a marked the
VMware ESX driver as deprecated. This is the first step in
starting to remove the driver in Juno.

Change-Id: I955ffee336feeca68994d9ea4e244f3c7e10eed2
Fix EC2 not found errors for volumes and snapshots.

According to AWS docs
(http://docs.aws.amazon.com/AWSEC2/latest/APIReference/
api-error-codes.html)

Change-Id: I43af230b975263bb2a14e0cc0bd8718f55bd8a55
Closes-Bug: #1323813
Run instance root device determination fix.

Legacy bdm in incoming parameters contains a number of devices
specified by their names (e.g. "vdb" or "/dev/vdc").
Current code considers "vda" as root device and doesn't work on
"/dev/vda", for example.
This fix extracts the last significant character (digits
are skipped in "..sda1")  from the name like "a", "b", "c" and
selects the root device by checking for "a".

Change-Id: Iebaa117bb747d30ac9ceabd8805740dec9d1355c
Closes-Bug: #1322180
libvirt: virt rescue method now supports objects

Commit a37a96fd13b933123e80ad24e37fc37d73c16059 ensured
that the compute API and manager are now getting objects
for the rescue method.

This patch adds support to the virt driver code.

Change-Id: I2ae89f937b1983a2b0599e2eded343aa8358dbba
libvirt: virt unrescue method now supports objects

Commit 65ad230af5ece020822fa963dd30fd641a54ae91 ensured
that the compute API and manager are now getting objects
for the unrescue method.

This patch adds support to the virt driver code.

Change-Id: I5cca3fa997042b164c21fe2a13c2311f4b18ec06
Add subnet routes to network_info when Neutron is used

This change adds subnet routes to the network_info.

Extensions and future code will now have access to subnet routes.

Change-Id: I0827494dd5c95eb596e526204a2d94fcda2bb0dc
Closes-bug: #1315207
Disable rescheduling instance when no retry info

When scheduler_max_attempts=1 means disable rescheduling, compute
won't reschedule instance before. But build_and_run_instance didn't
hornor this behavior. And cause nova reschedule instance infinitely.
This patch fix this problem, make build_and_run_instance won't reschedule
instance without retry info.

Change-Id: I52d6569c1731b5fd5a10f39ff04a40b43d3857a1
Partial-Bug: #1326207
Fix cold-migrate missing retry info after scheduling

If the resize failed, nova-compute will try to rescheduling this resize
task. But the retry info is missed at resize compute task. This patch
add the retry info back.

Change-Id: I1b60704955e2fb218d047394dd20afe7f971c03d
Remove duplicate code in Objects create() function

Remove duplicate code updates.pop('id', None) in create() function.
Because if self.obj_attr_is_set('id'):
            raise exception.ObjectActionError(action='create',
            reason='already created')
already make sure object doesn't have 'id' values, which means that
'id' won't appear in updates.

Change-Id: I582ef8857b32c07ea8ba1eb5fc1e64516110f3ce
Handle service creation race by service workers

This handle a race where a sibling has already created the service
record in the database.  This fix is similar to that of commit
f6c341b4.

Change-Id: I7975fc632eee34390c5d7dc275b52363ad45475e
Closes-bug: 1326901
Sync oslo lockutils to nova

There is some update for lockutils in oslo, sync from oslo

The commit to be merged:
edd73c9 Merge "Improve help strings"
e446fe5 Merge "Fixed several typos"
fe3389e Improve help strings
f3f14c9 Fixed several typos
0f495ee Emit a log statement when releasing internal lock
f0dd798 Remove rendundant parentheses of cfg help strings
006d9a2 Allow external locks to work with threads
9b73c19 Re-enable file-based locking behavior
edce46c Use Posix IPC in lockutils
ac84a40 Update log translation domains
ee4df7f Merge "Add remove external lock files API in lockutils"
fcf517d Update oslo log messages with translation domains
37a1de8 Move the released file lock to the successful path
3c125e6 Merge "Use threading.ThreadError instead of reraising IOError"
de826f2 Merge "Have the interprocess lock follow lock conventions"
b0d0c33 Add remove external lock files API in lockutils
e71cd1a Merge "Trivial: Make vertical white space after license header consistent"
4f6190a Use threading.ThreadError instead of reraising IOError
195f0b1 Have the interprocess lock follow lock conventions
15cca4b lockutils: move directory creation in lock class
81fe39e lockutils: remove lock_path parameter
14d3669 lockutils: expand add_prefix
dc06d55 lockutils: do not grab the lock in creators
a0948cb lockutils: remove local usage
df8e051 lockutils: split code handling internal/external lock
8b2b0b7 Use hacking import_exceptions for gettextutils._
6d0a6c3 Correct invalid docstrings
6fa29ae Trivial: Make vertical white space after license header consistent
12bcdb7 Remove vim header
79e6bc6 fix lockutils.lock() to make it thread-safe
ace5120 Add main() to lockutils that creates temp dir for locks

Related-bug: #1256306

Change-Id: Iced751f059bd9a893ccefb5f98d63df29f40c622
Make remove_volume_connection() use objects

Changes the remove_volume_connection() method in compute manager
to take objects.

Related to blueprint compute-manager-objects-juno

Change-Id: I4fabee87df409accd947db3d5b429f7e871c2d60
Replace assert* with more suitable asserts in tests

The following replacements were done in unit tests to
 have clearer messages in case of failure:
- assertTrue(a == b or a == c) with assertIn(a, [b, c])
- assertTrue(type(a) == dict) with assertIsInstance(a, dict)
- assertTrue(type(a) == int) with assertIsInstance(a, int)

Also assertTrue with several conditions was splitted.

Change-Id: Id6e5db9ead8d8dceb9f416c1b55280855d25e604
Replace assertTrue/False with assertEqual/NotEqual

The following replacements were done in tests to have
clearer messages in case of failure:
- assertTrue(* == *) with assertEqual
- assertTrue(* != *) with assertNotEqual
- assertFalse(* == *) with assertNotEqual

Change-Id: Idbb1a292cf8545b87728fa2b815c67f923ef6efa
Adds instance lock check for live migrate

Whilst migrate has an instance locked check, live migrate didn't. This patch
adds a check to see if the instance is locked in the compute api live migrate.

Adds a testcase for V3 and generic instance lock checking for the V2 API since
none existed yet.

Closes-bug: 1257187

Change-Id: I442abb74fe2a4d5d46b597b0ea24d249d2d03b45
Downgrade some exception LOG messages in the ec2 API

Downgrades some LOG.exception messages to more appropriate error
or debug level instead. Tracebacks should only be produced where
they are really necessary. In two of the cases the error path is entirely
expected as a result from user error and should therefore only be
logged at debug level.

Change-Id: Ib8321836c622a30c37c97fa971cb9fcf406bd2f1
Sync revert and finish resize on instance.uuid

We need to make sure we sync the state of the instance the same way we
do for do_confirm_resize. Previously, we were not syncing the instance
on revert or finish resize. We do this so that we can update the
migration and instance resize update orders. Previously if you set
resize_confirm_window to some small value, your resized instance could
go into error state because the periodic task was run after the
migration was updated but before the instance object was updated. This
change makes it so the instance is always updated before the migration.

Change-Id: Iaad1a05864b2b46180cadf16198b0fd8583c6703
Closes-Bug: 1326778
Synced jsonutils and its dependencies

The sync includes change that drastically enhances performance on Python
2.6 with fresh simplejson library installed.

The latest git commit in oslo-incubator:
- 109e325eec054aefe4fcef4b928a46a6d7247e05

List of synced commits:
* gettextutils.py:
  - de4adbc4: pep8: fixed multiple violations
* importutils.py:
  - 1173e469: Remove ValueError when accessing sys.modules
* jsonutils.py:
  - 0d7296f6: Add kwargs to jsonutils.load(s) functions
  - 18f2bc1b: Enforce unicode json output for jsonutils.load[s]()
  - 9e5a3938: jsonutils.load() accepts file pointer, not string
  - a6b2aecf: On Python <= 2.6, use simplejson if available
* strutils.py:
  - 8a0f5678: Remove str() from LOG.* and exceptions
  - fd18c288: Fix safe_encode(): return bytes on Python 3
  - 302c7c80: strutils: Allow safe_{encode,decode} to take bytes as input
* timeutils.py:
  - 250cd88c: Fixed a new pep8 error and a small typo

Change-Id: Ib3dc0b713ed90396919feba018772243b3b9c90f
Closes-Bug: 1314129
Forcibly set libvirt uri in baremetal virtual power driver

To ensure the baremetal virtual power driver is able to control
all the available libvirt domains when connecting to the remote
libvirtd host, we enforce virsh to use the 'qemu:///system' uri.

Enforcing it to 'qemu:///system' should not break existing
deployments while also fixing issues appearing when it is not
set, see tripleo bug 1226310.

Finally, while the uri is an actual config parameter for the Ironic ssh
driver, Nova baremetal is in soft freeze so it seemed more appropriate to
just avoid polluting the config file with deprecated, obscure settings.

Change-Id: I1c956bb9fa6fd365ebeea42d374c800455293e2b
Related-Bug: #1226310