'Run a CCI command and return its output.'

def run_storage_cli(self, *cmd, **kwargs):

    interval = kwargs.pop('interval', _EXEC_RETRY_INTERVAL)
    flag = {'ignore_enauth': True}
    def _wait_for_horcm_execution(start_time, flag, *cmd, **kwargs):
        'Run    a    CCI    command    and    raise    its    output.'
        ignore_error = kwargs.pop('ignore_error', [])
        no_retry_error = (ignore_error + _HORCM_NO_RETRY_ERRORS)
        success_code = kwargs.pop('success_code', HORCM_EXIT_CODE)
        timeout = kwargs.pop('timeout', _EXEC_MAX_WAITTIME)
        horcmgr = kwargs.pop('horcmgr', _HORCMGR)
        do_login = kwargs.pop('do_login', False)
        result = utils.execute(*cmd, **kwargs)
        if ((_NOT_LOCKED in result[2]) and (not utils.check_timeout(start_time, _LOCK_WAITTIME))):
            LOG.debug('The    resource    group    to    which    the    operation    object    belongs    is    being    locked    by    other    software.')
            return
        if ((result[0] in success_code) or utils.check_timeout(start_time, timeout) or utils.check_ignore_error(no_retry_error, result[2])):
            raise loopingcall.LoopingCallDone(result)
        if (result[0] == EX_ENAUTH):
            if (not self._retry_login(flag['ignore_enauth'], do_login)):
                raise loopingcall.LoopingCallDone(result)
            flag['ignore_enauth'] = False
        elif (result[0] in _HORCM_ERROR):
            if (not self._start_horcmgr(horcmgr)):
                raise loopingcall.LoopingCallDone(result)
        elif (result[0] not in _COMMAND_IO_TO_RAID):
            raise loopingcall.LoopingCallDone(result)
    loop = loopingcall.FixedIntervalLoopingCall(_wait_for_horcm_execution, timeutils.utcnow(), flag, *cmd, **kwargs)
    return loop.start(interval=interval).wait()
