Partially revert "Remove unused scheduler functions"

This partially reverts commit 2aaa3d2860eed7574c5df64a8ceeb8a6adf23460.

The problem pointed out by this bug is that these changes introduce a
non-backwards compatibile change to the schedulre rpc API.  There are a
couple of acceptable ways to deal with this:

1) Leave most of the code and only remove the client side.  This means
   that a message sent from an earlier version will still work.  This is
   the ideal situation for almost *all* changes to rpc APIs.  We have to
   make a habit of this to eventually be able to support rolling
   upgrades.

2) Leave the manager methods, but simply have them raise an exception.
   This is a bit better than removing the method because the error
   can be made more explicit and obvious.  Otherwise, the operator will
   get "no such method" rpc exceptions, which will seem a bit more
   bizzare.

   An example of when this option makes sense is commit
   cac332c39645286a11c009094a86f62d02752183.  This patch refactored the
   live migration code is such a significant way that making it
   backwards compatibile seemed rather difficult to do.  The old rpc
   methods stuck around but just raise an exception.  The potential
   failure is just that live migration would fail, but the exception
   makes it obvious that an upgrade must be completed for live migration
   to work.

The current patch implements #2 in the case of get_service_capabilities,
since it hasn't been used since pre-essex.  Approach #2 is taken for
get_host_list() as well.  It was used until fairly recently, but was
broken, including being broken in Essex.  The fix that went into Essex
for this makes it no longer use RPC.

Fix bug 1029262.

Change-Id: I74c7d2a3e88b3a4f114e7da62c56f0481ee64a64
Sync w/ latest openstack common log.py.

Includes the following updates for openstack-common's log.py:

    Remove code to clear basicConfig root log handlers

    Removes some old Nova specific code to clear out the log handlers
    from Nova's logging basicConfig. This code is arguably Nova specific
    and doesn't really belong in openstack-common's generic logging
    configuration.

    Additionally, This code was actually removing the root logger used
by
    some command line tools and binaries and hiding log messages that
should
    have otherwise gone to the console.

    Fixes LP Bug #1029577.

Change-Id: Ic6a6862e5bc357846bf3202186c7e24622d3bb87
fix unmounting of LXC containers

There were two issues here.

1. There was a global object stored for all instances,
thus the last mounted instance was always unmounted.

2. Even if there was only a single LXC instance in use,
the global object would be lost on restart of Nova.

Therefore we reset the internal state for the mount object,
by passing in the mount point to destroy_container(),
and querying the device in use for that mount point.

Fixes bug: 971621
Change-Id: I5442442f00d93f5e8b82f492d62918419db5cd3b
Send 'create volume from snapshot' to the proper host

A simple solution for bug 1008866. When creating volume from snapshot on
multicluster, in volume it will check if snapshot_id is set. If snapshot_id
is set and FLAGS.snapshot_same_host is true, make the call create volume
directly to the volume host where the snapshot resides instead of passing it
through the scheduler. So snapshot can be copy to new volume. The same as
review 9761.

Change-Id: Ic182eb4563b9462704c5969d5116629442df316a
Migrate a logging change from common:

commit 58404a1a9461900367dbb7a8b3f2f98441e12959
Author: Mate Lakat <mate.lakat@citrix.com>
Date:   Tue Jul 31 17:53:57 2012 +0100

    Install a qualified except hook.

    Fixes bug 1031351.

    As an Exception is raised, it was not visible in the log, because
    it wasn't qualified. The fix sets up the exception hook to be
    qualified as the product_name.

Change-Id: I38c48d0dd2ac885fcb226310b6039be667af9e0d
Update reset_db to call setup if _DB is None.

This resolves issues when running individual tests that require
a database. With this fix I can once again run individual test
modules that make use of the database. For example:

  ./run_tests.sh test_libvirt

Previously this would fail with database errors.

Fixes LP Bug #1032738.

Change-Id: Icce7ac9414f0e19eece44819a217634947de7f73
Fix broken pep8 exclude processing.

First of all, our pep8 exclude was excluding openstack, to trap
for not doing pep8 checks on openstack/common, which comes from elsewhere.
But, pep8 strips filenames down to basename when doing exclude checks on
them, which makes no sense. To fix this, grab the two functions from pep8,
fix them, and monkeypatch them from within hacking.py.

Patch has been submitted upstream as:

  https://github.com/jcrocholl/pep8/pull/111

Also, changed the exclude to catch just openstack/common.

Change-Id: If0b18ae828e74203f84a8b6f8b4ba0100b3bbc59
Remove unused variables

Change-Id: I137c9522257e8b5fcb13c1e9fe6cb4e0c442e33c
Audit log messages in nova/compute/api.py

To include instance whereever possible.

Change-Id: Ic3b86eed17ebee90766af9e2c3c74f33c7a09432
Update list_instances to catch libvirtError.

Commit be590cfa4b0025587a956642dc859902d577f3f7 caught (and tested
for) the wrong exception. lookupByID throws a libvirtError.

Fixes LP Bug #1032741.

Change-Id: I6745660658df4d0f2bc4cd423e173200fc23cd8e
Merge "Remove unused variables"
Merge "Fix broken pep8 exclude processing."
Migrate a notifier patch from common:

commit c767e9beffe4b826eac869ce7e2eef2cc1499bbe
Author: Andrew Bogott <abogott@wikimedia.org>
Date: Thu Jul 19 03:34:31 2012 -0500

Add multiple-driver support to the notifier api.

Move all of the functionality previously provided by the list_notifier
into the basic notifier api. Move and restructure tests accordingly.

Remove the list_notifier file and test file.

For bug 1025820

Change-Id: Icadaafe8bc312942249272873d9a4a8f1aa49a94
Merge "Partially revert "Remove unused scheduler functions""
Updates to the prep_resize scheduler rpc call.

I started looking at this because of the prep_resize rpc call in the compute
manager.  An API server calls prep_resize on the scheduler which then calls it
on a compute node.  I will need to make the same changes on the compute side,
but this is the first step.

The prep_resize call was taking two object IDs, an instance UUID and an
instance_type ID.  Both of these have been converted.  It now takes an instance
dict and an instance_type dict, instead.  It can also handle receiving the old
IDs for backwards compatibility.  prep_resize also took a topic argument that
was unused, so it has just been removed.

There are a number of changes in the scheduler code tied up in this to make it
more explicit about exactly what arguments are expected instead of just using
*args, **kwargs.

Part of blueprint no-db-messaging.

Change-Id: I4af18e5575e2bb60a410fc8edabf3d607c72aabc
Remove **kwargs from prep_resize in compute manager.

The only place where additional arguments were being passed in was via
the unit tests, and they aren't used.

Part of blueprint no-db-messaging.

Change-Id: I13f4a209ac9acc732966cb6e01bdbbcc3e3bd3c8
Merge "fix unmounting of LXC containers"
Require eventlet >= 0.9.17

0.9.17 was released 2012-08-03 and
includes two particular fixes related to OpenStack

1. https://bitbucket.org/which_linden/eventlet/issue/123/
Fix an exception thrown by epoll in certain cases.
This can cause jenkins to deadlock, triggered for example by:
https://review.openstack.org/#/c/10767/

2. https://bitbucket.org/which_linden/eventlet/issue/115/
   https://bugs.launchpad.net/nova/+bug/903199
Fix a significant memory leak of _DummyThread objects.

Change-Id: I449f30afde7d162ed2c0df149174f1250ef378ca
Merge "Audit log messages in nova/compute/api.py"
Merge "Sync w/ latest openstack common log.py."