]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Fix race condition in RemoteFS create_snapshot_online
authorJordan Pittier <jordan.pittier@scality.com>
Wed, 17 Feb 2016 18:05:49 +0000 (19:05 +0100)
committerJordan Pittier <jordan.pittier@scality.com>
Fri, 19 Feb 2016 09:49:56 +0000 (10:49 +0100)
commit94b3288fe5430061eca0f2b48ce5bab7ce376f30
tree7e6c73cfa1acb59dbd7826deb7a9ed56f067de83
parentb77835b23a53eacca93855782b883b829c37ea7b
Fix race condition in RemoteFS create_snapshot_online

There's a `while True` loop in create_snapshot_online and each
iteration can make the `cinder-volume` process sleep up to 10sec. In
the mean time, if Nova fails to create the snapshot, the snapshot
status could turn to "error" and someone could want to delete the
erroneous snapshot, which would make its status to be "deleting".

In that case the `while True` loop would never exit. Cinder consumes
100% of CPU and keeps logging "Status of snapshot XX is now deleting".

The patch fix this issue by exiting the `while True` loop if we detect
that the snapshot is to be deleted.

Closes-Bug: #1538496

Change-Id: I5de0e8479a552ce101cecd06a874a170e54d5c18
cinder/exception.py
cinder/tests/unit/test_remotefs.py
cinder/volume/drivers/remotefs.py