示例#1
0
 def test_delete_volume_no_replica_failure(self, mock_mdp, mock_gvmv):
     """Failure case for delete_volume one node in data plane."""
     mock_gvmv.side_effect = None
     self.driver.delete_volume(self.volume)
     mock_mdp.side_effect = v_exception.UnableToProcessHyperScaleCmdOutput(
         cmd_out='mock error')
     self.assertRaises(exception.VolumeIsBusy, self.driver.delete_volume,
                       self.volume)
示例#2
0
    def test_delete_volume_more_than_one_replica_failure(
            self, mock_mdp, mock_gvmv):
        """failure case for delete_volume with more than one data nodes."""
        mock_gvmv.side_effect = VRTSHyperScaleDriverTestCase.gvmv_side_effect

        mock_mdp.side_effect = v_exception.UnableToProcessHyperScaleCmdOutput(
            cmd_out='mock error')

        self.assertRaises(exception.VolumeIsBusy, self.driver.delete_volume,
                          self.volume)
示例#3
0
文件: utils.py 项目: zhen00fa/cinder
def process_cmd_out(cmd_out):
    """Process the cmd output."""

    output = None

    try:
        # get the python object from the cmd_out
        output = json.loads(cmd_out)
        error_code = output.get('err_code')
        if error_code:
            error_message = output.get('err_msg')
            operation = output.get('token')
            LOG.error("Failed to perform %(operation)s with error code"
                      " %(err_code)s, error message is %(err_msg)s",
                      {"operation": operation,
                       "err_code": error_code,
                       "err_msg": error_message})
    except ValueError:
        raise exception.UnableToProcessHyperScaleCmdOutput(cmd_out=cmd_out)

    return output
示例#4
0
 def test_extend_volume_with_exception(self, mock_mdp):
     """Test case extend volume to the given size in GB."""
     mock_mdp.side_effect = v_exception.UnableToProcessHyperScaleCmdOutput(
         cmd_out='mock error')
     self.assertRaises(exception.VolumeDriverException,
                       self.driver.extend_volume, _stub_volume(), 256)