From 4f24979b3fe0940c1292099fc88b40f878ed7b5a Mon Sep 17 00:00:00 2001 From: ChiZhang Date: Mon, 19 Jan 2015 09:41:35 +0800 Subject: [PATCH] refresh cinder proxy Change-Id: I0d72486927914482ab9c9c477263ad132a759697 --- cinderproxy/cinder/volume/cinder_proxy.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cinderproxy/cinder/volume/cinder_proxy.py b/cinderproxy/cinder/volume/cinder_proxy.py index f7ca842..c16530e 100644 --- a/cinderproxy/cinder/volume/cinder_proxy.py +++ b/cinderproxy/cinder/volume/cinder_proxy.py @@ -400,14 +400,16 @@ class CinderProxy(manager.SchedulerDependentManager): cascaded_snapshot_id = None if snapshot_id is not None: cascaded_snapshot_id = \ - self.volumes_mapping_cache['volumes'].get(snapshot_id, '') + self.volumes_mapping_cache['snapshots'].get(snapshot_id, + None) LOG.info(_('cascade ino: create volume from snapshot, ' 'cascade id:%s'), cascaded_snapshot_id) cascaded_source_volid = None if source_volid is not None: cascaded_source_volid = \ - self.volumes_mapping_cache['volumes'].get(volume_id, '') + self.volumes_mapping_cache['volumes'].get(source_volid, + None) LOG.info(_('cascade ino: create volume from source volume, ' 'cascade id:%s'), cascaded_source_volid) @@ -764,7 +766,11 @@ class CinderProxy(manager.SchedulerDependentManager): # vol_ref = self.db.volume_get(context, volume_id) # caecaded_volume_id = vol_ref['mapping_uuid'] cascaded_volume_id = \ - self.volumes_mapping_cache['volumes'].get(volume_id, '') + self.volumes_mapping_cache['volumes'].get(volume_id, None) + if cascaded_volume_id is None: + LOG.error(_("cascade info: physical volume for vol %s " + "not found !"), volume_id) + return LOG.info(_('cascade ino: prepare to delete cascaded volume %s.'), cascaded_volume_id)