def search_volume(self, volume):
if uuidutils.is_uuid_like(volume):
volume = self.cinder.volumes.get(volume)
else:
try:
volume = self.cinder.volumes.find(name=volume)
except cinder_exception.NotFound:
raise exception.VolumeNotFound(volume=volume)
except cinder_exception.NoUniqueMatch:
raise exception.Conflict(_(
'Multiple cinder volumes exist with same name. '
'Please use the uuid instead.'))
return volume
评论列表
文章目录