Merge "HNAS: Cloned volume with different volume type"
This commit is contained in:
@@ -302,6 +302,17 @@ class HNASNFSDriverTest(test.TestCase):
|
|||||||
|
|
||||||
self.assertEqual('hnas', out['provider_location'])
|
self.assertEqual('hnas', out['provider_location'])
|
||||||
|
|
||||||
|
def test_create_cloned_volume_invalid_volume_type(self):
|
||||||
|
self.volume.volume_type_id = fake.VOLUME_TYPE_ID
|
||||||
|
self.clone.volume_type_id = fake.VOLUME_TYPE2_ID
|
||||||
|
|
||||||
|
self.mock_object(self.driver, 'extend_volume')
|
||||||
|
self.mock_object(backend.HNASSSHBackend, 'file_clone')
|
||||||
|
|
||||||
|
self.assertRaises(exception.InvalidVolumeType,
|
||||||
|
self.driver.create_cloned_volume, self.volume,
|
||||||
|
self.clone)
|
||||||
|
|
||||||
def test_get_volume_stats(self):
|
def test_get_volume_stats(self):
|
||||||
self.driver.pools = [{'pool_name': 'default',
|
self.driver.pools = [{'pool_name': 'default',
|
||||||
'service_label': 'default',
|
'service_label': 'default',
|
||||||
|
|||||||
@@ -284,6 +284,16 @@ class HNASNFSDriver(nfs.NfsDriver):
|
|||||||
:param src_vref: reference to the source volume
|
:param src_vref: reference to the source volume
|
||||||
:returns: the provider_location of the cloned volume
|
:returns: the provider_location of the cloned volume
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# HNAS always creates cloned volumes in the same pool as the source
|
||||||
|
# volumes. So, it is not allowed to use different volume types for
|
||||||
|
# clone operations.
|
||||||
|
if volume.volume_type_id != src_vref.volume_type_id:
|
||||||
|
msg = _("Source and cloned volumes should have the same "
|
||||||
|
"volume type.")
|
||||||
|
LOG.error(msg)
|
||||||
|
raise exception.InvalidVolumeType(msg)
|
||||||
|
|
||||||
vol_size = volume.size
|
vol_size = volume.size
|
||||||
src_vol_size = src_vref.size
|
src_vol_size = src_vref.size
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- Fixed HNAS bug that placed a cloned volume in the same pool as its
|
||||||
|
source, even if the clone had a different pool specification. Driver will
|
||||||
|
not allow to make clones using a different volume type anymore.
|
||||||
Reference in New Issue
Block a user