From e8eb7d55f9a60485a6a8c8bc3ac87d9c852c7497 Mon Sep 17 00:00:00 2001 From: bybai Date: Mon, 9 Apr 2018 23:10:59 -0400 Subject: [PATCH] add nodels doc --- .../restapi_resource/restapi_reference.rst | 235 ++++++++++-------- 1 file changed, 132 insertions(+), 103 deletions(-) diff --git a/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst b/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst index d2cf1f937..d8b74d00d 100644 --- a/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst +++ b/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst @@ -15,10 +15,10 @@ POST - Create a token. **Example:** -Acquire a token for user 'root'. :: +Aquire a token for user 'root'. :: - #curl -X POST -k 'https://127.0.0.1/xcatws/tokens?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"userName":"root","userPW":"cluster"}' + curl -X POST -k 'https://127.0.0.1/xcatws/tokens?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"userName":"root","userPW":"cluster"}' { "token":{ "id":"a6e89b59-2b23-429a-b3fe-d16807dd19eb", @@ -52,7 +52,7 @@ Refer to the man page: :doc:`lsdef ` + +**Returns:** + +* Json format: An array of node names. + +**Example:** + +Get the node names from xCAT database. :: + + + curl -X GET -k 'https://127.0.0.1/xcatws/nodes/node[1-3]/nodels?userName=root&userPW=cluster&pretty=1' + [ + "node1", + "node2", + "node3", + ] + [URI:/nodes/{noderange}/subnodes] - The sub-nodes resources for the node {noderange} ------------------------------------------------------------------------------------ @@ -301,7 +322,7 @@ Refer to the man page: :doc:`rscan ` Get all the inventory attributes for node1. :: - #curl -X GET -k 'https://127.0.0.1/xcatws/nodes/node1/inventory?userName=root&userPW=cluster&pretty=1' + curl -X GET -k 'https://127.0.0.1/xcatws/nodes/node1/inventory?userName=root&userPW=cluster&pretty=1' { "node1":{ "DIMM 21 ":"8GB PC3-12800 (1600 MT/s) ECC RDIMM", @@ -673,7 +694,7 @@ Refer to the man page: :doc:`rinv ` Get the 'model' inventory attribute for node1. :: - #curl -X GET -k 'https://127.0.0.1/xcatws/nodes/node1/inventory/model?userName=root&userPW=cluster&pretty=1' + curl -X GET -k 'https://127.0.0.1/xcatws/nodes/node1/inventory/model?userName=root&userPW=cluster&pretty=1' { "node1":{ "System Description":"System x3650 M4", @@ -698,7 +719,7 @@ Refer to the man page: :doc:`reventlog ` Run the 'date' command on the node2. :: - #curl -X POST -k 'https://127.0.0.1/xcatws/nodes/node2/nodeshell?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"command":["date","ls"]}' + curl -X POST -k 'https://127.0.0.1/xcatws/nodes/node2/nodeshell?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"command":["date","ls"]}' { "node2":[ " Wed Apr 3 08:30:26 CST 2013", @@ -925,7 +946,7 @@ Refer to the man page: :doc:`xdcp ` Copy files /tmp/f1 and /tmp/f2 from xCAT MN to the node2:/tmp. :: - #curl -X POST -k 'https://127.0.0.1/xcatws/nodes/node2/nodecopy?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"src":["/tmp/f1","/tmp/f2"],"target":"/tmp"}' + curl -X POST -k 'https://127.0.0.1/xcatws/nodes/node2/nodecopy?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"src":["/tmp/f1","/tmp/f2"],"target":"/tmp"}' no output for succeeded copy. [URI:/nodes/{noderange}/vm] - The virtualization node {noderange}. @@ -953,20 +974,20 @@ Refer to the man page: :doc:`chvm ` Set memory to 3000MB. :: - #curl -X PUT -k 'https://127.0.0.1/xcatws/nodes/node1/vm?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"memorysize":"3000"}' + curl -X PUT -k 'https://127.0.0.1/xcatws/nodes/node1/vm?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"memorysize":"3000"}' **Example2:** Add a new 20G disk. :: - #curl -X PUT -k 'https://127.0.0.1/xcatws/nodes/node1/vm?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"adddisk":"20G"}' + curl -X PUT -k 'https://127.0.0.1/xcatws/nodes/node1/vm?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"adddisk":"20G"}' **Example3:** Purge the disk 'hdb'. :: - #curl -X PUT -k 'https://127.0.0.1/xcatws/nodes/node1/vm?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"purgedisk":"hdb"}' + curl -X PUT -k 'https://127.0.0.1/xcatws/nodes/node1/vm?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"purgedisk":"hdb"}' POST - Create the vm node {noderange}. `````````````````````````````````````` @@ -988,8 +1009,8 @@ Refer to the man page: :doc:`mkvm ` Create the vm node1 with a 30G disk, 2048M memory and 2 cpus. :: - #curl -X POST -k 'https://127.0.0.1/xcatws/nodes/node1/vm?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"disksize":"30G","memorysize":"2048","cpucount":"2"}' + curl -X POST -k 'https://127.0.0.1/xcatws/nodes/node1/vm?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"disksize":"30G","memorysize":"2048","cpucount":"2"}' DELETE - Remove the vm node {noderange}. ```````````````````````````````````````` @@ -1009,8 +1030,8 @@ Refer to the man page: :doc:`rmvm ` Remove the vm node1 by force and purge the disk. :: - #curl -X DELETE -k 'https://127.0.0.1/xcatws/nodes/node1/vm?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"force":"yes","purge":"yes"}' + curl -X DELETE -k 'https://127.0.0.1/xcatws/nodes/node1/vm?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"force":"yes","purge":"yes"}' [URI:/nodes/{noderange}/vmclone] - The clone resource for the virtual node {noderange}. --------------------------------------------------------------------------------------- @@ -1038,7 +1059,7 @@ Refer to the man page: :doc:`clonevm ` Generates a stateless image based on the specified osimage :: - #curl -X POST -k 'https://127.0.0.1/xcatws/osimages/sles11.2-x86_64-install-compute/instance?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"action":"gen"}' + curl -X POST -k 'https://127.0.0.1/xcatws/osimages/sles11.2-x86_64-install-compute/instance?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"action":"gen"}' **Example2:** Packs the stateless image from the chroot file system based on the specified osimage :: - #curl -X POST -k 'https://127.0.0.1/xcatws/osimages/sles11.2-x86_64-install-compute/instance?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"action":"pack"}' + curl -X POST -k 'https://127.0.0.1/xcatws/osimages/sles11.2-x86_64-install-compute/instance?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"action":"pack"}' **Example3:** Exports an xCAT image based on the specified osimage :: - #curl -X POST -k 'https://127.0.0.1/xcatws/osimages/sles11.2-x86_64-install-compute/instance?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"action":"export"}' + curl -X POST -k 'https://127.0.0.1/xcatws/osimages/sles11.2-x86_64-install-compute/instance?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"action":"export"}' DELETE - Delete the stateless or statelite image instance for the osimage {imgname} from the file system ```````````````````````````````````````````````````````````````````````````````````````````````````````` @@ -1290,8 +1312,8 @@ Refer to the man page: :doc:`rmimage ", @@ -1391,8 +1414,8 @@ Refer to the man page: :doc:`chdef