Esempio n. 1
0
 def test_delete_volume_with_flashcopies_as_source_and_target_fail(self):
     self.client_mock.get_volume.return_value = self.volume_response
     self.client_mock.get_flashcopies_by_volume.return_value = [
         Munch({
             "sourcevolume": "0001",
             "targetvolume": "0002",
             "id": "0001:0002",
             "state": "valid",
             "backgroundcopy": "disabled",
             "representation": {}
         }),
         Munch({
             "sourcevolume": "0003",
             "targetvolume": "0001",
             "id": "0003:0001",
             "state": "valid",
             "backgroundcopy": "enabled",
             "representation": {}
         })
     ]
     self.client_mock.get_flashcopies.return_value = Munch(
         {"out_of_sync_tracks": "0"})
     self.client_mock.delete_volume.side_effect = ClientException("500")
     with self.assertRaises(array_errors.ObjectIsStillInUseError):
         self.array.delete_volume("0001")
Esempio n. 2
0
    def test_create_snapshot_create_volume_error(self):
        self._prepare_mocks_for_create_snapshot()
        self.client_mock.create_volume.side_effect = ClientException("500")

        with self.assertRaises(array_errors.VolumeCreationError):
            self.array.create_snapshot("source_name",
                                       "test_name",
                                       pool_id=self.volume_response.pool)
Esempio n. 3
0
    def test_create_snapshot_create_volume_error(self):
        self.client_mock.create_volume.side_effect = ClientException("500")

        with self.assertRaises(array_errors.VolumeCreationError):
            self.array.create_snapshot("volume_id",
                                       "target_volume",
                                       space_efficiency=None,
                                       pool=self.volume_response.pool)
Esempio n. 4
0
 def test_create_snapshot_already_exist(self):
     volume = self._prepare_mocks_for_create_snapshot()
     self.client_mock.create_volume.return_value = volume
     self.client_mock.get_volume.return_value = volume
     self.client_mock.create_flashcopy.side_effect = ClientException("500",
                                                                     message="000000AE")
     with self.assertRaises(array_errors.SnapshotAlreadyExists):
         self.array.create_snapshot("volume_id", "target_volume", pool=self.volume_response.pool)
Esempio n. 5
0
    def test_create_snapshot_create_flashcopy_volume_not_found(self):
        volume = self._prepare_mocks_for_create_snapshot()
        self.client_mock.create_volume.return_value = volume
        self.client_mock.get_volume.return_value = volume
        self.client_mock.create_flashcopy.side_effect = ClientException("500", message="00000013")

        with self.assertRaises(array_errors.ObjectNotFoundError):
            self.array.create_snapshot("volume_id", "target_volume", pool=self.volume_response.pool)
Esempio n. 6
0
    def test_create_snapshot_create_fcrel_error(self):
        volume = self._prepare_mocks_for_create_snapshot()
        self.client_mock.create_volume.return_value = volume
        self.client_mock.get_volume.return_value = volume
        self.client_mock.create_flashcopy.side_effect = ClientException("500")

        with self.assertRaises(Exception):
            self.array.create_snapshot("volume_id", "target_volume", pool=self.volume_response.pool)
Esempio n. 7
0
    def test_create_snapshot_create_fcrel_error(self):
        self.client_mock.create_volume = Mock()
        self.client_mock.get_volume = Mock()
        self.client_mock.create_flashcopy.side_effect = ClientException("500")

        with self.assertRaises(Exception):
            self.array.create_snapshot("volume_id",
                                       "target_volume",
                                       space_efficiency=None,
                                       pool=self.volume_response.pool)
    def test_create_snapshot_create_volume_error(self):
        self._prepare_mocks_for_create_snapshot()
        self.client_mock.create_volume.side_effect = ClientException("500")

        with self.assertRaises(array_errors.VolumeCreationError):
            self.array.create_snapshot("snap_name",
                                       "test_name",
                                       volume_context={
                                           config.CONTEXT_POOL:
                                           self.volume_response.pool
                                       })
    def test_create_snapshot_create_fcrel_error(self):
        volume = self._prepare_mocks_for_create_snapshot()
        self.client_mock.create_volume.return_value = volume
        self.client_mock.get_volume.return_value = volume
        self.client_mock.create_flashcopy.side_effect = ClientException("500")

        with self.assertRaises(Exception):
            self.array.create_snapshot("target_vol",
                                       "test_name",
                                       volume_context={
                                           config.CONTEXT_POOL:
                                           self.volume_response.pool
                                       })
