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
Merge remote branch 'upstream/master' into hpc-trunk
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
Test of Signed-off-by feature

Signed-off-by: Dong-In David Kang <dkang@isi.edu>
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
Handle InstanceNotFound in libvirt list_instances.

Updates the libvirt driver so that InstanceNotFound is
handled within the list_instances function. This
can occur if an instance is deleted while the
list_instances function is processing.

Fixes LP Bug #1032741.
Change-Id: I97c9533f8b37957e71237c610ac360fbf9f57b9a
Remove unused variables

Change-Id: I137c9522257e8b5fcb13c1e9fe6cb4e0c442e33c
import missing module time

time is used in line 2450 but is never imported

Change-Id: I8b5690c5562768050416d0921cbae7dd0af769c9
Rename _self to self according to Python convention

If self is never used, it should probably be defined as a classmethod
or a staticmethod, instead of _self. Use "self" for now to stick
to python convention, and leave proper refactor to other patches.

Change-Id: I71de42ffd3e83c57772b6490c52f24bcd9d1f1ea
Merge "Rename _self to self according to Python convention"
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""