Opening stable/icehouse

Bump version to next stable release on icehouse branch, and set
defaultbranch in .gitreview for convenience.

Change-Id: I3574a26e374d563677905b2a3c98b72bf1429d2b
Fix bug detach volume fails with "KeyError" in EC2

Modified volume['instance_uuid'] to volume.get('instance_uuid'),
to avoid "KeyError", when detach a volume with "attaching" status.

Change-Id: Ic1aacab212c2a2026d18ef57ad9d77fdc6d86b47
Closes-Bug: #1280532
(cherry picked from commit fa72e49845179e29cf918e0742ef735ae868bb4c)
Don't overwrite instance object with dict in _init_instance()

If a compute service is started while it has an instance in task_state
REBOOT_STARTED or REBOOT_STARTED_HARD it will trigger an instance update
which will overwrite the instance object with an instance dict.  This
causes an AttributeError on the next line when instance.task_state is
referenced.  This seems like a simple oversight and should be switched
to using the instance.save method.

Change-Id: I44c3eab2c8821b66b0b9ef4696e56bd577ae8fed
Closes-Bug: 1309067
(cherry picked from commit b4b5254a56d808f2582784897364de1adafeb43a)
Merge "Fix bug detach volume fails with "KeyError" in EC2" into stable/icehouse
Remove unneeded call to fetch network info on shutdown

There is no reason to fetch the network_info from the network api on shutdown
since we can just pull it out of the local cache. There are probably other
places where this call to the network api call can be removed but this patch
just handles the case for shutdown.

Note: the following test was removed 'test_terminate_no_fixed_ips' as
the call to the network api is no longer done so this test would be the
same as test_terminate_no_network.

Closes-bug: #1288392

Change-Id: Ifbf751739c215e566926719f481c03e2c064163a
(cherry picked from commit c47900064f2f3b4384cfa3fd6fe21f452514fa36)
Don't explode if we fail to unplug VIFs after a failed boot

Libvirt currently attempts to unplug VIFs after destroying an
instance, which can fail if the instance was never built
properly in the first place. This patch makes it ignore errors
when trying to tear down VIFs during that cleanup. Failure
in this case would block the deletion of the instance (which
should never happen) and any real failures aren't something
we could do anything about.

Closes-bug: #1306718

Change-Id: I84a4433c3959b8f14e0259be0aa51da1654006c8
(cherry picked from commit b3225581befe14f21b909e176d0a4583b297e031)
Fix display of server group members

The previous code was failing to display the members of server
groups because it was filtering them all out.

Interestingly, the previous code passes the unit tests due to a
bug where we treat regex comparisons differently when using mysql
vs sqlite (tracked under bug 1298690).

Change-Id: I7be9c180f4284dd18cd02e510e77e3c1e3fc9925
Closes-bug: 1298494
(cherry picked from commit 8ce30b6ac7ea8d2e036a621a9904b35cb1563672)
Remove unnecessary call to fetch info_cache

The _heal_instance_info cache() always accesses instance['info_cache']
therefore we should always load the info_cache so we can avoid the extra
query to fetch it.

Change-Id: I3c2e005b98abf2a80276562cc05e88ba5ff199bc
Closes-bug: #1309239
(cherry picked from commit 5aa29b6b0a34d603e882a80cdc8e936f983b1892)
remove unneeded call to network_api on rebuild_instance

When rebuilding an instance we call the network_api and which results in
calling neutron and updating the info cache. We do not actually need to
do this as we can get the nw_info directly from the instance's info cache.

Change-Id: I2bcc2f15b1e5bb52d972098c7bc3e12f160b6feb
Closes-bug: 1294914
(cherry picked from commit 982850f0e912e1a72e501e456cb2b5ef94124ca6)
Merge "Fix display of server group members" into stable/icehouse
Merge "Remove unnecessary call to fetch info_cache" into stable/icehouse
Merge "remove unneeded call to network_api on rebuild_instance" into stable/icehouse
Merge "Remove unneeded call to fetch network info on shutdown" into stable/icehouse
Move libvirt RBD utilities to a new file

This will make it easier to share rbd-related code with
cinder and glance. Port the applicable unit tests over
from cinder.

Change-Id: I5bf08da87daf1d98f326f21cf33aba68aa830785
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Use library instead of CLI to cleanup RBD volumes

'rbd list' CLI returns error code when there are no rbd volumes, which
causes problems during live migration of VMs with RBD backed ephemeral
volumes. It's safer to use the library that only raises an exception in
case of a real problem.

The only case where rbd CLI is still justified is import, which is
needed to correctly import sparse image files.

All code related to cleanup of RBD volumes is moved to rbd_utils.py,
this fixes a yo-yo problem with single-use methods scattered across 3
different files, and minimizes impact of this fix on imports in
imagebackend and utils.

Flake8 F401 in test_libvirt.py has to be ignored since flake8 doesn't
recognize use of an imported module in a @mock.patch decorator.

Change-Id: I92cd6b16fbd93b377fe47b15d22efbbf68d02513
Signed-off-by: Dmitry Borodaenko <dborodaenko@mirantis.com>
enable cloning for rbd-backed ephemeral disks

Currently when using rbd as an image backend, nova downloads the
glance image to local disk and then copies it again into rbd. This
can be very slow for large images, and wastes bandwidth as well as
disk space.

When the glance image is stored in the same ceph cluster, the data is
being pulled out and pushed back in unnecessarily. Instead, create a
copy-on-write clone of the image. This is fast, and does not depend
on the size of the image. Instead of taking minutes, booting takes
seconds, and is not limited by the disk copy.

Add some rbd utility functions from cinder to support cloning and
let the rbd imagebackend rely on librbd instead of the rbd
command line tool for checking image existence.

Add a direct_fetch() method to the image backend, so backends like rbd
can make optimizations like this. Try to use direct_fetch() for the root
disk when it comes from an image, but fall back to fetch_to_raw() if
direct_fetch() fails.

Implements: blueprint rbd-clone-image-handler
Closes-Bug: 1226351
Change-Id: I9b77a50206d0eda709df8356faaeeba35d232f22
Co-Authored-By: Dmitry Borodaenko <dborodaenko@mirantis.com>
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Signed-off-by: Dmitry Borodaenko <dborodaenko@mirantis.com>