Add vCenter VS

Virtual servers running on vCenter compute resources are managed exactly the same as normal virtual servers. The only difference is the creation process.

Currently, the use of IPv6 is not supported for vCenter virtual servers.

To create a vCenter virtual server:

POST /virtual_machines.xml
POST /virtual_machines.json

XML Request Example

curl -i -X POST -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:userpass -d '<virtual_machine><template_id>267</template_id><label>new_vs</label><hostname>new_hostname</hostname><initial_root_password>qwaszx</initial_root_password><initial_root_password_confirmation>qwaszx</initial_root_password_confirmation><hypervisor_group_id>72</hypervisor_group_id><hypervisor_id>29</hypervisor_id><datacenter_id>56</datacenter_id><cluster_id>23</cluster_id><memory>128</memory><cpus>1</cpus><cpu_shares>1</cpu_shares><data_store_group_primary_id>84</data_store_group_primary_id><primary_data_store_id>7</primary_data_store_id><primary_disk_size>25</primary_disk_size><network_group_id>2</network_group_id><network_id>7</network_id><ip_net_id>3</ip_net_id><ip_range_id>4</ip_range_id><ip_address>11.111.111.111</ip_address><rate_limit>200</rate_limit><recipe_joins_attributes type='array'><recipe_id>11</recipe_id></recipe_joins_attributes><custom_recipe_variable><enabled>true</enabled><id>62</id><name>custome_variable</name><value>custom_script</value></custom_recipe_variables><service_addon_ids type="array"><service_addon_id>273</service_addon_id><service_addon_id>274</service_addon_id></service_addon_ids><required_virtual_machine_build>true</required_virtual_machine_build><required_virtual_machine_startup>true</required_virtual_machine_startup></virtual_machine>' --url http://onapp.test/virtual_machines.xml 

JSON Request Example

curl -i -X POST -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass -d '{"virtual_machine":{"template_id":"267","label":"new_vs","hostname":"new_hostname","initial_root_password":"qwaszx","initial_root_password_confirmation":"qwaszx","hypervisor_group_id":"72", "hypervisor_id":"29","datacenter_id":"56","cluster_id":"23","memory":"128","cpus":"1","cpu_shares":"1","data_store_group_primary_id":"84","primary_data_store_id":"7","primary_disk_size":"25",
"network_group_id":"2","network_id":"7","ip_net_id":"3","ip_range_id":"4","ip_address":"11.111.111.111","rate_limit":"200","required_virtual_machine_build":"1", "required_virtual_machine_startup":"1","custom_recipe_variables":{"custom_recipe_variable":{"name":"varname","value":"var_value","enabled":"1"}}}}}}' --url http://onapp.test/virtual_machines.json 


Where you have to specify the following parameters:

template_id* - the ID of a template from which the VS should be built

label* - the label of the VS

hostname* - set the host name for the VS

domain - specify the domain for the VS. The default value is localdomain. You can edit the default value for domain in /onapp/interface/config/on_app.yml. This parameter is not applicable for Windows virtual servers. 

initial_root_password - the root password for a VS. Optional, if none specified, the system will provide a random password. It can consist of 6-32 characters, letters [A-Za-z], digits [0-9], dash [ - ] and lower dash [ _ ]. You can use both lower- and uppercase letters.

NOTE: It is not possible to set VS password when creating a Windows-based vCenter virtual server without running a sysprep.

initial_root_password_confirmation - confirm the root password for the VS

hypervisor_group_id - the ID of the compute zone in which the VS will be created. Optional: if no compute zone is set, the VS will be built in any available compute zone.

hypervisor_id - the ID of a compute resource where the VS will be built. Optional: if no compute resource ID is specified, the VS will be built on the compute resource with the least available RAM (but sufficient RAM for the VS).

datacenter_id - the ID of a data center for the data store. Optional: if no data center is set, the VS will be built in any available compute zone.

cluster_id - the ID of the cluster to import networks and data stores from

memory* - the amount of RAM assigned to the VS

cpus* - the number of CPU cores assigned to the VS

cpu_shares* - the CPU priority value

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

data_store_group_primary_id* - set the ID of the data store zone to which this primary disk is allocated

primary_data_store_id* -  the ID of a primary data store for the VS primary disk 

primary_disk_size* - set the disk space for the VS

network_group_id - the ID of the network zone. Optional parameter. 

network_id - the ID of the network. Optional parameter that can be used only if it is assigned to the network zone.

(lightbulb) ip_net_id - the ID of the IP net from which the IP address should be assigned 

(lightbulb) ip_range_id - the ID of the IP range from which the IP address should be assigned

(lightbulb) ip_address - the ID of an IP address for the VS 

rate_limit - set the max port speed in Mbps or set 0 to get maximum port speed allowed by your bucket. If this parameter is omitted or sent without value, the default port speed will be configured for the VS. The default port speed depends on the maximum port speed set in your bucket and the Max network interface port speed parameter at Control Panel > Settings > Configuration. The system identifies which of the two values (in the bucket or in the configuration) is lower and sets it as the default port speed during VS creation.

recipe_joins_attributes - an array of the recipe IDs that you want to run on the virtual server provisioning

recipe_id - the ID of the recipe that you want to assign to the VS

custom_recipe_variable - the array of custom variables with the following details:

  • enabled - true, if the variable is enabled, otherwise false
  • id - variable ID
  • name - variable name
  • value - variable value script

service_addon_ids - the array of service add-on IDs that you want to add to VS. You can assign service add-on only if they are enabled on your license. 

service_addon_id - the ID of the service add-on that you want to add to VS

required_virtual_machine_build* - set 1 to build VS automatically

required_virtual_machine_startup - set 1 to start up the VS automatically, otherwise, set 0 (default state is "1")

licensing_server_id - the ID of a template group where the KMS server details are indicated and to which the template belongs (either directly or through the child group). This parameter is for Windows virtual machines with KMS licensing type only.

licensing_type - the type of a license: makkms, or user own license. This parameter is required for Windows virtual machines only.

licensing_key - the key of a license, required if you have selected own licensing type, and not required for MAK and KMS licensing types. This parameter is required for Windows virtual machines only.


Page history

v.6.0

Added the following parameters:

  • ip_net_id
  • ip_range_id 
  • ip_address

v.5.9

Added the following parameters:

  • datacenter_id 
  • cluster_id 
  • primary_data_store_id 

v.3.1

In the 3.1 version the following parameters have been added to the Create vCenter VS API request:

  • custom_variables
  • enabled
  • id
  • name
  • value