예제 #1
0
    def test_create_volume_return_pool_not_match_capabilities_error(
            self, mock_warning):
        mock_warning.return_value = False
        self.svc.client.svctask.mkvolume.side_effect = [
            CLIFailureError("CMMVC9292E")]
        with self.assertRaises(array_errors.PoolDoesNotMatchCapabilities):
            self.svc.create_volume("vol", 10, {}, "pool")

        self.svc.client.svctask.mkvolume.side_effect = [
            CLIFailureError("CMMVC9301E")]
        with self.assertRaises(array_errors.PoolDoesNotMatchCapabilities):
            self.svc.create_volume("vol", 10, {}, "pool")
예제 #2
0
 def test_delete_volume_return_volume_delete_errors(self, mock_warning):
     mock_warning.return_value = False
     self.svc.client.svctask.rmvolume.side_effect = [
         CLIFailureError("CMMVC5753E")]
     with self.assertRaises(array_errors.VolumeNotFoundError):
         self.svc.delete_volume("vol")
     self.svc.client.svctask.rmvolume.side_effect = [
         CLIFailureError("CMMVC8957E")]
     with self.assertRaises(array_errors.VolumeNotFoundError):
         self.svc.delete_volume("vol")
     self.svc.client.svctask.rmvolume.side_effect = [
         CLIFailureError("Failed")]
     with self.assertRaises(CLIFailureError):
         self.svc.delete_volume("vol")
 def test_create_volume_return_volume_exists_error(self, mock_warning):
     mock_warning.return_value = False
     self.svc.client.svctask.mkvolume.side_effect = [
         CLIFailureError("CMMVC6035E")
     ]
     with self.assertRaises(array_errors.VolumeAlreadyExists):
         self.svc.create_volume("vol", 10, {}, "pool")
 def test_get_volume_return_CLI_Failure_errors(self, mock_warning):
     mock_warning.return_value = False
     self.svc.client.svcinfo.lsvdisk.side_effect = [
         CLIFailureError('CMMVC5753E')
     ]
     with self.assertRaises(array_errors.VolumeNotFoundError):
         self.svc.get_volume("vol_name")
 def test_create_volume_return_pool_not_exists_error(self, mock_warning):
     mock_warning.return_value = False
     self.svc.client.svctask.mkvolume.side_effect = [
         CLIFailureError("CMMVC5754E")
     ]
     with self.assertRaises(array_errors.PoolDoesNotExist):
         self.svc.create_volume("vol", 10, {}, "pool")
예제 #6
0
    def test_delete_snapshot_rmvolume_error(self, mock_warning):
        self._prepare_mocks_for_get_snapshot()
        mock_warning.return_value = False
        self.svc.client.svctask.rmvolume.side_effect = [
            CLIFailureError("Failed")]

        with self.assertRaises(CLIFailureError):
            self.svc.delete_snapshot("test_snap")
예제 #7
0
    def test_create_snapshot_start_fcmap_error(self, mock_warning):
        self._prepare_mocks_for_create_snapshot()
        mock_warning.return_value = False
        self.svc.client.svctask.startfcmap.side_effect = [
            CLIFailureError("Failed")]

        with self.assertRaises(CLIFailureError):
            self.svc.create_snapshot("test_snap", "source_vol")
예제 #8
0
 def test_create_volume_return_exception(self, mock_warning):
     mock_warning.return_value = False
     self.svc.client.svctask.mkvolume.side_effect = [Exception]
     with self.assertRaises(Exception):
         self.svc.create_volume("vol", 10, {}, "pool")
     self.svc.client.svctask.mkvolume.side_effect = [
         CLIFailureError("Failed")]
     with self.assertRaises(CLIFailureError):
         self.svc.create_volume("vol", 10, {}, "pool")
예제 #9
0
    def test_create_snapshot_create_volume_error(self, mock_warning):
        source_cli_vol = self._get_source_cli_vol()
        self.svc.client.svcinfo.lsvdisk.return_value = self._mock_cli_object(source_cli_vol)
        mock_warning.return_value = False
        self.svc.client.svctask.mkvolume.side_effect = [
            CLIFailureError("Failed")]

        with self.assertRaises(CLIFailureError):
            self.svc.create_snapshot("test_snap", "source_vol")
예제 #10
0
    def test_get_snapshot_get_fcmap_not_exist_raise_error(self, mock_warning):
        target_cli_vol = self._get_mapped_target_cli_vol()
        self.svc.client.svcinfo.lsvdisk.return_value = self._mock_cli_object(target_cli_vol)
        mock_warning.return_value = False
        self.svc.client.svcinfo.lsfcmap.side_effect = [
            CLIFailureError("CMMVC5753E")]

        with self.assertRaises(CLIFailureError):
            self.svc.get_snapshot("test_snap")
예제 #11
0
 def test_get_iscsi_targets_cli_error_raise_no_targets_error(self):
     self.svc.client.svcinfo.lsportip.side_effect = [
         CLIFailureError("Failed")]
     with self.assertRaises(array_errors.NoIscsiTargetsFoundError):
         self.svc.get_iscsi_targets_by_iqn()
예제 #12
0
 def _prepare_lsvdisk_to_raise_not_found_error(self, mock_warning):
     mock_warning.return_value = False
     self.svc.client.svcinfo.lsvdisk.side_effect = [
         CLIFailureError("CMMVC5753E")]