Remove usage of locals() for formatting from cinder.volume.*

Using of locals() for formatting string is a nasty thing because:
1) It is not so clear as using explicit dicts
2) It could produce hidden errors during refactoring
3) Changing name of variable causes change in message
4) Creating a lot of unused variables

Fix bug 1171936

Change-Id: I806c530851527db9da251352be45b97c183241a8
This commit is contained in:
Haomai Wang 2013-06-16 13:21:20 +08:00
parent 0e249f4b9a
commit a80003cd49
10 changed files with 123 additions and 96 deletions

View File

@ -943,7 +943,8 @@ class EMCSMISCommon():
ecomPort = ecomPorts[0].toxml().replace('<EcomServerPort>', '')
ecomPort = ecomPort.replace('</EcomServerPort>', '')
if ecomIp is not None and ecomPort is not None:
LOG.debug(_("Ecom IP: %(ecomIp)s Port: %(ecomPort)s") % (locals()))
LOG.debug(_("Ecom IP: %(ecomIp)s Port: %(ecomPort)s"),
{'ecomIp': ecomIp, 'ecomPort': ecomPort})
return ecomIp, ecomPort
else:
LOG.debug(_("Ecom server not found."))

View File

@ -67,7 +67,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
raise exception.GlusterfsException(msg)
if not os.path.exists(config):
msg = (_("Gluster config file at %(config)s doesn't exist") %
locals())
{'config': config})
LOG.warn(msg)
raise exception.GlusterfsException(msg)

View File

