Esempio n. 1
0
  private void run_updateNodes() throws ExecutionProblem {

    final String[] hostnames = this.hosts.toArray(new String[this.hosts.size()]);
    final Boolean active = this.nodeActiveConfigured ? this.nodeActive : null;
    final String resourcepool = this.nodePool;
    final Integer memory = this.nodeMemoryConfigured ? this.nodeMemory : null;
    final String networks = this.nodeNetworks;

    NodeReport[] reports = null;
    try {
      final String reportJson =
          this.remoteNodeManagement.updateNodes(hostnames, active, resourcepool, memory, networks);
      reports = gson.fromJson(reportJson, NodeReport[].class);
    } catch (RemoteException e) {
      super.handleRemoteException(e);
    }

    try {
      reporter.report(nodeReportsToMaps(reports), this.outStream);
    } catch (IOException e) {
      throw new ExecutionProblem("Problem writing output: " + e.getMessage(), e);
    }
  }
Esempio n. 2
0
  private void loadAdminClientConfig() throws ParameterProblem, ExecutionProblem {

    super.loadConfig(PROP_RMI_BINDING_NODEMGMT_DIR);

    // only need node parameter values if doing add-nodes
    if (this.action == AdminAction.AddNodes) {
      if (!this.nodeMemoryConfigured) {
        final String memString = properties.getProperty(PROP_DEFAULT_MEMORY);
        if (memString != null) {
          this.nodeMemory = parseMemory(memString);
          this.nodeMemoryConfigured = true;
        }
      }

      if (this.nodeNetworks == null) {
        this.nodeNetworks = properties.getProperty(PROP_DEFAULT_NETWORKS);
      }

      if (this.nodePool == null) {
        // if missing or invalid, error will come later if this value is actually needed
        this.nodePool = properties.getProperty(PROP_DEFAULT_POOL);
      }
    }
  }