Edit VS

To edit a virtual server, use the following request:

PUT /virtual_machines/:id.xml
PUT /virtual_machines/:id.json

XML Request Example

curl -i -X PUT -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:userpass -d '<virtual_machine><label>Test_API_Edit</label><memory>512</memory><min_iops>600</min_iops><cpu_shares>40</cpu_shares><cpus>4</cpus><allow_migration>1</allow_migration><allow_cold_resize>1</allow_cold_resize><time_zone>Atlantic Time (Canada)</time_zone><cpu_sockets>2</cpu_sockets><cpu_topology>1</cpu_topology></virtual_machine>' --url http://onapp.test/virtual_machines/12.xml 

JSON Request Example

curl -i -X PUT -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass -d '{"virtual_machine":{"label":"Test_API_Edit","memory":"512","min_iops":"600","cpu_shares":"40","cpus":"4","allow_migration":"1", "time_zone": "Atlantic Time (Canada)","allow_cold_resize":"1","cpu_sockets":"2", "cpu_topology":"1"}}' --url http://onapp.test/virtual_machines/12.json

Where:

label - the VS name

allow_migration - set 1 to migrate a VS to a compute resource with sufficient resources if a compute resource has insufficient space to resize. Otherwise, set 0. 

allow_cold_resize – set 1 to switch to cold resize when hot resize failed

time_zone - the time zone set for the VS. This parameter is applicable only to Windows virtual servers.

cpu_sockets - the number of CPU sockets 

cpu_topology - set 1 to tie two or more vCPUs into a single socket. Otherwise, set 0.

If you want to enable topology, make sure you indicate the number of cpu_sockets and cpus for the topology to work properly.


After you edit the server's time zone, you need to stop and then start up the VS.

Currently, the time zone is set at the Compute resource side only. Therefore, users need to set the target time zone inside a Windows VS manually. Setting correct time zone at the Compute resource side helps to keep correct time inside a VS after starting it if time synchronization is not completed for some reason.

For virtual servers built by selecting resources manually:

memory -  the amount of RAM allocated to this VS in Mb

min_iops - the minimum number of IO operations per second

cpus - the number of CPUs of this VS

cpu_shares* - CPU priority percentage

cpu_units - the amount of CPU units per core if the CPU priority is replaced with CPU units in user bucket.

For virtual servers built using instance packages:

instance_package_id - ID of the new instance package

You can only choose from those instance packages that offer more disk size than the current instance package.

After you select a new instance package you can use the extra disk size to create a new disk for the VS or make the existing VS disk larger.


If the VS is modified successfully, an HTTP 204 response is returned. If scheduling for changes fails, an HTTP 422 response is returned.

The primary_disk_min_iops and swap_disk_min_iops parameters are now redundant. Instead, use the min_iops parameter for Edit Disk request.


Page History

v.6.0

  • added min_iops parameter

v.5.8

  • added cpu_sockets and cpu_topology parameters

v.4.1

  • added instance_package_id parameter

v.4.0

  • removed  primary_disk_min_iops and swap_disk_min_iops parameters

v.3.3

  • added cpu_units parameter