Add VMware VS
Virtual servers running on VMware compute resources are managed exactly the same as common virtual servers. The only difference is the creation process.
To create a VMware virtual server, use the following request:
POST /virtual_machines.xml
POST /virtual_machines.json
XML Request Example
curl -i -X POST -d '<virtual_machine><template_id>267</template_id><licensing_key></licensing_key><label>zaza_ware_xml</label><hostname>zaza</hostname><hypervisor_group_id>72</hypervisor_group_id><hypervisor_id>29</hypervisor_id><initial_root_password>qwaszx</initial_root_password><initial_root_password_confirmation>qwaszx</initial_root_password_confirmation><memory>128</memory><cpus>1</cpus><cpu_shares>1</cpu_shares><data_store_group_primary_id>84</data_store_group_primary_id><primary_disk_size>25</primary_disk_size><data_store_group_swap_id>84</data_store_group_swap_id><swap_disk_size>0</swap_disk_size><customer_network_id>63</customer_network_id><required_automatic_backup>0</required_automatic_backup><required_virtual_machine_build>1</required_virtual_machine_build><required_virtual_machine_startup>1</required_virtual_machine_startup><enable_autoscale>0</enable_autoscale><required_ip_address_assignment>1</required_ip_address_assignment><custom_recipe_variables><custom_recipe_variable><name>varname</name><value>value</value><enabled>1</enabled></custom_recipe_variable</custom_recipe_variables></virtual_machine>' -u user:userpass http://onapp.test/virtual_machines.xml -H 'Accept: application/xml' -H 'Content-type: application/xml'
JSON Request Example
curl -i -X POST -d '{"virtual_machine":{"template_id":"267", "licensing_key":"", "label":"zaza_ware_json", "hostname":"zaza", "hypervisor_group_id":"72", "hypervisor_id":"29", "initial_root_password":"qwaszx", "initial_root_password_confirmation":"qwaszx", "memory":"128", "cpus":"1", "cpu_shares":"1", "data_store_group_primary_id":"84", "primary_disk_size":"25", "data_store_group_swap_id":"84", "swap_disk_size":"0", "customer_network_id":"63", "required_automatic_backup":"0", "required_virtual_machine_build":"1", "required_virtual_machine_startup":"1", "enable_autoscale":"0", "required_ip_address_assignment":"1","custom_recipe_variables":{"custom_recipe_variable":{"name":"varname","value":"var_value","enabled":"1"}}}}}}' -u user:userpass http://onapp.test/virtual_machines.json -H 'Accept: application/json' -H 'Content-type: application/json'
Where:
memory* - amount of RAM assigned to the VS
cpus* - number of CPUs assigned to the VS
cpu_shares* - required parameter. For KVM compute resource the CPU priority value is always 100. For XEN, set a custom value. The default value for XEN is 1
hostname* - set the host name for this VS
label* - user-friendly VS description
primary_disk_size* - set the disk space for this VS
swap_disk_size* - set swap space. There is no swap disk for Windows-based VSs
type_of_format - type of filesystem - ext4. For Linux templates, you can choose ext4 file system instead of the ext3 default one
data_store_group_primary_id - set the ID of the data store zone to which this primary disk is allocated
data_store_group_swap_id - set the ID of the data store zone to which this swap disk is allocated
primary_network_id - the ID of the primary network. Optional parameter that can be used only if it is assigned to the network zone
primary_network_group_id - the ID of the primary network group. Optional parameter
required_automatic_backup - set 1 if you need automatic backups
rate_limit - set max port speed. Optional parameter: if none set, the system sets port speed to unlimited
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")
required_ip_address_assignment* - set "1" if you want IP address to be assigned automatically after creation. Otherwise set "0"
admin_note - enter a brief comment for the VS. Optional parameter
note - a brief comment a user can add to a VS
template_id* - the ID of a template from which a VS should be built
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: mak, kms 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
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)
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 [ _ ], and the following special characters: ~ ! @ # $ * _ - + = ` \\ { } [ ] : ; ' , . ? /. You can use both lower- and uppercase letters.
NOTE: It is not possible to set VS password when creating a Windows-based VMware virtual server without running a sysprep.
custom_variables - an 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
Page History
v.3.1
- added the following parameters:
- custom_variables
- enabled
- id
- name
- value