"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cinder/tests/unit/volume/drivers/test_nfs.py" between
cinder-17.0.1.tar.gz and cinder-17.1.0.tar.gz

About: OpenStack Cinder (Core Service: Block Storage) provides persistent block storage to running instances. Its pluggable driver architecture facilitates the creation and management of block storage devices.
The "Victoria" series (latest release).

test_nfs.py  (cinder-17.0.1):test_nfs.py  (cinder-17.1.0)
skipping to change at line 1353 skipping to change at line 1353
src_vol_path, dest_vol_path, 'luks', src_vol_path, dest_vol_path, 'luks',
passphrase_file='/tmp/passfile', passphrase_file='/tmp/passfile',
run_as_root=True, run_as_root=True,
src_passphrase_file='/tmp/imgfile') src_passphrase_file='/tmp/imgfile')
else: else:
mock_convert_image.assert_called_once_with( mock_convert_image.assert_called_once_with(
src_vol_path, dest_vol_path, 'qcow2' if used_qcow else 'raw', src_vol_path, dest_vol_path, 'qcow2' if used_qcow else 'raw',
run_as_root=True) run_as_root=True)
mock_permission.assert_called_once_with(dest_vol_path) mock_permission.assert_called_once_with(dest_vol_path)
@ddt.data([NFS_CONFIG1, QEMU_IMG_INFO_OUT3], @ddt.data([NFS_CONFIG1, QEMU_IMG_INFO_OUT3, 'available'],
[NFS_CONFIG2, QEMU_IMG_INFO_OUT4], [NFS_CONFIG2, QEMU_IMG_INFO_OUT4, 'backing-up'],
[NFS_CONFIG3, QEMU_IMG_INFO_OUT3], [NFS_CONFIG3, QEMU_IMG_INFO_OUT3, 'available'],
[NFS_CONFIG4, QEMU_IMG_INFO_OUT4]) [NFS_CONFIG4, QEMU_IMG_INFO_OUT4, 'backing-up'])
@ddt.unpack @ddt.unpack
def test_create_volume_from_snapshot(self, nfs_conf, qemu_img_info): def test_create_volume_from_snapshot(self, nfs_conf, qemu_img_info,
snap_status):
self._set_driver(extra_confs=nfs_conf) self._set_driver(extra_confs=nfs_conf)
drv = self._driver drv = self._driver
# Volume source of the snapshot we are trying to clone from. We need it # Volume source of the snapshot we are trying to clone from. We need it
# to have a different id than the default provided. # to have a different id than the default provided.
src_volume = self._simple_volume(size=10) src_volume = self._simple_volume(size=10)
src_volume.id = fake.VOLUME_ID src_volume.id = fake.VOLUME_ID
src_volume_dir = os.path.join(self.TEST_MNT_POINT_BASE, src_volume_dir = os.path.join(self.TEST_MNT_POINT_BASE,
drv._get_hash_str( drv._get_hash_str(
src_volume.provider_location)) src_volume.provider_location))
src_volume_path = os.path.join(src_volume_dir, src_volume.name) src_volume_path = os.path.join(src_volume_dir, src_volume.name)
fake_snap = fake_snapshot.fake_snapshot_obj(self.context) fake_snap = fake_snapshot.fake_snapshot_obj(self.context)
# Fake snapshot based in the previous created volume # Fake snapshot based in the previous created volume
snap_file = src_volume.name + '.' + fake_snap.id snap_file = src_volume.name + '.' + fake_snap.id
fake_snap.volume = src_volume fake_snap.volume = src_volume
fake_snap.status = 'available' fake_snap.status = snap_status
fake_snap.size = 10 fake_snap.size = 10
# New fake volume where the snap will be copied # New fake volume where the snap will be copied
new_volume = self._simple_volume(size=10) new_volume = self._simple_volume(size=10)
new_volume_dir = os.path.join(self.TEST_MNT_POINT_BASE, new_volume_dir = os.path.join(self.TEST_MNT_POINT_BASE,
drv._get_hash_str( drv._get_hash_str(
src_volume.provider_location)) src_volume.provider_location))
new_volume_path = os.path.join(new_volume_dir, new_volume.name) new_volume_path = os.path.join(new_volume_dir, new_volume.name)
# Mocks # Mocks
skipping to change at line 1418 skipping to change at line 1419
# Test asserts # Test asserts
self.assertEqual(self.TEST_NFS_EXPORT1, ret['provider_location']) self.assertEqual(self.TEST_NFS_EXPORT1, ret['provider_location'])
used_qcow = nfs_conf['nfs_qcow2_volumes'] used_qcow = nfs_conf['nfs_qcow2_volumes']
mock_convert_image.assert_called_once_with( mock_convert_image.assert_called_once_with(
src_volume_path, new_volume_path, 'qcow2' if used_qcow else 'raw', src_volume_path, new_volume_path, 'qcow2' if used_qcow else 'raw',
run_as_root=True) run_as_root=True)
mock_ensure.assert_called_once() mock_ensure.assert_called_once()
mock_find_share.assert_called_once_with(new_volume) mock_find_share.assert_called_once_with(new_volume)
def test_create_volume_from_snapshot_status_not_available(self): @ddt.data('error', 'creating', 'deleting', 'deleted', 'updating',
'error_deleting', 'unmanaging', 'restoring')
def test_create_volume_from_snapshot_invalid_status(self, snap_status):
"""Expect an error when the snapshot's status is not 'available'.""" """Expect an error when the snapshot's status is not 'available'."""
self._set_driver() self._set_driver()
drv = self._driver drv = self._driver
src_volume = self._simple_volume() src_volume = self._simple_volume()
fake_snap = fake_snapshot.fake_snapshot_obj(self.context) fake_snap = fake_snapshot.fake_snapshot_obj(self.context)
fake_snap.volume = src_volume fake_snap.volume = src_volume
fake_snap.status = snap_status
new_volume = self._simple_volume() new_volume = self._simple_volume()
new_volume['size'] = fake_snap['volume_size'] new_volume['size'] = fake_snap['volume_size']
self.assertRaises(exception.InvalidSnapshot, self.assertRaises(exception.InvalidSnapshot,
drv.create_volume_from_snapshot, drv.create_volume_from_snapshot,
new_volume, new_volume,
fake_snap) fake_snap)
@ddt.data([NFS_CONFIG1, QEMU_IMG_INFO_OUT1], @ddt.data([NFS_CONFIG1, QEMU_IMG_INFO_OUT1],
 End of changes. 5 change blocks. 
7 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)