VNC Token Validation

Force console auth service to flush all tokens
associated with an instance when it is deleted.
This will fix a bug where the console for the
wrong instance can be connected to via the console
if the correct circumstances occur. This change also
makes a call to veriry vnc console tokens when a
user attempts to connect to a console. This ensures
the user is connecting to the correct console.

bug 1125378
Change-Id: I0d83ec6c4dbfef1af912a200ee15f8052f72da96
remove intermediate libvirt downloaded images

* nova/virt/images.py (fetch_to_raw): When converting a downloaded
image to raw, ensure we delete the original download image.
I.E. the .part file.  The regression was introduced in 7c265343.
* nova/tests/test_libvirt.py (test_fetch_raw_image): A new test
for this function which wasn't tested previously.

Conflicts:

	nova/tests/test_libvirt.py
	nova/virt/images.py

Fixes bug: 1125068
Change-Id: Ie6f2cff1a554b8500fd66f0832566ae1b317be40
(cherry picked from commit 1501a4e4f75efb63385a1dadc728c2ef245bf7de)
Merge "remove intermediate libvirt downloaded images" into stable/folsom
Merge "VNC Token Validation" into stable/folsom
Create util for root device path retrieval

blueprint snapshots-for-everyone

Create libvirt.utils.find_disk(virt_dom) function.
This function will retrieve disk path from instance configuration.
Will return path both for file and device backed instance root devices.
Will throw error in case, when device can't be found.

Change-Id: I612a19221c6ff78079ab53a8d77295c555514c77
Add util for disk type retrieval

blueprint snapshots-for-everyone

Add libvirt.utils.get_disk_type that retrieves format
for given file. Format can be raw, qcow2, or lvm.

Change-Id: I33898983cfa15db6b2654648ce32f72b6dd920cb
Integrate nova-network into Piston networking model.
Add util for image conversion

blueprint snapshots-for-everyone

Add nova.virt.images.convert_image(source, dest, format)
that converts image to other format using qemu-img convert

Change-Id: I2c92cb31114c42717d0ddd011645dc7c661c82c6
Fixes bug Snapshotting LXC instance fails

Fixes bug 1058273.

The path of the disk for snapshotting LXC instance is debugged.
Also, virt_dom.managedSave(0) and self._create_domain(domain=virt_dom)
are not called for LXC instance, because they are supported by libvirt.

Change-Id: Idf8275a0222b2eb289e16dd245f7721e17fce21d
(cherry picked from commit b60646965de26974f8a8b81f6e43b72a6c8d44f5)
Implement snapshots for raw backend

blueprint snapshots-for-everyone

Use simple qemu-img convert for raw snapshots.
Polymorphically select snapshot behavior for
raw and qcow2.
Allow images to be constructed from actual device/file path.

Change-Id: I6a57e43c6775c144c41a53382dcc7504ce6d4c43
Simplify libvirt snapshot code path

The "cold" snapshot code path was unnecessarily complex. We were
traversing 3 layers of abstraction to reach 3 lines of code. I've
completely eliminated snapshot.py by moving all "cold" snapshot
functions into imagebackend.py and adjusting the libvirt driver
accordingly. This is the first pass of several I intend to make
against imagebackend.py, as it is far too difficult to read given
how basic the basic level of functionality it is intended to
provide.

Change-Id: Idfacffb7210ae61193ee4f2360d4b38f330a177c
Properly write non-raw LVM images on creation

Fixes bug 1075333

When force_raw_images=False and libvirt_images_type=lvm were set
together, selecting anything other than a RAW image would result in
an unbootable instance. This is because the downloaded image was
being directly dd'd onto the new LVM root, which will obviously not
work for any format other than RAW.

Simple change to use qemu-img to read from the image (letting it
decide the format) and write to the LVM root as raw.

Change-Id: I36494e6d0671c07f7511c10ef886c8cf84c18df7
Libvirt: Implement snapshots for LVM-backed roots

Uses the built-in LVM snapshotting mechanism to create a new
snapshot, use qemu-img to extract the full root into an image file,
then delete the snapshot volume. Although we typically zero deleted
LVM volumes manually, this is not necessary for snapshots, as LVM
handles it for us (per the documentation).

Change-Id: I82f21488671ffa3be3d0feba73ff631fa2a51ec0
Fixes: Bug 1120809
Flags: DocImpact
Libvirt: Add support for live snapshots

blueprint libvirt-live-snapshots

Implements support for live snapshots when QEMU 1.3 and Libvirt
1.0.0 are available. This implementation may function with other
hypervisors, at which point _check_use_live_snapshots can be
adjusted accordingly.

At a high level, the process is as follows. First we create a
destination file for the snapshot. This file uses the same backing
file as the origin disk and is of the same virtual size. We do this
since the combination of blockRebase and "shallow" copies are the
only bug-free method available as of QEMU 1.3 (Vish has submitted
patches upstream). This process ultimately produces a CoW file,
representing only the current delta between the root disk and
backing file. The final step converts the CoW delta to a backless
image matching the format of the origin disk.

Flags: DocImpact
Change-Id: Icba53336556295722c3f8b7345e6cd09d8ccfed9
Folsom uses FLAGS.
Remove lingering update_task_state.
Added fileutils requirement.
Folsom doesn't use instance['name'].
Fix incorrect function call.
Revert to older way of looking up path.