Revert "Check for selinux before setting up selinux."

The existing code used trycmd(readlink) precisely because
/etc/selinux might not exist. The presented traceback in
the bug is only debug info.

Also the change will not work with libguestfs for example,
where the nova user can't access mount points mounted by root.

After discussion on IRC it was decided to reduce
debugging output in a subsequent commit.

Reverts: 9bea239f
Change-Id: Id07eae5b330332f36ad7caa786593e486aa36469
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
Prevent instance_info_cache from being altered post instance

It turns out people have found ways to use the info cache everywhere.
The problem is when these ways require information about deleted
instances the info_cache may not be accurate.

This patch prevents the info_cache from being altered after it is
marked as deleted and marks an instance's info_cache as deleted
towards the beginning of the destroy process to ensure it doesn't
get blown away by a cache refresh somewhere along the way.

Change-Id: I0d5c2f1fc7e5f8f6c1154958986bb775ced07443
Clarify TooManyInstances exception message.

Fixes LP 1031737.

Previously the message indicated the number of instances requested
and an incorrect indication of the headroom, in the case where ram
or cores was the resource gone over-quota (as opposed to the number
of raw instances).

Change-Id: I9f7f3203f0e644ba533940a87e496bfd09da0460
Deprecate root_helper in favor of rootwrap_config

Mark the root_helper option deprecated and introduce usage of
the rootwrap_config option instead. The root_helper option will
still fully be supported in Folsom, but will be removed in Grizzly.

Transition notes: you should replace:
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf

by:
rootwrap_config=/etc/nova/rootwrap.conf

Implements bp deprecate-root-helper

Change-Id: I8dfc94e9b91f7ffc82d393b345f09409da347e78
Fix failed iscsi tgt delete errors with new tgtadm

Now that the tgtadm patches are working, one problem was detected
The delete target operation would fail, and as a result lvremove
would fail due to an open connection.

There were a number of issue using the config file method, but
the most reliable way is to just use the iqn since we're going
to perform an os.unlink on the config file anyway.

devstack volumes.sh tests now pass and the detach/delete
calls are succesful.

Adjust test_iscsi for modifications to delete

Change-Id: Ic34ca2194b8d75fb84a06dfba6793106eb8055fe
maint: don't require write access when reading files

Change 'r+' to 'r' for open() when just reading.
The '+' is uneeded and distracting.

Change-Id: I8c611ab6d63e165f86e588992011f73f69565249
Merge "maint: don't require write access when reading files"
Merge "Prevent instance_info_cache from being altered post instance"
Send a full instance in terminate_instance.

Change the terminate_instance method of the compute
rpc API to take a full instance over rpc instead of just
the instance UUID.  This cuts down on database access needed
by nova-compute.

This is the final change for instances in rpcapi.py.  \o/
Unfortunately, I discovered that the scheduler isn't properly using
rpc API versioning when talking to compute nodes, so some of the methods
used by the scheduler still need some love.

Part of blueprint no-db-messaging.

Change-Id: Ic62450346ea90b9a6d64e282e992a21a4dd6ab64
Move tests.test_compute_utils into tests.compute.

Move the test_compute_utils module into nova.tests.compute to be with
other compute related unit tests.

Change-Id: I0956a18279caa15504448ddca7ffe7f4113f1f65
Remove agent_update from the compute manager.

It appears that this method of the compute method has never been used
since it was added in fa0b64b500f3a196044459ba4bf8ed0dea214e92, so just
remove it.

It was also added to the virt driver API, but the only use is internally
to the xenapi driver, so leave it as an internal thing to that driver
only.

Part of blueprint no-db-messaging.

Change-Id: Idb2c823421e714fa364affbbb80d28175b9b5b4e
Pass a full instance to rotate_backups().

This patch renames rotate_backups() to _rotate_backups(), as this method
has never been used over rpc since it was first introduced in
75a87df739effe840e6cb39c976002e99b49c796.  The name change makes it more
clear that it's a private method.

The change also makes it so this method takes an instance dict instead
of just the instance_uuid as an argument.  This is mainly for
consistency with the rest of this file, where things are moving toward
passing the full instance dict around instead to avoid any potential
need for db access.

In passing, this also fixes up some uses of instance_uuid in
snapshot_instance() where instance_uuid is most likely None.

Part of blueprint no-db-messaging.

Change-Id: I275f71384e77eb038aa1140bbfde108b91cd2f83
Merge "Revert "Check for selinux before setting up selinux.""
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
Don't pass kernel args to Xen HVM instances

The refactoring in commit c0f67877 missed setting guest.os_root for
Xen PV instances only.  If set for Xen HVM instances, the xen tools
will invoke qemu-dm with '-append root=/dev/xxx'.  qemu-dm promptly
failes with '-append only allowed with -kernel option'.

Change-Id: Iba8054b728e28463fb221d44417b1ddba323f596
Fix traceback when using s3.

Fix a regression that causes tracebacks in s3

Traceback (most recent call last):
  File "/opt/stack/nova/nova/image/s3.py", line 294, in delayed_create
     _update_image_state(context, image_uuid, 'downloading')
  File "/opt/stack/nova/nova/image/s3.py", line 286, in _update_image_state
  	headers)
 TypeError: update() takes at most 5 arguments (6 given)

This is due to 6e4539f397bfc5dbf9ec88ddc3968621815d576b

Fixes LP: #1031867

Change-Id: I6cf786999c623c0ca780a173dcba49354207e9c3
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Avoid using logging in signal handler

Fixes bug 1029727

In some cases, logging can grab locks and thusly attempt to reschedule,
which will fail in signal handlers.

This patch simplifies the signal handlers for multi-process support to
only reset the signal handlers and then raise an exception. This will
move all logging and other cleanup out of the signal handler and into
safer places.

Change-Id: I0878adf6ef5c54e577ab2ea39e2ff9845e0e9191
Fix issue with filtering where a value is unicode.

This fixes an issue where if an attribute, such as name, for an instance
contains unicode and doing a list of instances filtering by that attribute
causes a 500 error.

fixes bug 1031846

Change-Id: I2e9e9a36194dad1326b0d7257308576f8553ef06
Fix typo in db test.

test_instance_get_all_by_filters was doing an assertTrue on two values when an
assertEquals was intended.

Change-Id: I335f873a27d1777309d6fb850d7f259b87ebcb0d