コード例 #1
0
 /**
  * Reconfig properties associated with a list of tags
  *
  * @param propertyTags space separated list of property tags
  * @throws LocalRepositoryException
  */
 public void reconfigProperties(String propertyTags) throws LocalRepositoryException {
   final String prefix = String.format("reconfigProperty(%s): ", propertyTags);
   _log.debug(prefix);
   final String[] cmd = {_SYSTOOL_CMD, _SYSTOOL_RECONFIG_PROPS, propertyTags};
   final Exec.Result result = Exec.sudo(_SYSTOOL_TIMEOUT, cmd);
   checkFailure(result, prefix);
 }
コード例 #2
0
 /**
  * Reconfig local coordinatorsvc to observer(default mode), or pariticpant(when active site is
  * down) For DR standby site only.
  *
  * @param type
  * @throws LocalRepositoryException
  */
 public void reconfigCoordinator(String type) throws LocalRepositoryException {
   final String prefix = String.format("reconfigCoordinator(%s): ", type);
   _log.debug(prefix);
   final String[] cmd = {_SYSTOOL_CMD, _SYSTOOL_RECONFIG_COORDINATOR, type};
   final Exec.Result result = Exec.sudo(_SYSTOOL_TIMEOUT, cmd);
   checkFailure(result, prefix);
 }
コード例 #3
0
 /**
  * Reconfig throw LocalRepositoryException if exit value = 66 or exit value != 0 also throw
  * LocalRepositoryException if not exited normally
  *
  * @throws LocalRepositoryException
  */
 public void reconfig() throws LocalRepositoryException {
   final String prefix = "reconfig(): ";
   _log.debug(prefix);
   final String[] cmd = {_SYSTOOL_CMD, _SYSTOOL_RECONFIG};
   final Exec.Result result = Exec.sudo(_SYSTOOL_TIMEOUT, cmd);
   checkFailure(result, prefix);
 }
コード例 #4
0
 /**
  * Poweroff throw LocalRepositoryException if exit value = 66 or exit value != 0 also throw
  * LocalRepositoryException if not exited normally
  *
  * @throws LocalRepositoryException
  */
 public void poweroff() throws LocalRepositoryException {
   final String prefix = "poweroff(): ";
   _log.debug(prefix);
   final String[] cmd = {_SYSTOOL_CMD, _SYSTOOL_POWEROFF};
   final Exec.Result result = Exec.sudo(_SYSTOOL_TIMEOUT, cmd);
   checkFailure(result, prefix);
 }
コード例 #5
0
  /**
   * Notify a service to reload configs after /etc/genconfig regenerates them. The notification is
   * done via systool since the service is not owned by storageos.
   *
   * @throws LocalRepositoryException
   */
  public void reload(final String svcName) throws LocalRepositoryException {
    final String prefix = String.format("reload %s(): ", svcName);
    _log.debug(prefix);

    final String[] cmd = {_SYSTOOL_CMD, _SYSTOOL_RELOAD, svcName};
    final Exec.Result result = Exec.sudo(_SYSTOOL_TIMEOUT, cmd);
    checkFailure(result, prefix);
  }
コード例 #6
0
  /**
   * Stop a service
   *
   * @param serviceName service name
   * @throws LocalRepositoryException
   */
  public void stop(final String serviceName) throws LocalRepositoryException {
    final String prefix = "stop(): serviceName=" + serviceName + " ";
    _log.debug(prefix);

    final String[] cmd = {_SYSTOOL_CMD, _SYSTOOL_STOP, serviceName};
    final Exec.Result result = Exec.sudo(_SYSTOOL_TIMEOUT, cmd);
    checkFailure(result, prefix);
  }
コード例 #7
0
  /**
   * check if local ipsec configurations are synced between vdc properties and ipsec configuration
   * files.
   *
   * @return
   */
  public boolean isLocalIpsecConfigSynced() {
    final String prefix = "isLocalIpsecConfigSynced(): ";
    _log.debug(prefix);

    final String[] cmd = {_IPSECTOOL_CMD, IPSEC_CHECK_LOCAL};
    final Exec.Result result = Exec.sudo(_SYSTOOL_TIMEOUT, cmd);
    _log.debug(prefix + result);

    return result.getExitValue() == 0;
  }
コード例 #8
0
  /**
   * Restart a service on remote node
   *
   * @param nodeId
   * @throws LocalRepositoryException
   */
  public void remoteRestartCoordinator(String nodeId, String type) throws LocalRepositoryException {
    final String prefix = String.format("restart(): type=%s on %s", type, nodeId);
    _log.debug(prefix);

    final String[] cmd = {
      _SYSTOOL_CMD, _SYSTOOL_REMOTE_SYSTOOL, nodeId, _SYSTOOL_RESTART_COORDINATOR, type
    };
    final Exec.Result result = Exec.sudo(_SYSTOOL_TIMEOUT, cmd);
    checkFailure(result, prefix);
  }
コード例 #9
0
 /** Gets used, available size for data and root with the help of df command. */
 public static DataDiskStats getDataDiskStats() {
   final String[] cmd = {DF_COMMAND};
   Exec.Result result = Exec.sudo(DF_COMMAND_TIMEOUT, cmd);
   if (!result.exitedNormally() || result.getExitValue() != 0) {
     _log.error(
         "getDataDiskStats() is unsuccessful. Command exit value is: {}", result.getExitValue());
     return null;
   }
   _log.info("df result: {}", result.getStdOutput());
   return parseDFResults(result.getStdOutput());
 }
コード例 #10
0
  private static String[] exec(final String prefix, String outputMaskPatternStr, String[] cmd)
      throws LocalRepositoryException {
    Pattern maskFilter = null;
    if (!StringUtils.isEmpty(outputMaskPatternStr)) {
      maskFilter = Pattern.compile(outputMaskPatternStr);
    }

    final Exec.Result result = Exec.sudo(_SYSTOOL_TIMEOUT, maskFilter, cmd);
    if (!result.exitedNormally() || result.getExitValue() != 0) {
      _log.info(prefix + "Command failed. Result exit value: " + result.getExitValue());
      throw SyssvcException.syssvcExceptions.localRepoError(prefix + "Command failed: " + result);
    }

    return result.getStdOutput().split(LINE_DELIMITER);
  }
コード例 #11
0
 public void poweroffCluster() {
   log.info("powering off the cluster!");
   final String[] cmd = {POWEROFFTOOL_COMMAND};
   Exec.sudo(SHUTDOWN_TIMEOUT_MILLIS, cmd);
 }
コード例 #12
0
 public void genDHParam() {
   final String prefix = String.format("gen DHParam: ");
   final String[] cmd = {_SYSTOOL_CMD, _SYSTOOL_GEN_DHPARAM};
   final Exec.Result result = Exec.sudo(_SYSTOOL_LONG_TIMEOUT, cmd);
   checkFailure(result, prefix);
 }