VMware: fix bug with booting from volumes

When booting from a volume without an image reference would cause
an exception.

Change-Id: Ib0302197b8d4f5e054a8c4426cb0dde7cb82842e
Closes-bug: #1235022
(cherry picked from commit 026843773b71ab0ac30abb36fe9eed92f5e11f7a)
Fix getting nwinfo for Instance obj

This fixes the get_nw_info_for_instance() method in nova/compute/utils.

If an instance object has no 'info_cache' (means we lack an entry in the
instance_info_caches table for the instance), don't try to access the
'network_info' attribute.  Just return a network model with empty
networking information like the dict version of an instance would do.

Change-Id: Ib1f49f10cefeefc55a87fea69b6fbc772c978dca
Closes-bug: 1243291
(cherry picked from commit a907c2f06b65dca7c2c0ea6119fe649864c6de11)
catch exception in start and stop server api

this catches exception.InstanceIsLocked in start and stop
server api.

Closes-Bug: #1233026

Change-Id: Ibb882178ab0770837702d503ef88c6510072e33f
(cherry picked from commit aa8938d696e6e2ecf23709f748de825dc2d07fd0)
Merge "Fix getting nwinfo for Instance obj" into stable/havana
Merge "VMware: fix bug with booting from volumes" into stable/havana
ensure we don't boot oversized images

Since we can't generally shrink incoming images, add extra checks
to ensure oversized images are not allowed through.
All cases when populating the libvirt image cache are now handled,
including the initial download from glance, where we avoid
converting to raw, as that could generate non sparse images
much larger than the downloaded image.

* nova/virt/libvirt/utils.py (fetch_image): Allow passing through
of the max_size parameter.
* nova/virt/images.py (fetch_to_raw): Accept the max_size parameter,
and use it to discard images with larger (virtual) sizes.
* nova/virt/libvirt/imagebackend.py (verify_base_size): A new
refactored function to identify and raise exception to oversized images.
(Raw.create_image): Pass the max_size to the fetch function.
Also enforce virtual image size checking for already fetched images,
as this class (despite the name) can be handling qcow files.
(Qcow2.create_image): Pass the max_size to the fetch function,
or verify the virtual size for the instance as done previously.
(Lvm.create_image): Pass the max_size to the fetch function.
Also check the size before transferring to the volume to improve
efficiency by not even attempting the transfer of oversized images.
(Rbd.create_image): Likewise.
* nova/tests/virt/libvirt/fake_libvirt_utils.py: Support max_size arg.
* nova/tests/virt/libvirt/test_libvirt.py (test_fetch_raw_image):
Add a case to check oversized images are discarded.
* nova/tests/virt/libvirt/test_imagebackend.py
(test_create_image_too_small): Adjust to avoid the fetch size check.

Fixes bug: 1177830
Fixes bug: 1206081
Change-Id: I3d47adaa2ad07434853f447feb27d7aae0e2e717
Merge remote-tracking branch 'upstream/stable/havana' into stable/havana