]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Skip check whether volume is local if it's None
authorpeter_wang <peter.wang13@emc.com>
Mon, 14 Dec 2015 03:37:41 +0000 (22:37 -0500)
committerpeter_wang <peter.wang13@emc.com>
Tue, 15 Dec 2015 08:17:16 +0000 (03:17 -0500)
When force deleting a consistency group containing volumes,
manager.py tries to extract host field to check whether the volume
is local to this cinder node before deleting the volume.

Above logic is invalid if host field of faulted volume is None.

This fix will bypass above check to allow deletion of the volume.

Change-Id: I477c80c21c0b554b69c6222fb4fb0461813ac2bb
Closes-Bug: 1524195

cinder/volume/manager.py

index d63e2360c89d0a5a061b9abca4516aa29997ec83..02e8a9bbaa159074eeac0037ddd2384223dba9f7 100644 (file)
@@ -2646,10 +2646,11 @@ class VolumeManager(manager.SchedulerDependentManager):
             # self.host is 'host@backend'
             # volume_ref['host'] is 'host@backend#pool'
             # Extract host before doing comparison
-            new_host = vol_utils.extract_host(volume_ref['host'])
-            if new_host != self.host:
-                raise exception.InvalidVolume(
-                    reason=_("Volume is not local to this node"))
+            if volume_ref['host']:
+                new_host = vol_utils.extract_host(volume_ref['host'])
+                if new_host != self.host:
+                    raise exception.InvalidVolume(
+                        reason=_("Volume is not local to this node"))
 
         self._notify_about_consistencygroup_usage(
             context, group, "delete.start")