To edit a vCenter virtual server, use the following request:
PUT /virtual_machines:id.xml
PUT /virtual_machines:id.json
XML Request Example
curl -i -X PUT -u user_email:api_key --url http://onapp.test/>virtual_machines/:id.xml -H 'Accept: application/xml' -H 'Content-type: application/xml' -d '<virtual_machine><cpu_shares>40</cpu_shares><cpus>2</cpus><hot_add_cpu>true</hot_add_cpu><hot_add_memory>true</hot_add_memory><label>test_api</label><memory>1024</memory></virtual_machine>'
CODE
JSON Request Example
curl -i -X PUT -u user_email:api_key --url http://onapp.test/virtual_machines/:id.json -H 'Accept: application/json' -H 'Content-type: application/json' -d '{"virtual_machine": {"label": "test_api", "hot_add_cpu": true, "hot_add_memory": true, "memory": 1024, "cpus": 2, "cpu_shares": 40}}'
CODE
Where:
cpu_shares - the CPU priority value
cpus - the number of CPU cores assigned to the VS
hot_add_cpu - true if the CPU parameter can be changed without rebooting the VS; otherwise, false
hot_add_memory - true if the memory parameter can be changed without rebooting the VS; otherwise, false
label - the label of the VS
memory - the amount of RAM assigned to the VS