Improved logs for add/remove security group rules.

Added more details - protocol and port information to AUDIT log
messages on add/remove rule actions for security groups.

Change-Id: Ib446a63976dade90c51c13f30367a3ee17a739ea
Closes-Bug: #1154303
Remove comments and to-do for quota inconsistency

There are comments for quota inconsistency in function
_complete_deletion and considering race conditions.

_complete_deletion was called by _complete_partial_deletion
and_delete_instance only if the instance state is DELETED
compute can enter _complete_partial_deletion
while if _complete_deletion called in _delete_instance,
that means instance vm state already become DELETED

also, if the _delete_instance was called with instance
state SOFT_DELETED, the quotas.rollback() will be called
it will make quotas.commit later take no effect
since the quotas.reservations is already None

so there is no race conditions and the comments can be removed

Change-Id: Iddb9e5197ca7ca9bd4692d63bb5c7f9a2ab44be5
Partial-Bug: #1296414
Fixed many typos.

These were found using: https://github.com/intgr/topy

Change-Id: Ia4e14508c285d95ab4eaeabbde032ecc5e7c9e4b
Imported Translations from Transifex

Change-Id: I7ee83b391ff267feb43e16748b855df788d4908a
Hacking: add rule number to HACKING.rst

Commit ac8bce63f8a7ec8a2ebb214ea7f86ee4f8adecae added hacking rules
N319. This was not documented in the file HACKING.rst.

Change-Id: Ibf7917aaada88db5afe1387859a387481ec05118
Closes-bug: #1313322
Merge "Fixed many typos."
Merge "Improved logs for add/remove security group rules."
Merge "Remove comments and to-do for quota inconsistency"
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>