Moab Web Services > Resources > Nodes

Nodes

This section describes behavior of the Node object in Moab Web Services. It contains the URLs, request bodies, and responses delivered to and from MWS.

Nodes are tenant objects. If you have implemented a multi-tenant environment (see About Tenants for more information), and are logged in with an application account, you must include a proxy-user with each service call to limit the results to information that the user has permission to see. If you are logged in with an LDAP account, MWS will automatically limit the results to information that the LDAP user has permission to see. For more information, see Roles.

The Node API is new with API version 2. The supported methods table below requires each resource to be accessed with a URL parameter of api-version=3 in order to behave as documented.

For more information, see Requesting Specific API Versions.

The Fields: Nodes reference contains the type and description of all fields in the Node object. It also contains details regarding which fields are valid during PUT and POST actions.

Supported methods

Resource GET PUT POST DELETE
/rest/nodes Get All Nodes -- -- --
/rest/nodes/<name> Get Single Node Modify Node -- --

This topic contains these sections:

Getting Nodes

The HTTP GET method is used to retrieve Node information.

Quick reference

GET http://localhost:8080/mws/rest/nodes/<name>?api-version=3

Get All Nodes

URLs and parameters

GET http://localhost:8080/mws/rest/nodes?api-version=3
Parameter Required Type Description Example
query No JSON

Queries for specific results.

It is possible to query by one or more fields based on MongoDB query syntax.

query={"type":"compute"}
sort No JSON Sort the results. Use 1 for ascending and -1 for descending. sort={"name":-1}

See Global URL Parameters for available URL parameters.

This query will not return the DEFAULT or GLOBAL nodes from Moab. However, the Get Single Node task may be used to retrieve them individually if desired.

Sample response

GET http://localhost:8080/mws/rest/nodes?api-version=3&fields=name
------------------------------------

{
  "totalCount": 3,
  "resultCount": 3,
  "results":   [
    {"name": "node1"},
    {"name": "node2"},
    {"name": "node3"}
  ]
}

Get Single Node

URLs and parameters

GET http://localhost:8080/mws/rest/nodes/<name>?api-version=3
Parameter Required Type Valid values Description
name Yes String -- The name of the object.

See Global URL Parameters for available URL parameters.

The attributes field is only applicable in API version 2 and later, and the MOAB_TENANT field only applies if the node is attached to a tenant.

Sample response

JSON response
------------------------------------

{
  "name": "l26.csa",
  "architecture": null,
  "classes": ["class1"],
  "attributes":   {
    "MOAB_TENANT":   {
      "value": "1234567890abcdef12345678",
      "displayValue": "ResearchGroup"
    },
    "MOAB_DATACENTER":   {
      "value": "vcenter-datacenter-401",
      "displayValue": "vcenter-vcenter - adaptive data center"
    },
    "vcenter-vcenter-adaptive data center-compute nodes":     {
      "value": null,
      "displayValue": null
    }
  },
  "featuresCustom": ["feature1", "feature2"],
  "featuresReported": ["vcenter-vcenter-adaptive data center-compute nodes"],
  "index": 26,
  "ipAddress": "10.0.8.76",
  "isHypervisor": true,
  "lastUpdatedDate": "2013-05-24 20:18:11 UTC",
  "migrationDisabled": false,
  "partition": "mws",
  "processorSpeed": null,
  "profilingEnabled": false,
  "rack": null,
  "resourceManagerMessages":   {
    "torque": null,
    "mws": null
  },
  "slot": null,
  "type": "compute",
  "messages": [  {
    "count": 11,
    "createdDate": "2012-10-24 04:06:04 UTC",
    "expireDate": "2037-10-24 12:26:40 UTC",
    "message": "This is a message"
  }],
  "metrics":   {
    "vmcount": 0,
    "cpuUtilization": 0.275,
    "cpuLoad": 0.01115
  },
  "variables":   {
    "VCENTER_DATASTORE_LOCAL1": "datastore-415",
    "VCENTER_DATASTORE_REMOTE1": "datastore-448"
  },
  "states":   {
    "powerState": "On",
    "powerStateExpected": null,
    "state": "Idle",
    "stateExpected": "Idle",
    "stateLastUpdatedDate": "2013-05-24 09:33:45 UTC",
    "subState": null,
    "subStateLast": null,
    "subStateLastUpdatedDate": null
  },
  "operatingSystem":   {
    "hypervisorType": "esx",
    "image": "vcenter-vcenter-esx-5.0",
    "imageExpected": null,
    "imageLastUpdatedDate": null,
    "imagesAvailable": [],
    "virtualMachineImages":     [
      "win2008",
      "centos6"
    ]
  },
  "resources":   {
    "processors":     {
      "configured": 4,
      "real": 4,
      "dedicated": 0,
      "available": 4,
      "utilized": -1
    },
    "memory":     {
      "configured": 10239,
      "real": 10239,
      "dedicated": 0,
      "available": 9227,
      "utilized": 0
    },
    "disk":     {
      "configured": 0,
      "real": 0,
      "dedicated": 0,
      "available": 0,
      "utilized": 0
    },
    "swap":     {
      "configured": 0,
      "real": 0,
      "dedicated": 0,
      "available": 0,
      "utilized": 0
    }
  },
  "resourceManagers": [  {
    "name": "mws",
    "isMaster": true,
    "stateReported": "Active"
  }],
  "jobs": [],
  "reservations":   [
        {
      "name": "system.5",
      "type": "user"
    },
        {
      "name": "system.17",
      "type": "user"
    }
  ],
  "virtualContainers": [],
  "virtualMachines": [],
  "triggers": []
}

Modifying Nodes

The HTTP PUT method is used to modify Nodes.

Quick reference

PUT http://localhost:8080/mws/rest/nodes/<name>?api-version=3[&proxy-user=<username>]

Restrictions

The proxy-user parameter is ignored unless you set ENABLEPROXY=TRUE in the moab.cfg file. For example:

ADMINCFG[1]           USERS=root,ted ENABLEPROXY=TRUE

Modify Node

URLs and parameters

PUT http://localhost:8080/mws/rest/nodes/<name>?api-version=3[&proxy-user=<username>][&change-mode=set]
Parameter Required Type Valid values Description
name Yes String -- The name of the object.
proxy-user No String -- Perform the action as this user.

See Global URL Parameters for available URL parameters.

Additional URL parameters

Parameter Required Valid values Description
change-mode No

set (default)

add

remove

If set, replace all features with the features specified.

If add, add the specified features to existing features.

If remove, remove the specified features from existing features.

Request body

The request body below shows all the fields that are available when modifying a node, along with some sample values.

Sample JSON request body to modify a node
------------------------------------

{  
  "featuresCustom": ["feature1", "feature2"],
  "messages":   [
    {"message": "Message one"},
    {"message": "Message two"}
  ],
  "metrics": {"pwatts": 211},
  "operatingSystem": {"image": "esx4.1"},
  "partition": "part1",
  "states":   {
    "powerState": "On",
    "state": "Running"
  },
  "variables":   {
    "key": "value",
    "arbitrary text key": "more value"
  }
}

Sample response

This message may not match the message returned from Moab exactly, but is given as an example of the structure of the response.

JSON response
------------------------------------

{"messages":[
  "Successfully modified os to 'linux'",
  "Successfully powered node off"
]}

Related Topics 

© 2015 Adaptive Computing