Ejemplo n.º 1
0
def get_hyperscale_version():

    version = None
    cmd_err = None
    try:
        cmd_arg = {'operation': 'version'}
        # create a json for cmd argument
        cmdarg_json = json.dumps(cmd_arg)

        # call hscli for version
        (cmd_out, cmd_err) = hsexecute(cmdarg_json)

        # cmd_err should be None in case of successful execution of cmd
        if not cmd_err:
            processed_output = process_cmd_out(cmd_out)
            version = processed_output.get('payload')
        else:
            LOG.error("Error %s in getting hyperscale version", cmd_err)
            raise exception.ErrorInHyperScaleVersion(cmd_err=cmd_err)
    except (exception.UnableToExecuteHyperScaleCmd,
            exception.UnableToProcessHyperScaleCmdOutput):
        LOG.error("Exception in running the command for version",
                  exc_info=True)
        raise exception.UnableToExecuteHyperScaleCmd(message="version")

    return version
Ejemplo n.º 2
0
    def test_check_for_setup_error_exception(self, mock_ghv):
        """Test check for setup errors in Veritas HyperScale driver.

        The test case checks happy path execution when driver version 1.0.0
        is installed.
        """
        mock_ghv.side_effect = exception.ErrorInHyperScaleVersion(
            cmd_error="mock error")

        # check the driver for setup errors
        self.assertRaises(exception.VolumeBackendAPIException,
                          self.driver.check_for_setup_error)