]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Improve provider_location cleanup code for RBD.
authorAdam Gandelman <adam.gandelman@canonical.com>
Wed, 28 Nov 2012 01:51:26 +0000 (17:51 -0800)
committerAdam Gandelman <adam.gandelman@canonical.com>
Wed, 28 Nov 2012 01:52:01 +0000 (17:52 -0800)
The RBD driver does not make use of the 'provider_location' field
but the current cleanup code assumes it does.  Ensure the field
is in use before testing whether or not it needs fixing.

Fixes bug 1083818.

Change-Id: Id6ff85101f85e70575ba244c2df7aca0196cf224

cinder/volume/manager.py

index 666c147c15f0e08076e6f33eef80e66af4552211..1244f6f4be9de6086186f2791b6300c48fbac911 100644 (file)
@@ -374,7 +374,8 @@ class VolumeManager(manager.SchedulerDependentManager):
 
         # Check for https://bugs.launchpad.net/cinder/+bug/1065702
         volume_ref = self.db.volume_get(context, volume_id)
-        if volume_ref['name'] not in volume_ref['provider_location']:
+        if (volume_ref['provider_location'] and
+            volume_ref['name'] not in volume_ref['provider_location']):
             self.driver.ensure_export(context, volume_ref)
 
     def _copy_image_to_volume(self, context, volume, image_id):