NFS: Fix for groups and cloning
Recently we merged change I43036837274a7c8dba612db53b34a6ce2cfb2f07 which adds format info support for *fs type volumes. This seems to cause issues when volume has groups or we are cloning from a bootable volume. This patch disables the format info support for volumes with groups and fixes the issue with cloning. Change-Id: I41ffedfa1abd0708c84494a0aaaa3815810102b8
This commit is contained in:
parent
a66f688992
commit
81e5a92903
|
@ -768,6 +768,7 @@ class RemoteFsSnapDriverTestCase(test.TestCase):
|
|||
mock_extend_volume.assert_called_once_with(volume_ref, volume.size)
|
||||
|
||||
@ddt.data(None, 'raw', 'qcow2')
|
||||
@mock.patch('cinder.objects.volume.Volume.save')
|
||||
@mock.patch.object(sys.modules['cinder.objects'], "Snapshot")
|
||||
@mock.patch.object(remotefs.RemoteFSSnapDriver, 'local_path')
|
||||
@mock.patch.object(remotefs.RemoteFSSnapDriver, '_snapshots_exist')
|
||||
|
@ -783,7 +784,7 @@ class RemoteFsSnapDriverTestCase(test.TestCase):
|
|||
mock_delete_snapshot, mock_create_snapshot,
|
||||
mock_validate_state, mock_extend_volume,
|
||||
mock_copy_volume_image, mock_snapshots_exist,
|
||||
mock_local_path, mock_obj_snap):
|
||||
mock_local_path, mock_obj_snap, mock_save):
|
||||
drv = self._driver
|
||||
|
||||
# prepare test
|
||||
|
|
|
@ -325,11 +325,13 @@ class RemoteFSDriver(driver.BaseVD):
|
|||
self._create_regular_file(volume_path, volume_size)
|
||||
|
||||
self._set_rw_permissions(volume_path)
|
||||
volume.admin_metadata['format'] = self.format
|
||||
# This is done here because when creating a volume from image,
|
||||
# while encountering other volume.save() method fails for non-admins
|
||||
with volume.obj_as_admin():
|
||||
volume.save()
|
||||
if not volume.consistencygroup_id and not volume.group_id:
|
||||
volume.admin_metadata['format'] = self.format
|
||||
# This is done here because when creating a volume from image,
|
||||
# while encountering other volume.save() method fails for
|
||||
# non-admins
|
||||
with volume.obj_as_admin():
|
||||
volume.save()
|
||||
|
||||
def _ensure_shares_mounted(self):
|
||||
"""Look for remote shares in the flags and mount them locally."""
|
||||
|
@ -1179,6 +1181,10 @@ class RemoteFSSnapDriverBase(RemoteFSDriver):
|
|||
if src_vref.admin_metadata and 'format' in src_vref.admin_metadata:
|
||||
volume.admin_metadata['format'] = (
|
||||
src_vref.admin_metadata['format'])
|
||||
# This is done here because when cloning from a bootable volume,
|
||||
# while encountering other volume.save() method fails
|
||||
with volume.obj_as_admin():
|
||||
volume.save()
|
||||
return {'provider_location': src_vref.provider_location}
|
||||
|
||||
def _copy_volume_image(self, src_path, dest_path):
|
||||
|
|
Loading…
Reference in New Issue