Allow extension of volumes with snapshots for Quobyte driver
This change lifts an earlier limitation that explicitely did not extend a volume if snapshots of that volume exist. This limitation was lifted on the glusterfs driver and this change mirrors that behaviour but adds using the currently active image instead of the base file in case snapshots exist. Partial-bug: #1687048 Change-Id: I75d25f6829d41ee2569ca3eaff63627f7c3876e0
This commit is contained in:
parent
2161f4a450
commit
15eb00fc1e
@ -608,13 +608,11 @@ class QuobyteDriverTestCase(test.TestCase):
|
||||
|
||||
img_info = imageutils.QemuImgInfo(qemu_img_info_output)
|
||||
|
||||
drv.get_active_image_from_info = mock.Mock(return_value=volume['name'])
|
||||
image_utils.qemu_img_info = mock.Mock(return_value=img_info)
|
||||
image_utils.resize_image = mock.Mock()
|
||||
|
||||
drv.extend_volume(volume, 3)
|
||||
|
||||
drv.get_active_image_from_info.assert_called_once_with(volume)
|
||||
image_utils.qemu_img_info.assert_called_once_with(volume_path,
|
||||
run_as_root=False)
|
||||
image_utils.resize_image.assert_called_once_with(volume_path, 3)
|
||||
|
@ -31,7 +31,7 @@ from cinder import interface
|
||||
from cinder import utils
|
||||
from cinder.volume.drivers import remotefs as remotefs_drv
|
||||
|
||||
VERSION = '1.1.4'
|
||||
VERSION = '1.1.5'
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -84,6 +84,7 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed):
|
||||
1.1.2 - Fixes a bug in the creation of cloned volumes
|
||||
1.1.3 - Explicitely mounts Quobyte volumes w/o xattrs
|
||||
1.1.4 - Fixes capability to configure redundancy in quobyte_volume_url
|
||||
1.1.5 - Enables extension of volumes with snapshots
|
||||
|
||||
"""
|
||||
|
||||
@ -301,14 +302,6 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed):
|
||||
@utils.synchronized('quobyte', external=False)
|
||||
def extend_volume(self, volume, size_gb):
|
||||
volume_path = self.local_path(volume)
|
||||
volume_filename = os.path.basename(volume_path)
|
||||
|
||||
# Ensure no snapshots exist for the volume
|
||||
active_image = self.get_active_image_from_info(volume)
|
||||
if volume_filename != active_image:
|
||||
msg = _('Extend volume is only supported for this'
|
||||
' driver when no snapshots exist.')
|
||||
raise exception.InvalidVolume(msg)
|
||||
|
||||
info = self._qemu_img_info(volume_path, volume.name)
|
||||
backing_fmt = info.file_format
|
||||
@ -318,7 +311,10 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed):
|
||||
raise exception.InvalidVolume(msg % backing_fmt)
|
||||
|
||||
# qemu-img can resize both raw and qcow2 files
|
||||
image_utils.resize_image(volume_path, size_gb)
|
||||
active_path = os.path.join(
|
||||
self._get_mount_point_for_share(volume.provider_location),
|
||||
self.get_active_image_from_info(volume))
|
||||
image_utils.resize_image(active_path, size_gb)
|
||||
|
||||
def _do_create_volume(self, volume):
|
||||
"""Create a volume on given Quobyte volume.
|
||||
|
Loading…
Reference in New Issue
Block a user