Update log message when remove pci device

When remove pci device, the log message does not include exception
message even the exception has been caught.

This patch was put the exception to the warning message.

Change-Id: I3c604a3c80b501dedf1f0dd9fab9f399ae73f481
VMware: improve connection issue diagnostic

This exception block can swallow all issues with a connection
adding something to log the exception thrown can aid in
the troubelshooting of a Nova node's configuration. This is
invaluable when guiding someone in the field through setup
because they may mis-type a key value or misconfigure an IP.

Change-Id: I27e5ed5c51926cfeb6747980df02a396f566dd77
libvirt: handle exception while get vcpu info

If an exception is raised while get a libvirt domain's vcpu info,
the update_available_resource periodic task will be failed, which
will result in the resource of this compute node will never be
reported.

This patch add an exception handling to avoid this situation.
Closes-bug: #1270008

Change-Id: I69109402416989fdaa421f8dbc72953bd067c407
Take a vm out of SNAPSHOTTING after Glance error

If a snapshot is attempted to be taken when Glance can't find the
underlying image (usually because it's been deleted), then ImageNotFound
is raised to nova.compute.manager.ComputeManager._snapshot_instance. The
error path for this leaves the instance in a snapshotting state; after
which "operator intervention" is required.

This simply reverts the instance state under that specific circumstance.

DocImpact: previously a snapshot that failed for this reason would leave
the instance in a spurious snapshotting task state indefinitely. Now,
the task state is reverted. At the moment that revert is 'silent'
(although the failure to snapshot will be evident to the user).

Change-Id: I9623cfaed31e8337ab65bc1eab85ad3b51b1a5ca
Fixes-bug: #1267097
Sync log.py from oslo-incubator

We want to pick up change 55cd46af to avoid thousands of blank lines in
the nova logs, so sync log.py over to nova.

This includes the following changes:

  55cd46a remove extra newlines that eventlet seems to add
  d292f7d Add error type to unhandled exception log message
  0228b81 Logging excepthook: print exception info if debug=True
  71208fe Fix spelling errors in comments
  8b2b0b7 Use hacking import_exceptions for gettextutils._
  6d0a6c3 Correct invalid docstrings
  fe18bfa Remove keystone from default_log_levels default
  27b21bc Unify different names between Python2/3 with six.moves
  12bcdb7 Remove vim header
  a6f40ac Don't log to stdout when log_dir is set

Note that change 13eb01c "Adding domain to context and log" was
intentionally ommitted since it requires context.py to be synced and
changes nova.conf.sample, but nova uses it's own context module so we
don't want that change pulled in here.

Change-Id: Iebfdf484b9fcac5dbb689c4f7ec4f43a082a50c9
Fix bug with not implemented virConnect.registerCloseCallback

The unit test test_connection_to_primitive fails many times due to
"virConnect instance has no attribute 'registerCloseCallback'".

registerCloseCallback has been added since original(community's)
python-libvirt v1.0.0, and v1.2.0 also contains the method.
However ubuntu cloud's v1.0.1 does not contain the method, and current
version check of python-libvirt does not work.
This patch tries to operate the method and catch TypeError exception if
the method does not exist instead of the version check.

Co-Authored-By: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@cloudwatt.com>
Closes-Bug: #1266711
Change-Id: I4ec9ff9a684639ae5b146f400c90115c83afcda7
Merge "Sync log.py from oslo-incubator"
Merge "Update log message when remove pci device"
Merge "libvirt: handle exception while get vcpu info"
Merge "VMware: improve connection issue diagnostic"
Merge "Take a vm out of SNAPSHOTTING after Glance error"
Merge "Fix bug with not implemented virConnect.registerCloseCallback"