Skip check whether volume is local if it's None

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
This commit is contained in:
peter_wang 2015-12-13 22:37:41 -05:00
parent e7965dc323
commit fbcd43a688

View 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")