"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cinder/tests/unit/volume/drivers/test_infinidat.py" between
cinder-14.0.2.tar.gz and cinder-15.0.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 "Train" series (latest release).

test_infinidat.py  (cinder-14.0.2):test_infinidat.py  (cinder-15.0.0)
skipping to change at line 348 skipping to change at line 348
def test_create_snapshot_volume_doesnt_exist(self): def test_create_snapshot_volume_doesnt_exist(self):
self._system.volumes.safe_get.return_value = None self._system.volumes.safe_get.return_value = None
self.assertRaises(exception.InvalidVolume, self.assertRaises(exception.InvalidVolume,
self.driver.create_snapshot, test_snapshot) self.driver.create_snapshot, test_snapshot)
def test_create_snapshot_api_fail(self): def test_create_snapshot_api_fail(self):
self._mock_volume.create_snapshot.side_effect = self._raise_infinisdk self._mock_volume.create_snapshot.side_effect = self._raise_infinisdk
self.assertRaises(exception.VolumeBackendAPIException, self.assertRaises(exception.VolumeBackendAPIException,
self.driver.create_snapshot, test_snapshot) self.driver.create_snapshot, test_snapshot)
@mock.patch("cinder.volume.utils.copy_volume") @mock.patch("cinder.volume.volume_utils.copy_volume")
@mock.patch("cinder.utils.brick_get_connector") @mock.patch("cinder.utils.brick_get_connector")
@mock.patch("cinder.utils.brick_get_connector_properties", @mock.patch("cinder.utils.brick_get_connector_properties",
return_value=test_connector) return_value=test_connector)
@mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs") @mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs")
def test_create_volume_from_snapshot(self, *mocks): def test_create_volume_from_snapshot(self, *mocks):
self.driver.create_volume_from_snapshot(test_clone, test_snapshot) self.driver.create_volume_from_snapshot(test_clone, test_snapshot)
def test_create_volume_from_snapshot_doesnt_exist(self): def test_create_volume_from_snapshot_doesnt_exist(self):
self._system.volumes.safe_get.return_value = None self._system.volumes.safe_get.return_value = None
self.assertRaises(exception.InvalidSnapshot, self.assertRaises(exception.InvalidSnapshot,
skipping to change at line 377 skipping to change at line 377
@mock.patch("cinder.utils.brick_get_connector_properties", @mock.patch("cinder.utils.brick_get_connector_properties",
return_value=test_connector) return_value=test_connector)
@mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs") @mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs")
def test_create_volume_from_snapshot_map_fails(self, *mocks): def test_create_volume_from_snapshot_map_fails(self, *mocks):
self._mock_host.map_volume.side_effect = self._raise_infinisdk self._mock_host.map_volume.side_effect = self._raise_infinisdk
self.assertRaises(exception.VolumeBackendAPIException, self.assertRaises(exception.VolumeBackendAPIException,
self.driver.create_volume_from_snapshot, self.driver.create_volume_from_snapshot,
test_clone, test_snapshot) test_clone, test_snapshot)
@mock.patch("cinder.volume.utils.copy_volume") @mock.patch("cinder.volume.volume_utils.copy_volume")
@mock.patch("cinder.utils.brick_get_connector") @mock.patch("cinder.utils.brick_get_connector")
@mock.patch("cinder.utils.brick_get_connector_properties", @mock.patch("cinder.utils.brick_get_connector_properties",
return_value=test_connector) return_value=test_connector)
def test_create_volume_from_snapshot_delete_clone_fails(self, *mocks): def test_create_volume_from_snapshot_delete_clone_fails(self, *mocks):
self._mock_volume.delete.side_effect = self._raise_infinisdk self._mock_volume.delete.side_effect = self._raise_infinisdk
self.assertRaises(exception.VolumeBackendAPIException, self.assertRaises(exception.VolumeBackendAPIException,
self.driver.create_volume_from_snapshot, self.driver.create_volume_from_snapshot,
test_clone, test_snapshot) test_clone, test_snapshot)
def test_delete_snapshot(self): def test_delete_snapshot(self):
skipping to change at line 400 skipping to change at line 400
def test_delete_snapshot_doesnt_exist(self): def test_delete_snapshot_doesnt_exist(self):
self._system.volumes.safe_get.return_value = None self._system.volumes.safe_get.return_value = None
# should not raise an exception # should not raise an exception
self.driver.delete_snapshot(test_snapshot) self.driver.delete_snapshot(test_snapshot)
def test_delete_snapshot_api_fail(self): def test_delete_snapshot_api_fail(self):
self._mock_volume.safe_delete.side_effect = self._raise_infinisdk self._mock_volume.safe_delete.side_effect = self._raise_infinisdk
self.assertRaises(exception.VolumeBackendAPIException, self.assertRaises(exception.VolumeBackendAPIException,
self.driver.delete_snapshot, test_snapshot) self.driver.delete_snapshot, test_snapshot)
@mock.patch("cinder.volume.utils.copy_volume") @mock.patch("cinder.volume.volume_utils.copy_volume")
@mock.patch("cinder.utils.brick_get_connector") @mock.patch("cinder.utils.brick_get_connector")
@mock.patch("cinder.utils.brick_get_connector_properties", @mock.patch("cinder.utils.brick_get_connector_properties",
return_value=test_connector) return_value=test_connector)
@mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs") @mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs")
def test_create_cloned_volume(self, *mocks): def test_create_cloned_volume(self, *mocks):
self.driver.create_cloned_volume(test_clone, test_volume) self.driver.create_cloned_volume(test_clone, test_volume)
def test_create_cloned_volume_volume_already_mapped(self): def test_create_cloned_volume_volume_already_mapped(self):
mock_mapping = mock.Mock() mock_mapping = mock.Mock()
mock_mapping.get_volume.return_value = self._mock_volume mock_mapping.get_volume.return_value = self._mock_volume
skipping to change at line 431 skipping to change at line 431
@mock.patch("cinder.utils.brick_get_connector_properties", @mock.patch("cinder.utils.brick_get_connector_properties",
return_value=test_connector) return_value=test_connector)
@mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs") @mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs")
def test_create_cloned_volume_map_fails(self, *mocks): def test_create_cloned_volume_map_fails(self, *mocks):
self._mock_host.map_volume.side_effect = self._raise_infinisdk self._mock_host.map_volume.side_effect = self._raise_infinisdk
self.assertRaises(exception.VolumeBackendAPIException, self.assertRaises(exception.VolumeBackendAPIException,
self.driver.create_cloned_volume, self.driver.create_cloned_volume,
test_clone, test_volume) test_clone, test_volume)
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_create_group(self, *mocks): def test_create_group(self, *mocks):
self.driver.create_group(None, test_group) self.driver.create_group(None, test_group)
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_create_group_metadata(self, *mocks): def test_create_group_metadata(self, *mocks):
self.driver.create_group(None, test_group) self.driver.create_group(None, test_group)
self._validate_object_metadata(self._mock_group, test_group) self._validate_object_metadata(self._mock_group, test_group)
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_create_group_twice(self, *mocks): def test_create_group_twice(self, *mocks):
self.driver.create_group(None, test_group) self.driver.create_group(None, test_group)
self.driver.create_group(None, test_group) self.driver.create_group(None, test_group)
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_create_group_api_fail(self, *mocks): def test_create_group_api_fail(self, *mocks):
self._system.cons_groups.create.side_effect = self._raise_infinisdk self._system.cons_groups.create.side_effect = self._raise_infinisdk
self.assertRaises(exception.VolumeBackendAPIException, self.assertRaises(exception.VolumeBackendAPIException,
self.driver.create_group, self.driver.create_group,
None, test_group) None, test_group)
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_delete_group(self, *mocks): def test_delete_group(self, *mocks):
self.driver.delete_group(None, test_group, [test_volume]) self.driver.delete_group(None, test_group, [test_volume])
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_delete_group_doesnt_exist(self, *mocks): def test_delete_group_doesnt_exist(self, *mocks):
self._system.cons_groups.safe_get.return_value = None self._system.cons_groups.safe_get.return_value = None
self.driver.delete_group(None, test_group, [test_volume]) self.driver.delete_group(None, test_group, [test_volume])
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_delete_group_api_fail(self, *mocks): def test_delete_group_api_fail(self, *mocks):
self._mock_group.safe_delete.side_effect = self._raise_infinisdk self._mock_group.safe_delete.side_effect = self._raise_infinisdk
self.assertRaises(exception.VolumeBackendAPIException, self.assertRaises(exception.VolumeBackendAPIException,
self.driver.delete_group, self.driver.delete_group,
None, test_group, [test_volume]) None, test_group, [test_volume])
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_update_group_add_and_remove(self, *mocks): def test_update_group_add_and_remove(self, *mocks):
self.driver.update_group(None, test_group, self.driver.update_group(None, test_group,
[test_volume], [test_volume]) [test_volume], [test_volume])
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_update_group_api_fail(self, *mocks): def test_update_group_api_fail(self, *mocks):
self._mock_group.add_member.side_effect = self._raise_infinisdk self._mock_group.add_member.side_effect = self._raise_infinisdk
self.assertRaises(exception.VolumeBackendAPIException, self.assertRaises(exception.VolumeBackendAPIException,
self.driver.update_group, self.driver.update_group,
None, test_group, None, test_group,
[test_volume], [test_volume]) [test_volume], [test_volume])
@mock.patch("cinder.volume.utils.copy_volume") @mock.patch("cinder.volume.volume_utils.copy_volume")
@mock.patch("cinder.utils.brick_get_connector") @mock.patch("cinder.utils.brick_get_connector")
@mock.patch("cinder.utils.brick_get_connector_properties", @mock.patch("cinder.utils.brick_get_connector_properties",
return_value=test_connector) return_value=test_connector)
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
@mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs") @mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs")
def test_create_group_from_src_snaps(self, *mocks): def test_create_group_from_src_snaps(self, *mocks):
self.driver.create_group_from_src(None, test_group, [test_volume], self.driver.create_group_from_src(None, test_group, [test_volume],
test_snapgroup, [test_snapshot], test_snapgroup, [test_snapshot],
None, None) None, None)
@mock.patch("cinder.volume.utils.copy_volume") @mock.patch("cinder.volume.volume_utils.copy_volume")
@mock.patch("cinder.utils.brick_get_connector") @mock.patch("cinder.utils.brick_get_connector")
@mock.patch("cinder.utils.brick_get_connector_properties", @mock.patch("cinder.utils.brick_get_connector_properties",
return_value=test_connector) return_value=test_connector)
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
@mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs") @mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs")
def test_create_group_from_src_vols(self, *mocks): def test_create_group_from_src_vols(self, *mocks):
self.driver.create_group_from_src(None, test_group, [test_volume], self.driver.create_group_from_src(None, test_group, [test_volume],
None, None, None, None,
test_group, [test_volume]) test_group, [test_volume])
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_create_group_snap(self, *mocks): def test_create_group_snap(self, *mocks):
mock_snapgroup = mock.Mock() mock_snapgroup = mock.Mock()
mock_snapgroup.get_members.return_value = [self._mock_volume] mock_snapgroup.get_members.return_value = [self._mock_volume]
self._mock_volume.get_parent.return_value = self._mock_volume self._mock_volume.get_parent.return_value = self._mock_volume
self._mock_volume.get_name.return_value = '' self._mock_volume.get_name.return_value = ''
self._mock_group.create_snapshot.return_value = mock_snapgroup self._mock_group.create_snapshot.return_value = mock_snapgroup
self.driver.create_group_snapshot(None, self.driver.create_group_snapshot(None,
test_snapgroup, test_snapgroup,
[test_snapshot]) [test_snapshot])
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_create_group_snap_api_fail(self, *mocks): def test_create_group_snap_api_fail(self, *mocks):
self._mock_group.create_snapshot.side_effect = self._raise_infinisdk self._mock_group.create_snapshot.side_effect = self._raise_infinisdk
self.assertRaises(exception.VolumeBackendAPIException, self.assertRaises(exception.VolumeBackendAPIException,
self.driver.create_group_snapshot, None, self.driver.create_group_snapshot, None,
test_snapgroup, [test_snapshot]) test_snapgroup, [test_snapshot])
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_delete_group_snap(self, *mocks): def test_delete_group_snap(self, *mocks):
self.driver.delete_group_snapshot(None, self.driver.delete_group_snapshot(None,
test_snapgroup, test_snapgroup,
[test_snapshot]) [test_snapshot])
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_delete_group_snap_does_not_exist(self, *mocks): def test_delete_group_snap_does_not_exist(self, *mocks):
self._system.cons_groups.safe_get.return_value = None self._system.cons_groups.safe_get.return_value = None
self.driver.delete_group_snapshot(None, self.driver.delete_group_snapshot(None,
test_snapgroup, test_snapgroup,
[test_snapshot]) [test_snapshot])
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_delete_group_snap_invalid_group(self, *mocks): def test_delete_group_snap_invalid_group(self, *mocks):
self._mock_group.is_snapgroup.return_value = False self._mock_group.is_snapgroup.return_value = False
self.assertRaises(exception.InvalidGroupSnapshot, self.assertRaises(exception.InvalidGroupSnapshot,
self.driver.delete_group_snapshot, self.driver.delete_group_snapshot,
None, test_snapgroup, [test_snapshot]) None, test_snapgroup, [test_snapshot])
@mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type',
return_value=True) return_value=True)
def test_delete_group_snap_api_fail(self, *mocks): def test_delete_group_snap_api_fail(self, *mocks):
self._mock_group.safe_delete.side_effect = self._raise_infinisdk self._mock_group.safe_delete.side_effect = self._raise_infinisdk
self.assertRaises(exception.VolumeBackendAPIException, self.assertRaises(exception.VolumeBackendAPIException,
self.driver.delete_group_snapshot, self.driver.delete_group_snapshot,
None, test_snapgroup, [test_snapshot]) None, test_snapgroup, [test_snapshot])
def test_terminate_connection_force_detach(self): def test_terminate_connection_force_detach(self):
mock_infinidat_host = mock.Mock() mock_infinidat_host = mock.Mock()
mock_infinidat_host.get_ports.return_value = [ mock_infinidat_host.get_ports.return_value = [
 End of changes. 22 change blocks. 
22 lines changed or deleted 22 lines changed or added

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