Improve provider_location cleanup code for RBD.

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.

Note: Applying to stable/folsom nova-volume code.  Same fix
proposed to cinder @ https://review.openstack.org/#/c/17023/

Change-Id: I814bd253d2e850534a673985e499f8cdbcebb18e
This commit is contained in:
Adam Gandelman 2012-11-27 17:44:27 -08:00
parent b17b5e096c
commit e7877868b1
1 changed files with 2 additions and 1 deletions

View File

@ -313,7 +313,8 @@ class VolumeManager(manager.SchedulerDependentManager):
# Check for https://bugs.launchpad.net/nova/+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):