Read deleted flavors when using to_xml()

Fixes bug 1073736

Extend get_instance_type to accept an optional flag to return inactive
flavors and use this within to_xml().

Change-Id: Id01724a85d9aff3b32b3502be06a84578fa8f4df
Increased MAC address range to reduce conflicts

Increased the 4th octet range from 7f to ff, making it consistent with
Quantum. This also reduces the probability of a MAC address conflict.

Fixes LP: #1050924

Change-Id: I801a852110c0a35e5a6a31f359df75475a21fd4a
Ability to specify a host restricted to admin.

Fixes bug 1070880

There is functionality in place, which uses the
format "az:host" on the --availability_zone
parameter to a create request to force scheduling
of an instance onto a specific host. However,
this is limited to users with Admin context.

This fix alters this behaviour to use a specific
policy action allowing fine-grained control over
which users have access to this functionality.

Change-Id: Ibb0e43492dfa2699ab26318736ca55a60b7b4468
refactor: extract _attach_mapped_block_devices

Extract method to remove code duplication.

Change-Id: I032883984ec33051034a30caf3c56520edf58f12
xenapi: Make agent optional

Related to blueprint xenapi-config-drive

As config drive and agent are doing similar operations, this change
makes it possible to disable agent, thus config drive could perform
these operations.

Change-Id: I3fa536cb0fb3b60ff5bc035be9d86afe35905240
improve sessions around floating_ip_get_by_address

improve session handling around calls to floating_ip_get_by_address.
Removed 'session' parameter from public method calls, and replaced
private calls with new method _floating_ip_get_by_address.

Some existing calls to floating_ip_get_by_address were easily rewritten
into a simple model_query().update() call and thus removed. Others can
be cleaned up later.

blueprint db-cleanup

Change-Id: I4db11e6d7fda43420bca800c44c34efdefb8038a
add doc to standardize session usage

Add doc to nova/db/sqlalchemy/session.py to outline some best practices
when using sessions within Nova, and also shows some things to avoid.
This will form the basis of much of the db-cleanup work.

Change-Id: Ib91a7fa3263e415fb6b8f88e79325c730550e576
Forbid resizing instance to deleted instance types

Sets read_deleted="no" while get_instance_type_by_flavor_id to forbid
resizing instance to deleted instance types

Fixes bug 1068539

Change-Id: I3859f63a33391a840e041f06f08af361b6d64157
Remove flags.DECLARE

The cfg.ConfigOpts class has an equivalent method, so lets use that.

Change-Id: I5860230336d00d7531a0ffd255c766ff77661625
Switch from FLAGS to CONF in bin

Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.

We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.

Change-Id: Id0c59b2dc8002ec89ccbc5e5d7986fb68d3a693d
Switch from FLAGS to CONF in nova.api

Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.

We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.

Change-Id: I11fda86471fbf02eec342b95ec314792388307e3
Switch from FLAGS to CONF in misc modules

Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.

We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.

Change-Id: Ib110ba8d1837780e90b0d3fe13f8e6b68ed15f65
Switch from FLAGS to CONF in nova.network

Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.

We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.

Change-Id: I20b45c6325e9a03b8800032f761c2b6101376e8e
Switch from FLAGS to CONF in nova.scheduler

Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.

We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.

Change-Id: Ia3f66aec300fd88e91cef926da735f9e95aa2cc2
Fixes volume attach issue on Hyper-V

Fixes Bug: #1074717

During volume attach on Windows a process is spawned. The process
currently fails with the following exception, due to eventlet monkey
patching of the os module.

NotImplementedError: set_nonblocking() on a file object with no
setblocking() method (Windows pipes don't support non-blocking I/O)

The fix consists in avoiding monkey patching the os module in
nova-compute on Hyper-V

Change-Id: Ib513bc218da83b751439bad114baac24b08e3d02
Imported Translations from Transifex

Change-Id: If5368c108d0637a2fd53c47823054c93c5ac781f
Don't verify image hashes if checksumming is disabled.

There was a bug where we were checking base image checksums, even
if checksumming was disabled, if there was already a cached checksum
for the image. This resolves bug 1075017.

DocImpact

Change-Id: I38f5914cd9d6326fdf5e5d7f0f57885ff8b5ff32
De-duplicate option: console_public_hostname

console_public_hostname was defined in both console.manager and
vmrc_manager.

Change-Id: I377ca893a84ff60f2d289cde3eba05993e2a09b1
Fixed instance deletion issue from Nova API.

When host Compute is down, Nova API deletes the resources associated with the
instance. However, since the instance is marked deleted first, the next query
to update the instance vm_state and task_state in DB fails. And instance
remains in state vm_state=ACTIVE, task_state=DELETING, deleted=True.

Fixes LP: #1074305

Change-Id: I0a4e64d180b4b2c5e398a21a62b29b7d59549a9f
Make ComputeDrivers send hypervisor_hostname

hypervisor_hostname is set in get_available_resource() and
in get_host_stats(). Except for vmwareapi driver.

Change-Id: I66348ae1e986162b8139b04ab03c42c424338175