Move create_cloned_volume() to LVMVolumeDriver.

The implementation of create_cloned_volume() that was in driver.py
relied on functions that aren't declared there, such as
_create_volume(), _copy_volume(), and _sizestr().  Moved the function
to LVMVolumeDriver in lvm.py, where those functions exist.

Change-Id: I5ab77a119b3af0a152a3b5e0c2ff6a5ce196ad0f
Fixes: bug #1112485
This commit is contained in:
Avishay Traeger
2013-02-07 11:11:03 +02:00
parent 30ba792859
commit 033d21f6f0
2 changed files with 18 additions and 14 deletions

View File

@@ -102,20 +102,7 @@ class VolumeDriver(object):
def create_cloned_volume(self, volume, src_vref):
"""Creates a clone of the specified volume."""
LOG.info(_('Creating clone of volume: %s') % src_vref['id'])
volume_name = FLAGS.volume_name_template % src_vref['id']
temp_snapshot = {'volume_name': volume_name,
'size': src_vref['size'],
'volume_size': src_vref['size'],
'name': 'clone-snap-%s' % src_vref['id']}
self.create_snapshot(temp_snapshot)
self._create_volume(volume['name'], self._sizestr(volume['size']))
try:
self._copy_volume(self.local_path(temp_snapshot),
self.local_path(volume),
src_vref['size'])
finally:
self.delete_snapshot(temp_snapshot)
raise NotImplementedError()
def delete_volume(self, volume):
"""Deletes a volume."""