@ -122,10 +122,9 @@ class NetAppISCSIDriver(driver.ISCSIDriver):
def _check_fail(self, request, response):
"""Utility routine to handle checking ZAPI failures."""
if 'failed' == response.Status:
name = request.Name
reason = response.Reason
msg = _('API %(name)s failed: %(reason)s')
raise exception.VolumeBackendAPIException(data=msg % locals())
msg_fmt = {'name': request.Name, 'reason': response.Reason}
raise exception.VolumeBackendAPIException(msg % msg_fmt)
def _create_client(self, **kwargs):
"""Instantiate a web services client.
@ -281,10 +280,10 @@ class NetAppISCSIDriver(driver.ISCSIDriver):
project, type)
self.discovered_datasets.append(ds)
self._discover_dataset_luns(ds, None)
dataset_count = len(self.discovered_datasets)
lun_count = len(self.discovered_luns)
msg = _("Discovered %(dataset_count)s datasets and %(lun_count)s LUNs")
LOG.debug(msg % locals())
msg = (_("Discovered %(dataset_count)s datasets and %(lun_count)s"
"LUNs") % {'dataset_count': len(self.discovered_datasets),
'lun_count': len(self.discovered_luns)})
LOG.debug(msg)
self.lun_table = {}
def _get_job_progress(self, job_id):
@ -464,8 +463,8 @@ class NetAppISCSIDriver(driver.ISCSIDriver):
lun = self._lookup_lun_for_volume(name, project)
lun_details = self._get_lun_details(lun.id)
except exception.VolumeBackendAPIException:
msg = _("No entry in LUN table for volume %(name)s.")
LOG.debug(msg % locals())
LOG.debug(_("No entry in LUN table for volume %(name)s."),
{'name': name})
return
member = self.client.factory.create('DatasetMemberParameter')
@ -1045,7 +1044,8 @@ class NetAppISCSIDriver(driver.ISCSIDriver):
if vol_size != snap_size:
msg = _('Cannot create volume of size %(vol_size)s from '
'snapshot of size %(snap_size)s')
raise exception.VolumeBackendAPIException(data=msg % locals())
msg_fmt = {'vol_size': vol_size, 'snap_size': snap_size}
raise exception.VolumeBackendAPIException(msg % msg_fmt)
vol_name = snapshot['volume_name']
snapshot_name = snapshot['name']
project = snapshot['project_id']
@ -1057,7 +1057,8 @@ class NetAppISCSIDriver(driver.ISCSIDriver):
if new_type != old_type:
msg = _('Cannot create volume of type %(new_type)s from '
'snapshot of type %(old_type)s')
raise exception.VolumeBackendAPIException(data=msg % locals())
msg_fmt = {'vol_size': vol_size, 'snap_size': snap_size}
raise exception.VolumeBackendAPIException(msg % msg_fmt)
lun = self._get_lun_details(lun_id)
extra_gb = vol_size
new_size = '+%dg' % extra_gb
@ -1078,7 +1079,8 @@ class NetAppISCSIDriver(driver.ISCSIDriver):
if vol_size != src_vol_size:
msg = _('Cannot create clone of size %(vol_size)s from '
'volume of size %(src_vol_size)s')
raise exception.VolumeBackendAPIException(data=msg % locals())
msg_fmt = {'vol_size': vol_size, 'src_vol_size': src_vol_size}
raise exception.VolumeBackendAPIException(msg % msg_fmt)
src_vol_name = src_vref['name']
project = src_vref['project_id']
lun = self._lookup_lun_for_volume(src_vol_name, project)
@ -1087,9 +1089,10 @@ class NetAppISCSIDriver(driver.ISCSIDriver):
old_type = dataset.type
new_type = self._get_ss_type(volume)
if new_type != old_type:
msg = _('Cannot create clone of type %(new_type)s from '
'volume of type %(old_type)s')
raise exception.VolumeBackendAPIException(data=msg % locals())
msg = (_('Cannot create clone of type %(new_type)s from '
'volume of type %(old_type)s') %
{'new_type': new_type, 'old_type': old_type})
raise exception.VolumeBackendAPIException(data=msg)
lun = self._get_lun_details(lun_id)
extra_gb = vol_size
new_size = '+%dg' % extra_gb
@ -1144,8 +1147,9 @@ class NetAppLun(object):
if prop in self.metadata:
return self.metadata[prop]
name = self.name
msg = _("No metadata property %(prop)s defined for the LUN %(name)s")
LOG.debug(msg % locals())
msg = _("No metadata property %(prop)s defined for the LUN "
"%(name)s") % {'prop': prop, 'name': name}
LOG.debug(msg)
def __str__(self, *args, **kwargs):
return 'NetApp Lun[handle:%s, name:%s, size:%s, metadata:%s]'\
@ -1251,8 +1255,8 @@ class NetAppCmodeISCSIDriver(driver.ISCSIDriver):
name = volume['name']
handle = self._get_lun_handle(name)
if not handle:
msg = _("No entry in LUN table for volume %(name)s.")
LOG.warn(msg % locals())
LOG.warn(_("No entry in LUN table for volume %(name)s."),
{'name': name})
return
self.client.service.DestroyLun(Handle=handle)
LOG.debug(_("Destroyed LUN %s") % handle)
@ -1292,16 +1296,17 @@ class NetAppCmodeISCSIDriver(driver.ISCSIDriver):
server = self.client.service
server.MapLun(Handle=handle, InitiatorType="iscsi",
InitiatorName=initiator_name)
msg = _("Mapped LUN %(handle)s to the initiator %(initiator_name)s")
LOG.debug(msg % locals())
LOG.debug(_("Mapped LUN %(handle)s to the initiator "
"%(initiator_name)s"),
{'handle': handle, 'initiator_name': initiator_name})
target_details_list = server.GetLunTargetDetails(
Handle=handle,
InitiatorType="iscsi",
InitiatorName=initiator_name)
msg = _("Succesfully fetched target details for LUN %(handle)s and "
"initiator %(initiator_name)s")
LOG.debug(msg % locals())
LOG.debug(_("Succesfully fetched target details for LUN %(handle)s and"
" initiator %(initiator_name)s"),
{'handle': handle, 'initiator_name': initiator_name})
if not target_details_list:
msg = _('Failed to get LUN target details for the LUN %s')
@ -1346,8 +1351,9 @@ class NetAppCmodeISCSIDriver(driver.ISCSIDriver):
self.client.service.UnmapLun(Handle=handle, InitiatorType="iscsi",
InitiatorName=initiator_name)
msg = _("Unmapped LUN %(handle)s from the initiator "
"%(initiator_name)s")
LOG.debug(msg % locals())
"%(initiator_name)s") % {'handle': handle,
'initiator_name': initiator_name}
LOG.debug(msg)
def create_snapshot(self, snapshot):
"""Driver entry point for creating a snapshot.
@ -1366,8 +1372,8 @@ class NetAppCmodeISCSIDriver(driver.ISCSIDriver):
name = snapshot['name']
handle = self._get_lun_handle(name)
if not handle:
msg = _("No entry in LUN table for snapshot %(name)s.")
LOG.warn(msg % locals())
LOG.warn(_("No entry in LUN table for snapshot %(name)s."),
{'name': name})
return
self.client.service.DestroyLun(Handle=handle)
LOG.debug(_("Destroyed LUN %s") % handle)
@ -1384,7 +1390,8 @@ class NetAppCmodeISCSIDriver(driver.ISCSIDriver):
if vol_size != snap_size:
msg = _('Cannot create volume of size %(vol_size)s from '
'snapshot of size %(snap_size)s')
raise exception.VolumeBackendAPIException(data=msg % locals())
msg_fmt = {'vol_size': vol_size, 'snap_size': snap_size}
raise exception.VolumeBackendAPIException(msg % msg_fmt)
snapshot_name = snapshot['name']
lun = self.lun_table[snapshot_name]
new_name = volume['name']
@ -1461,7 +1468,8 @@ class NetAppCmodeISCSIDriver(driver.ISCSIDriver):
if vol_size != src_vol_size:
msg = _('Cannot clone volume of size %(vol_size)s from '
'src volume of size %(src_vol_size)s')
raise exception.VolumeBackendAPIException(data=msg % locals())
msg_fmt = {'vol_size': vol_size, 'src_vol_size': src_vol_size}
raise exception.VolumeBackendAPIException(msg % msg_fmt)
new_name = volume['name']
extra_args = {}
extra_args['OsType'] = 'linux'
@ -1586,8 +1594,8 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
name = volume['name']
metadata = self._get_lun_attr(name, 'metadata')
if not metadata:
msg = _("No entry in LUN table for volume/snapshot %(name)s.")
LOG.warn(msg % locals())
LOG.warn(_("No entry in LUN table for volume/snapshot %(name)s."),
{'name': name})
return
lun_destroy = NaElement.create_node_with_children(
'lun-destroy',
@ -1629,13 +1637,15 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
initiator_name = connector['initiator']
name = volume['name']
lun_id = self._map_lun(name, initiator_name, 'iscsi', None)
msg = _("Mapped LUN %(name)s to the initiator %(initiator_name)s")
LOG.debug(msg % locals())
msg = (_("Mapped LUN %(name)s to the initiator %(initiator_name)s") %
{'name': name, 'initiator_name': initiator_name})
LOG.debug(msg)
iqn = self._get_iscsi_service_details()
target_details_list = self._get_target_details()
msg = _("Succesfully fetched target details for LUN %(name)s and "
"initiator %(initiator_name)s")
LOG.debug(msg % locals())
msg = (_("Succesfully fetched target details for LUN %(name)s and "
"initiator %(initiator_name)s") %
{'name': name, 'initiator_name': initiator_name})
LOG.debug(msg)
if not target_details_list:
msg = _('Failed to get LUN target details for the LUN %s')
@ -1700,9 +1710,10 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
vol_size = volume['size']
snap_size = snapshot['volume_size']
if vol_size != snap_size:
msg = _('Cannot create volume of size %(vol_size)s from '
'snapshot of size %(snap_size)s')
raise exception.VolumeBackendAPIException(data=msg % locals())
msg = (_('Cannot create volume of size %(vol_size)s from '
'snapshot of size %(snap_size)s') %
{'vol_size': vol_size, 'snap_size': snap_size})
raise exception.VolumeBackendAPIException(data=msg)
snapshot_name = snapshot['name']
new_name = volume['name']
self._clone_lun(snapshot_name, new_name, 'true')
@ -1718,9 +1729,10 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
metadata = self._get_lun_attr(name, 'metadata')
path = metadata['Path']
self._unmap_lun(path, initiator_name)
msg = _("Unmapped LUN %(name)s from the initiator "
"%(initiator_name)s")
LOG.debug(msg % locals())
msg = (_("Unmapped LUN %(name)s from the initiator "
"%(initiator_name)s") %
{'name': name, 'initiator_name': initiator_name})
LOG.debug(msg)
def _get_ontapi_version(self):
"""Gets the supported ontapi version."""
@ -1810,10 +1822,10 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
result = self.client.invoke_successfully(lun_map, True)
return result.get_child_content('lun-id-assigned')
except NaApiError as e:
code = e.code
message = e.message
msg = _('Error mapping lun. Code :%(code)s, Message:%(message)s')
LOG.warn(msg % locals())
msg = (_("Error mapping lun. Code :%(code)s,"
" Message:%(message)s") %
{'code': e.code, 'message': e.message})
LOG.warn(msg)
(igroup, lun_id) = self._find_mapped_lun_igroup(path, initiator)
if lun_id is not None:
return lun_id
@ -1830,10 +1842,10 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
try:
self.client.invoke_successfully(lun_unmap, True)
except NaApiError as e:
msg = _("Error unmapping lun. Code :%(code)s, Message:%(message)s")
code = e.code
message = e.message
LOG.warn(msg % locals())
msg = (_("Error unmapping lun. Code :%(code)s,"
" Message:%(message)s") %
{'code': e.code, 'message': e.message})
LOG.warn(msg)
# if the lun is already unmapped
if e.code == '13115' or e.code == '9016':
pass
@ -1937,9 +1949,10 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
src_vol = self.lun_table[src_vref['name']]
src_vol_size = src_vref['size']
if vol_size != src_vol_size:
msg = _('Cannot clone volume of size %(vol_size)s from '
'src volume of size %(src_vol_size)s')
raise exception.VolumeBackendAPIException(data=msg % locals())
msg = (_("Cannot clone volume of size %(vol_size)s from "
"src volume of size %(src_vol_size)s") %
{'vol_size': vol_size, 'src_vol_size': src_vol_size})
raise exception.VolumeBackendAPIException(data=msg)
new_name = volume['name']
self._clone_lun(src_vol.name, new_name, 'true')
@ -2379,7 +2392,7 @@ class NetAppDirect7modeISCSIDriver(NetAppDirectISCSIDriver):
lun_list.extend(luns)
except NaApiError:
LOG.warn(_("Error finding luns for volume %(vol)s."
" Verify volume exists.") % locals())
" Verify volume exists."), {'vol': vol})
else:
luns = self._get_vol_luns(None)
lun_list.extend(luns)
@ -2483,10 +2496,12 @@ class NetAppDirect7modeISCSIDriver(NetAppDirectISCSIDriver):
if clone_ops_info.get_child_content('clone-state')\
== 'completed':
LOG.debug(_("Clone operation with src %(name)s"
" and dest %(new_name)s completed") % locals())
" and dest %(new_name)s completed"),
{'name': name, 'new_name': new_name})
else:
LOG.debug(_("Clone operation with src %(name)s"
" and dest %(new_name)s failed") % locals())
" and dest %(new_name)s failed"),
{'name': name, 'new_name': new_name})
raise NaApiError(
clone_ops_info.get_child_content('error'),
clone_ops_info.get_child_content('reason'))

