When we create a clone volume, LVMVolumeDriver will firstly create a temp
snapshot for copying, the temp snapshot name is
"clone-snap-%s" % source_volume['id']. When we create multiple clone volumes
of the same volume simultaneously, which would trigger the race issuse.
I changes the temp snapshot name template to "clone-snap-%s" % volume['id'],
so temp snapshot name will be unique.
Fixes bug #
1202139
Change-Id: I3a4f2585ea9e6f70b6f6f9889e900f19559b8176
"""Creates a clone of the specified volume."""
LOG.info(_('Creating clone of volume: %s') % src_vref['id'])
volume_name = CONF.volume_name_template % src_vref['id']
- temp_id = 'tmp-snap-%s' % src_vref['id']
+ temp_id = 'tmp-snap-%s' % volume['id']
temp_snapshot = {'volume_name': volume_name,
'size': src_vref['size'],
'volume_size': src_vref['size'],
- 'name': 'clone-snap-%s' % src_vref['id'],
+ 'name': 'clone-snap-%s' % volume['id'],
'id': temp_id}
self.create_snapshot(temp_snapshot)
self._create_volume(volume['name'], self._sizestr(volume['size']))