Esempio n. 10
0
 def test_unmap_volume_failed_with_ClientException(self):
     volume_id = "0001"
     lunid = "1"
     host_name = "test_host"
     scsi_id = "6005076306FFD301000000000000{}".format(volume_id)
     self.client_mock.get_host_mappings.return_value = [
         Munch({
             "volume": volume_id,
             "id": lunid
         })
     ]
     self.client_mock.unmap_volume_from_host.side_effect = ClientException("500")
     with self.assertRaises(array_errors.UnmappingError):
         self.array.unmap_volume(scsi_id, host_name)
Esempio n. 11
0
 def test_expand_volume_extend_not_enough_space_error(self):
     self.client_mock.extend_volume.side_effect = [
         ClientException("500", message="BE531465")
     ]
     with self.assertRaises(array_errors.NotEnoughSpaceInPool):
         self.array.expand_volume(volume_id="test_id", required_bytes=10)
Esempio n. 12
0
 def test_expand_volume_extend_raise_error(self):
     self.client_mock.extend_volume.side_effect = [
         ClientException("500", message="other error")
     ]
     with self.assertRaises(ClientException):
         self.array.expand_volume(volume_id="test_id", required_bytes=10)
Esempio n. 13
0
 def test_delete_snapshot_fail_with_ClientException(self):
     self._prepare_mocks_for_snapshot()
     self.client_mock.delete_volume.side_effect = ClientException("500")
     with self.assertRaises(array_errors.VolumeDeletionError):
         self.array.delete_snapshot("fake_id")
Esempio n. 14
0
 def test_get_object_by_id_get_volume_raise_error(self):
     self.client_mock.get_volume.side_effect = ClientException(
         "500", "other error")
     with self.assertRaises(ClientException):
         self.array.get_object_by_id("", "volume")
 def test_delete_flashcopy_failed_with_ClientException(self):
     self.client_mock.delete_flashcopy.side_effect = ClientException("500")
     mapped_volume = self._get_volume_with_flashcopy_relationship()
     self.client_mock.get_volume.return_value = mapped_volume
     with self.assertRaises(ClientException):
         self.array.delete_snapshot("fake_name")
Esempio n. 16
0
 def test_delete_snapshot_flashcopy_fail_with_ClientException(self):
     self._prepare_mocks_for_snapshot()
     self.client_mock.delete_flashcopy.side_effect = ClientException("500")
     self.client_mock.get_volume.return_value = self.snapshot_response
     with self.assertRaises(ClientException):
         self.array.delete_snapshot("fake_name")
Esempio n. 17
0
 def test_get_array_fc_wwns_fail_with_ClientException(self):
     self.client_mock.get_host.side_effect = ClientException("500")
     with self.assertRaises(ClientException):
         self.array.get_array_fc_wwns()
Esempio n. 18
0
 def test_create_volume_failed_with_no_space_in_pool(self):
     self.client_mock.get_volumes_by_pool.side_effect = ClientException(
         "500", message="BE534459")
     with self.assertRaises(array_errors.NotEnoughSpaceInPool):
         self.array.create_volume("fake_name", 1, {}, "fake_pool")
Esempio n. 19
0
 def test_map_volume_fail_with_ClientException(self):
     self.client_mock.map_volume_to_host.side_effect = ClientException(
         "500")
     with self.assertRaises(array_errors.MappingError):
         self.array.map_volume("fake_name", "fake_host",
                               "fake_connectivity_type")
Esempio n. 20
0
 def test_map_volume_volume_not_found(self):
     self.client_mock.map_volume_to_host.side_effect = ClientException(
         "500", "[BE586015]")
     with self.assertRaises(array_errors.ObjectNotFoundError):
         self.array.map_volume("fake_name", "fake_host",
                               "fake_connectivity_type")
Esempio n. 21
0
 def test_get_volume_mappings_fail_with_ClientException(self):
     self.client_mock.get_hosts.side_effect = ClientException("500")
     with self.assertRaises(ClientException):
         self.array.get_volume_mappings("fake_name")
Esempio n. 22
0
 def test_create_volume_fail_with_ClientException(self):
     self.client_mock.create_volume.side_effect = ClientException("500")
     with self.assertRaises(array_errors.VolumeCreationError):
         self.array.create_volume("fake_name", 1, 'thin', "fake_pool")
Esempio n. 23
0
 def test_delete_volume_fail_with_ClientException(self):
     self.client_mock.delete_volume.side_effect = ClientException("500")
     with self.assertRaises(array_errors.VolumeDeletionError):
         self.array.delete_volume("fake_id")