View File

@ -75,9 +75,10 @@ class NetAppNFSDriver(nfs.NfsDriver):
snap_size = snapshot.volume_size
if vol_size != snap_size:
msg = _('Cannot create volume of size %(vol_size)s from '
'snapshot of size %(snap_size)s')
raise exception.CinderException(msg % locals())
msg = (_('Cannot create volume of size %(vol_size)s from '
'snapshot of size %(snap_size)s') %
{'vol_size': vol_size, 'snap_size': snap_size})
raise exception.CinderException(msg)
self._clone_volume(snapshot.name, volume.name, snapshot.volume_id)
share = self._get_volume_location(snapshot.volume_id)
@ -274,9 +275,10 @@ class NetAppNFSDriver(nfs.NfsDriver):
src_vol_size = src_vref.size
if vol_size != src_vol_size:
msg = _('Cannot create clone of size %(vol_size)s from '
'volume of size %(src_vol_size)s')
raise exception.CinderException(msg % locals())
msg = (_('Cannot create clone of size %(vol_size)s from '
'volume of size %(src_vol_size)s') %
{'vol_size': vol_size, 'src_vol_size': src_vol_size})
raise exception.CinderException(msg)
self._clone_volume(src_vref.name, volume.name, src_vref.id)
share = self._get_volume_location(src_vref.id)
@ -313,9 +315,11 @@ class NetAppCmodeNfsDriver (NetAppNFSDriver):
"""Clones mounted volume with NetApp Cloud Services."""
host_ip = self._get_host_ip(volume_id)
export_path = self._get_export_path(volume_id)
LOG.debug(_("""Cloning with params ip %(host_ip)s, exp_path
%(export_path)s, vol %(volume_name)s,
clone_name %(clone_name)s""") % locals())
LOG.debug(_("Cloning with params ip %(host_ip)s, exp_path"
"%(export_path)s, vol %(volume_name)s, "
"clone_name %(clone_name)s"),
{'host_ip': host_ip, 'export_path': export_path,
'volume_name': volume_name, 'clone_name': clone_name})
self._client.service.CloneNasFile(host_ip, export_path,
volume_name, clone_name)
@ -488,15 +492,17 @@ class NetAppDirectCmodeNfsDriver (NetAppDirectNfsDriver):
vols = attr_list.get_children()
vol_id = vols[0].get_child_by_name('volume-id-attributes')
return vol_id.get_child_content('name')
raise exception.NotFound(_("""No volume on cluster with vserver
%(vserver)s and junction path %(junction)s
""") % locals())
raise exception.NotFound(_("No volume on cluster with vserver"
"%(vserver)s and junction path "
"%(junction)s"), {'vserver': vserver,
'junction': junction})
def _clone_file(self, volume, src_path, dest_path, vserver=None):
"""Clones file on vserver."""
LOG.debug(_("""Cloning with params volume %(volume)s,src %(src_path)s,
dest %(dest_path)s, vserver %(vserver)s""")
% locals())
LOG.debug(_("Cloning with params volume %(volume)s,src %(src_path)s,"
"dest %(dest_path)s, vserver %(vserver)s"),
{'volume': volume, 'src_path': src_path,
'dest_path': dest_path, 'vserver': vserver})
clone_create = NaElement.create_node_with_children(
'clone-create',
**{'volume': volume, 'source-path': src_path,
@ -556,8 +562,8 @@ class NetAppDirect7modeNfsDriver (NetAppDirectNfsDriver):
:returns: clone-id
"""
LOG.debug(_("""Cloning with src %(src_path)s, dest %(dest_path)s""")
% locals())
LOG.debug(_("Cloning with src %(src_path)s, dest %(dest_path)s"),
{'src_path': src_path, 'dest_path': dest_path})
clone_start = NaElement.create_node_with_children(
'clone-start',
**{'source-path': src_path,

View File

@ -201,7 +201,8 @@ class NfsDriver(RemoteFsDriver):
LOG.warn(msg)
raise exception.NfsException(msg)
if not os.path.exists(config):
msg = _("NFS config file at %(config)s doesn't exist") % locals()
msg = (_("NFS config file at %(config)s doesn't exist") %
{'config': config})
LOG.warn(msg)
raise exception.NfsException(msg)
if not self.configuration.nfs_oversub_ratio > 0:

View File

@ -309,9 +309,10 @@ exit
except Exception as e:
LOG.error(e)
greenthread.sleep(randint(20, 500) / 100.0)
raise paramiko.SSHException(_("SSH Command failed after "
"'%(total_attempts)r' attempts"
": '%(command)s'"), locals())
msg = (_("SSH Command failed after '%(total_attempts)r' "
"attempts : '%(command)s'") %
{'total_attempts': total_attempts, 'command': command})
raise paramiko.SSHException(msg)
except Exception as e:
LOG.error(_("Error running ssh command: %s") % command)
raise e

View File

@ -79,7 +79,7 @@ class HpSanISCSIDriver(SanISCSIDriver):
if response_node is None:
msg = (_("Malformed response to CLIQ command "
"%(verb)s %(cliq_args)s. Result=%(out)s") %
locals())
{'verb': verb, 'cliq_args': cliq_args, 'out': out})
raise exception.VolumeBackendAPIException(data=msg)
result_code = response_node.attrib.get("result")
@ -87,7 +87,7 @@ class HpSanISCSIDriver(SanISCSIDriver):
if result_code != "0":
msg = (_("Error running CLIQ command %(verb)s %(cliq_args)s. "
" Result=%(out)s") %
locals())
{'verb': verb, 'cliq_args': cliq_args, 'out': out})
raise exception.VolumeBackendAPIException(data=msg)
return result_xml
@ -117,7 +117,7 @@ class HpSanISCSIDriver(SanISCSIDriver):
_xml = etree.tostring(cluster_xml)
msg = (_("Unexpected number of virtual ips for cluster "
" %(cluster_name)s. Result=%(_xml)s") %
locals())
{'cluster_name': cluster_name, '_xml': _xml})
raise exception.VolumeBackendAPIException(data=msg)
def _cliq_get_volume_info(self, volume_name):
@ -169,7 +169,8 @@ class HpSanISCSIDriver(SanISCSIDriver):
volume_attributes["permission." + k] = v
LOG.debug(_("Volume info: %(volume_name)s => %(volume_attributes)s") %
locals())
{'volume_name': volume_name,
'volume_attributes': volume_attributes})
return volume_attributes
def create_volume(self, volume):

View File

@ -173,7 +173,7 @@ class SolarisISCSIDriver(SanISCSIDriver):
return luid
msg = _('LUID not found for %(zfs_poolname)s. '
'Output=%(out)s') % locals()
'Output=%(out)s') % {'zfs_poolname': zfs_poolname, 'out': out}
raise exception.VolumeBackendAPIException(data=msg)
def _is_lu_created(self, volume):

View File

@ -215,8 +215,8 @@ class ZadaraVPSAConnection(object):
self.ensure_connection(cmd)
(method, url, body) = self._generate_vpsa_cmd(cmd, **kwargs)
LOG.debug(_('Sending %(method)s to %(url)s. Body "%(body)s"')
% locals())
LOG.debug(_('Sending %(method)s to %(url)s. Body "%(body)s"'),
{'method': method, 'url': url, 'body': body})
if self.use_ssl:
connection = httplib.HTTPSConnection(self.host, self.port)
@ -237,7 +237,7 @@ class ZadaraVPSAConnection(object):
raise exception.FailedCmdWithDump(status=status, data=data)
if method in ['POST', 'DELETE']:
LOG.debug(_('Operation completed. %(data)s') % locals())
LOG.debug(_('Operation completed. %(data)s'), {'data': data})
return xml_tree
@ -348,7 +348,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
vpsa_vol = self._get_vpsa_volume_name(name)
if not vpsa_vol:
msg = _('Volume %(name)s could not be found. '
'It might be already deleted') % locals()
'It might be already deleted') % {'name': name}
LOG.warning(msg)
if CONF.zadara_vpsa_allow_nonexistent_delete:
return
@ -444,7 +444,8 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
properties['auth_username'] = ctrl['chap_user']
properties['auth_password'] = ctrl['chap_passwd']
LOG.debug(_('Attach properties: %(properties)s') % locals())
LOG.debug(_('Attach properties: %(properties)s'),
{'properties': properties})
return {'driver_volume_type': 'iscsi',
'data': properties}

View File

@ -214,10 +214,10 @@ class VolumeManager(manager.SchedulerDependentManager):
cloned = False
try:
vol_name = volume_ref['name']
vol_size = volume_ref['size']
LOG.debug(_("volume %(vol_name)s: creating lv of"
" size %(vol_size)sG") % locals())
" size %(vol_size)sG"),
{'vol_name': volume_ref['name'],
'vol_size': volume_ref['size']})
snapshot_ref = None
sourcevol_ref = None
image_service = None
@ -468,8 +468,8 @@ class VolumeManager(manager.SchedulerDependentManager):
context, snapshot_ref, "create.start")
try:
snap_name = snapshot_ref['name']
LOG.debug(_("snapshot %(snap_name)s: creating") % locals())
LOG.debug(_("snapshot %(snap_name)s: creating"),
{'snap_name': snapshot_ref['name']})
model_update = self.driver.create_snapshot(snapshot_ref)
if model_update:
self.db.snapshot_update(context, snapshot_ref['id'],
@ -644,7 +644,8 @@ class VolumeManager(manager.SchedulerDependentManager):
self.driver.copy_volume_to_image(context, volume, image_service,
image_meta)
LOG.debug(_("Uploaded volume %(volume_id)s to "
"image (%(image_id)s) successfully") % locals())
"image (%(image_id)s) successfully"),
{'volume_id': volume_id, 'image_id': image_id})
except Exception as error:
with excutils.save_and_reraise_exception():
payload['message'] = unicode(error)