Fix simple_tenant_usage's handing of future end times

Fixes bug #1043999

simple_tenant_usage returns the usage in the range between the supplied
start and end query parameters. The _hours_for() method calculates the
number of hours the instance was running in this range, even if the end time
is in the future.

By default, python-novaclient requests usage between 4 weeks ago and tomorrow.
This means we a report which accounts for 24 hours of extra running time for
each currently running instance. Fix this by clamping the period of the
returned report at the current time.

Change-Id: I61c211fd85b729aaeaac6ef24644ee19eb5bb6b0
(cherry picked from commit 869443f41c8826c9a4de1dcc65c5a5354b623a04)
Redefine the domain's XML on volume attach/detach

This fixes bug 1004791 by adding new disk definitions to the defined
XML instead of just modifying the running instance.

Cherry picked for stable/essex to fix bug 1012717.

Change-Id: I6596dae7c54158c32bc7b399c55a1797b2d98242
Merge "Redefine the domain's XML on volume attach/detach" into stable/essex
Yield to another greenthread when some time-consuming task finished.

Partially addresses bug #1045152

On a heavily loaded compute node, it can be observed that periodic tasks
take so long to run that the report_state() looping call can be blocked from
running long enough that the scheduler thinks the host is dead.

Reduce the chance of this happening by yielding to another greenthread
after each periodic task has completed and each loop in some methods
that has linear relationship with the number of instances.

Change-Id: If2b125708da8298b20497e2e08e52280c102f1e1
Use bare container format by default

Set container_format to bare during libvirt snapshot, when VM image in
glance was deleted. Currently, if VM image in glance was already deleted
before snapshot, nova will attempt to create snapshot image with
container_format: None. This cause glance to return error on attempt to
upload snapshot. According to glance docs container_format is not used
anywhere in glance or nova explicitly and it is safe to set it to bare,
when you are unsure which container_format you need to use.
Current snapshot logic sets snapshot disk_format to currently used
image_format in absence of base image in glance.

This resolves bug 921774 without need for snapshot mechanism redesign.

Change-Id: I7beea35120aaeac0837daecdf58f38f62e24454c
fix cleanup_file_locks with restricted permissions

SELinux was seen to disallow kill(pid, 0).
Therefore ensure that the pid is determined
to be still running if we get EPERM.

Fixes bug: 1051924
Change-Id: Ib84e2fc460066ee03070b9bda15732cce573ccf3
make ensure_default_security_group() call sgh

This change makes sure that sgh is called when default
security group is created. Fixes bug 1050982

Change-Id: I483e33d8977b2bfbd7456a7c7c0d1fe7803708f8
fix unmounting of LXC containers in the presence of symlinks

When looking up the mount dir in /proc/mounts we need
to canonicalize the path so that symlinks are resolved

Fixes bug: 1046313
Change-Id: Ib2bb8253e9cdfeda3c6ba13e56a0f907518ff558
Cherry-picked: b35b34a65a6ddcfee524304cc548b4dfe1fc6cd5
fixed_ip_get_by_address read_deleted from context

Fixes bug 996482. by default fixed_ip_get_by_address
always sets read_deleted='yes'.  Changed it to accept
read_deleted value from context.
updated .mailmap to rewrite my old email to new email

Change-Id: If94251972df7bbcfdeebc226613edac0a3f41186
(cherry picked from commit c1e54e1968faa23dfa26796fdb8f3f8d9ba79367)
deallocate_fixed_ip attempts to update deleted ip

Fixes bug 1017633. When deleting a vm, the nova
network manager looks to deallocate wrong fixed
ip when context has read_deleted set to 'yes',
in case when a network had been deleted and re-
created , it attempts to update already deleted
fixed_ips and therefore looks to teardown from
wrong network_id as well.

Change-Id: I574a20273220ef81498403da80f489732ae81eb1
(cherry picked from commit 61ab72d15b3ac61b245e0bdd4a7bee5f3a673f75)
Merge "make ensure_default_security_group() call sgh" into stable/essex
Merge "fix cleanup_file_locks with restricted permissions" into stable/essex
Merge "Use bare container format by default" into stable/essex
Merge "fixed_ip_get_by_address read_deleted from context" into stable/essex
Merge "deallocate_fixed_ip attempts to update deleted ip" into stable/essex
Final versioning for 2012.1.3

Change-Id: I624420b50ba24240dcc5a3f7d0771a6d81588752
Bump version to 2012.1.4

Set version to 2012.1.4, but with final=False

See http://wiki.openstack.org/StableBranchRelease

Note - 2012.1.3 is expected to be the final official release of Essex.

Change-Id: If6274ecbbb07f57e2af843c94e3397e2373c0cdd
Avoid RPC calls while holding iptables lock.

This exhibitied itself as very slow instance starts on a Canonical
test cluster. This was because do_referesh_security_group_rules()
was making rpc calls while holding the iptables lock. This refactor
avoids that while making no functional changes (I hope).

Fixes bug: 1062314
Change-Id: I36f805bd72f7bd06082cfe96c58d637203bcffb7
Cherry-picked: ba585524e32965697c1a44c8fd743dea060bb1af
Conflicts:
	nova/virt/firewall.py
Merge "Avoid RPC calls while holding iptables lock." into stable/essex
Backport cluster-mode and 7 mode iSCSI, and NFS drivers to stable Essex.