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.

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

Instead of calling disk.get_disk_size() directly from
verify_base_size(), which assumes the disk is stored locally, add a new
method that is overridden by the Rbd subclass to get the disk size.

Implements: blueprint rbd-clone-image-handler
Closes-Bug: 1226351
Co-Authored-By: Josh Durgin <josh.durgin@inktank.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>
Change-Id: I0f50659b54a92fc21086990be8925ea15008569a
Use Ceph cluster stats to report disk info on RBD

Local disk statistics on compute nodes are irrelevant when ephemeral
disks are stored in RBD. With RBD, local disk space is not consumed when
instances are started on a compute node, yet it is possible for
scheduler to refuse to schedule an instance when combined disk usage of
instances already running on the node exceeds total disk capacity
reported by the hypervisor driver.

Change-Id: I9718c727db205b6f2191f8435583391584e96e6e
Closes-bug: #1332660
Signed-off-by: Dmitry Borodaenko <dborodaenko@mirantis.com>
Live migration is broken for NFS shared storage

One of the new checks, introduced in
I2755c59b4db736151000dae351fd776d3c15ca39
is missing a check against filebased shared storage,
leading to live migration being broken.

Closes-Bug: #1346385
Change-Id: I096ecd6eadc3b13ef918ca1e6c98acdd01556c0d