5.258 Virtual Containers

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

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

Supported methods

Resource GET PUT POST DELETE
/rest/vcs Get All Virtual Containers -- Create Virtual Container --
/rest/vcs/<id> Get Single Virtual Container Modifying Virtual Containers -- Destroy Virtual Container

This topic contains these sections:

5.258.1 Getting Virtual Containers

The HTTP GET method is used to retrieve Virtual Container information. Queries for all objects and a single object are available.

Quick reference

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

5.258.1.A Get All Virtual Containers

URLs and parameters

GET http://localhost:8080/mws/rest/vcs?api-version=3

See Global URL Parameters for available URL parameters.

Sample response

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

{
  "totalCount": 5,
  "resultCount": 5,
  "results":   [
    {"id": "vc3"},
    {"id": "vc1"},
    {"id": "vc4"},
    {"id": "vc5"},
    {"id": "vc2"}
  ]
}

5.258.1.B Get Single Virtual Container

URLs and parameters

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

See Global URL Parameters for available URL parameters.

Sample response

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

{
  "aclRules": [  {
    "affinity": "POSITIVE",
    "comparator": "LEXIGRAPHIC_EQUAL",
    "type": "USER",
    "value": "root"
  }],
  "createDate": "2011-11-15 14:01:40 UTC",
  "creator": "root",
  "description": "vc2",
  "flags": ["DESTROYWHENEMPTY"],
  "id": "vc2",
  "jobs": [
    {"id":"Moab.1"}
  ],
  "nodes": [
    {"id":"node1"}
  ],
  "owner":   {
    "name": "root",
    "type": "USER"
  },
  "reservations": [
    {"id":"system.1"}
  ],
  "variables":   {
    "a": "b",
    "c": "d"
  },
  "virtualContainers": [
    {"id":"vc3"}
  ],
  "virtualMachines": [
    {"id":"vm1"}
  ]
}

5.258.2 Creating Virtual Containers

The HTTP POST method is used to create Virtual Containers.

Quick reference

POST http://localhost:8080/mws/rest/vcs?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

5.258.2.A Create Virtual Container

URLs and parameters

POST http://localhost:8080/mws/rest/vcs?api-version=3[&proxy-user=<username>]
Parameter Required Type Valid values Description
proxy-user No String -- Perform the action as this user.

See Global URL Parameters for available URL parameters.

Request body

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

JSON request body
------------------------------------

{
  "description": "ted's vc",
  "owner":   {
    "name": "ted",
    "type": "USER"
  },
  "requiredStartDate": "2012-11-08 13:18:47 MST",
  "flags": ["HOLDJOBS"],
  "virtualContainers":     [
    {"id": "vc93"},
    {"id": "vc94"}
  ],
}

Sample response

JSON response for successful POST
------------------------------------

{"id": "vc8"}

Restrictions

5.258.3 Modifying Virtual Containers

The HTTP PUT method is used to modify Virtual Containers.

Quick reference

PUT http://localhost:8080/mws/rest/vcs/<id>?api-version=3&change-mode=<add|remove|set>[&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

5.258.3.A Modify Virtual Container

URLs and parameters

PUT http://localhost:8080/mws/rest/vcs/<id>?api-version=3&change-mode=<add|remove|set>[&proxy-user=<username>]
Parameter Required Type Valid values Description
id Yes String -- The unique identifier of the object
change-mode Yes String

add

remove

set

If add, add the given objects (jobs, VMs, etc) to the objects that already exist.

If remove, modify the attributes of the virtual container itself and not the associated objects.

If set, perform the action as this user.

proxy-user No String -- Perform the action as this user.

See Global URL Parameters for available URL parameters.

Request body

Here are three examples of Virtual Container updates: add objects, remove objects, and update attributes. In each case, the examples below show all the fields that are available, along with some sample values.

Sample responses

These messages may not match the messages returned from Moab exactly, but they are given as examples of the structure of the responses.

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

5.258.4 Destroying Virtual Containers

The HTTP GET method is used to retrieve <name> information.

Quick reference

DELETE http://localhost:8080/mws/rest/vcs/<id>?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

5.258.4.A Destroy Virtual Container

URLs and parameters

DELETE http://localhost:8080/mws/rest/vcs/<id>?api-version=3&[&proxy-user=<username>]
Parameter Required Type Valid values Description
id Yes String -- The unique identifier of the object
proxy-user No String -- Perform the action as this user.

See Global URL Parameters for available URL parameters.

Sample response

JSON response for successful DELETE
------------------------------------

{}

Related Topics 

© 2016 Adaptive Computing