Updated code to update attach_time of a volume while detaching

While detaching volume from an instance, attach_time of the
volume is not updated. This task updates volume['attach_time']
to NONE at detach_volume.

Also modified the default value of XML attribute
volume['attach_time'] '-' to ''(a 0 length string) to
maintain consistency with existing code.

Fixes bug: 1056122

Change-Id: If56ceda6caab80fb803fcf194ed1dfb18808ec3a
(cherry picked from commit ee2dd66c9c2350d9c4aa4ae535daed7e8d72dfb3)
Consistent Rollback for instance creation failures

Fixes Bug 1065092

Adds a single QUOTA.rollback for all exceptions rather than performing
the rollback individually. Ensures that no stale "reservations" are left
in place after a failed instance creation.

Change-Id: I354726b651ae8feb6153d5865e0b14b54c73314b
Add call to trigger_instance[add/remove]_security_group_refresh quantum

The calls to trigger_instance[add/remove]_security_group_refresh were
not being called in quantumv2/api. This patch adds those calls.
Fixes bug 1057069

Change-Id: Ia76d37ebf2546a26f893dcbc8d5a05f02324ad6b
Fix reserve_block_device_name while attach volume

The block device name will not  be reserved in current implementation
due to missing volume_id in block_device_mapping. This will cause
block_device.instance_block_mapping does not return the ebs device
which should be reserved.

This patch adds the volume_id to block_device_mapping while reserving
block device name.

Fixes bug 1062033

(Similar to dcabd6159abcdccd99e55495ec005926465007a8 and
66f1a34cabc26930db2a1afed5a0f5ced4d1c015 which fixed the issue in
trunk)

Change-Id: I8f08b568619fefa99850de0bee7d605749d53b0a
create_db_entry_for_new_instance did not call sgh for default

When an instance is launched create_db_entry_for_new_instance() is
called which calls self.db.instance_create(). Then,
db.security_group_ensure_default() is called which creates the
default security group entry in the nova db. Though the sgh handler was
not called. Alternatively, if any nova secgroup-* call is made the sgh
is called which creates the default security group. This patch adds
a call to ensure_default() before db.instance_create() so the sgh
is called. Fixes a case missed in  bug 1050982

Change-Id: I9649b5ef026ca18a55abfb66e87fd0e358eba6f2
Fix VM deletion from down compute node

* free network resources
* free volume resources
* delete.start and delete.stop notifications added
* Handle network deallocate in multi_host mode

Fixes bug 1067214

Co-authored-by: Vishvananda Ishaya <vishvananda@gmail.com>
Change-Id: I0d4a7dc5836d39e405824528de214f23b214849f
(cherry picked from commit 3dff43356619b4a935a5f395b066e96e8856bb4f)
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
(cherry picked from commit d00f09f2ebfa17b1b66ac080f4719f925e0777de)
 fix deletion of LVM backed instances

    The enumeration of the logical volumes was incorrect,
    thus causing the deletion of instances booted from them,
    to fail.

    Fixes bug: 1078085

Change-Id: Ib899754002cea28f310b042e5d4a7f89416e031e
Cherry-picked: 3c9e48d1119b77428346680c2a009c44ff9bf2ce
Make resource tracker uses faster DB query

Fixes bug 1060363

db.instance_get_all_by_filters() uses a regex when filtering on host,
which will do a full table scan. A regex isn't needed and instead,
db.instance_get_all_by_host() can be used which does not impact the
performance so much.

Change-Id: I812e1d5320763e5c65232351e1e21285e04e6a4b
Fix incorrect LOG.error usage in _compare_cpu

bug 1076308

Change-Id: I30a6447f005e708107dc01578664a4cb2bb14439
Merge "Make resource tracker uses faster DB query" into stable/folsom
Fix Broken XML Namespace Handling

nodeName is set to ns2:metadata and not just metadata when namespaces are
specified using first example in the defect. Explicitly check namespaces
where necessary and use localName instead of nodeName.
Ensure that scheduler_hints are picked up from the correct namespace

fix lines too long from pep8

Fixes bug 887191

Change-Id: I5db2b575d24f6b1b358489e309af7e6ace2950fd
(cherry picked from commit 10caf4b48fa67b160e6024a801efbda292d44ebf)
Merge "Consistent Rollback for instance creation failures" into stable/folsom
Merge "Add call to trigger_instance[add/remove]_security_group_refresh quantum" into stable/folsom
Merge "create_db_entry_for_new_instance did not call sgh for default" into stable/folsom
Merge "Fix VM deletion from down compute node" into stable/folsom
Merge "Fixed instance deletion issue from Nova API." into stable/folsom
Merge " fix deletion of LVM backed instances" into stable/folsom
Merge "Fix reserve_block_device_name while attach volume" into stable/folsom
Use disk image path to setup lxc and uml container

fix bug 1079113

Change-Id: I9b9b10e77728d4d7863f49efc048c8a37b06953b