def _create_horcm_conf(self, horcmgr=_HORCMGR): inst = self.conf.hpxp_horcm_numbers[horcmgr] inst = int(inst) serial = self.conf.hpxp_storage_id filename = '/etc/horcm%s.conf' % inst port = _DEFAULT_PORT_BASE + inst found = False if not os.path.exists(filename): file_str = """ HORCM_MON #ip_address service poll(10ms) timeout(10ms) 127.0.0.1 %16d 6000 3000 HORCM_CMD """ % port else: file_str = cinder_utils.read_file_as_root(filename) if re.search(r'^\\\\.\\CMD-%s:/dev/sd$' % serial, file_str, re.M): found = True if not found: repl_str = r'\1\\\\.\\CMD-%s:/dev/sd\n' % serial file_str = CMD_PATTERN.sub(repl_str, file_str) result = utils.execute('tee', filename, process_input=file_str) if result[0]: msg = utils.output_log( 632, file=filename, ret=result[0], err=result[2]) raise exception.HPXPError(data=msg)
def _wait_for_horcm_execution(start_time, flag, *cmd, **kwargs): 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)
def get_storage_cli_info(self): version = 'N/A' result = utils.execute('raidqry', '-h') m = re.search(r'^Ver&Rev: +(?P<version>\S+)$', result[1], re.M) if m: version = m.group('version') return ('RAID Manager', version)
def _run_horcmstart(inst): result = utils.execute('horcmstart.sh', inst) return result[0]
def _run_horcmshutdown(inst): result = utils.execute('horcmshutdown.sh', inst) return result[0]
def _run_horcmgr(inst): result = utils.execute( 'env', 'HORCMINST=%s' % inst, 'horcmgr', '-check') return result[0]