Add VS from OVA Template
To add a VS with multiple disks based on OVA template, use the following request:
POST /virtual_machines.xml
POST /virtual_machines.json
XML Request Example
curl -i -X POST -u user:userpass --url http://onapp.test/virtual_machines.xml -H 'Accept: application/xml' -H 'Content-type: application/xml' -d '<virtual_machine><template_id>81</template_id><label>zazaxml</label><hostname>zaza</hostname><domain>localdomain</domain><initial_root_password>qwaszx!Q2</initial_root_password><initial_root_password_confirmation>qwaszx!Q2</initial_root_password_confirmation><hypervisor_group_id>8</hypervisor_group_id><hypervisor_id>8</hypervisor_id><memory>1024</memory><cpus>1</cpus><cpu_shares>1</cpu_shares><cpu_units>0</cpu_units><cpu_topology>0</cpu_topology><disks_attributes type="array"><disks_attribute><data_store_id>3</data_store_id></disks_attribute><disks_attribute><data_store_id>1</data_store_id></disks_attribute><disks_attribute><data_store_id>1</data_store_id></disks_attribute></disks_attributes><network_interfaces_attributes type="array"><network_interfaces_attribute><network_id>3</network_id><ip_net_id>2</ip_net_id><ip_range_id>2</ip_range_id><ip_address>10.83.37.111</ip_address><rate_limit>1</rate_limit></network_interfaces_attribute><network_interfaces_attribute><network_id>2</network_id><ip_net_id>1</ip_net_id><ip_range_id>1</ip_range_id><ip_address>10.86.37.112</ip_address><rate_limit>1</rate_limit></network_interfaces_attribute><network_interfaces_attribute><network_id></network_id><ip_net_id></ip_net_id><ip_range_id></ip_range_id><ip_address></ip_address><rate_limit>0</rate_limit></network_interfaces_attribute></network_interfaces_attributes><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><acceleration>0</acceleration></virtual_machine>'
JSON Request Example
curl -i -X POST -u user:userpass --url http://onapp.test/virtual_machines.json -H 'Accept: application/json' -H 'Content-type: application/json' -d '{"virtual_machine": {"template_id": "81", "label": "zaza", "hostname": "zaza", "domain": "localdomain", "initial_root_password": "qwaszx!Q2", "initial_root_password_confirmation": "qwaszx!Q2", "hypervisor_group_id": "8", "hypervisor_id": "8", "memory": "1024", "cpus": "1", "cpu_shares": "1", "cpu_units": "0", "cpu_topology": "0", "disks_attributes": [{"data_store_id": "3"}, {"data_store_id": "1"}, {"data_store_id": "1"}], "network_interfaces_attributes": [{"network_id": "3", "ip_net_id": "2", "ip_range_id": "2", "ip_address": "10.83.37.198", "rate_limit": "1"}, {"network_id": "2", "ip_net_id": "1", "ip_range_id": "1", "ip_address": "10.86.37.199", "rate_limit": "1"}, {"network_id": "", "ip_net_id": "", "ip_range_id": "", "ip_address": "", "rate_limit": "0"}], "required_automatic_backup": "0", "required_virtual_machine_build": "1", "required_virtual_machine_startup": "1", "acceleration": "0"}}'
Where:
template_id - the ID of a template from which a VS should be built
label* - user-friendly VS description
hostname* - set the host name for this VS
domain - specify the domain for this 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 [ _ ], and the following special characters: ~ ! @ # $ * _ - + = ` \\ { } [ ] : ; ' , . ? /. You can use both lower- and uppercase letters.
The following characters are not allowed for Windows-based virtual servers:
- percent sign [%]
- double quotation marks [“]
- brackets [<,>]
- vertical bar [|]
- caret [^]
- ampersand [&]
- parentheses [(,)]
initial_root_password_confirmation - confirm the root password for a 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)
memory - amount of RAM assigned to the VS
cpus* - number of CPUs assigned to the VS. For KVM compute resources, this parameter sets CPU sockets by default, unless CPU topology is enabled.
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
cpu_units - the amount of CPU units per core if the CPU priority is replaced with CPU units in user bucket.
cpu_topology - set 1 to enable CPU topology, otherwise set 0
disks_attributes - an array of disk attributes with the following parameters:
- data_store_id - the ID of the data store for VS's disk
network_interfaces_attributes - an array of network interfaces attributes with the following parameters:
- network_id - the ID of the network from which the VS should get the IP address
- ip_net_id - the ID of the IP net from which the IP address should be assigned
- ip_range_id - the ID of the IP range from which the IP address should be assigned
ip_address - the ID of an IP address for the VS
Be aware, that you should choose only public IP address. Otherwise, VS built from OVA will not work properly.
- rate_limit - set 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.
required_automatic_backup - set 1 if you need automatic backups
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")
acceleration - true if acceleration is enabled for the virtual server; otherwise false.
XML Output Example
<virtual_machine> <id type="integer">320</id> <hypervisor_id type="integer">8</hypervisor_id> <template_id type="integer">81</template_id> <identifier>atqvtomzftqjna</identifier> <hostname>zaza</hostname> <memory type="integer">1024</memory> <cpus type="integer">1</cpus> <cpu_shares type="integer">1</cpu_shares> <created_at type="dateTime">2018-08-28T15:39:16+03:00</created_at> <updated_at type="dateTime">2018-08-28T15:39:17+03:00</updated_at> <built type="boolean">false</built> <locked type="boolean">true</locked> <booted type="boolean">false</booted> <xen_id nil="true"/> <remote_access_password>1E5nZ0g00P05</remote_access_password> <local_remote_access_port nil="true"/> <label>zazaxml</label> <recovery_mode nil="true"/> <user_id type="integer">5</user_id> <operating_system>linux</operating_system> <operating_system_distro>rhel</operating_system_distro> <allowed_swap type="boolean">true</allowed_swap> <template_label>CentOS Multi disks and networks KVM</template_label> <min_disk_size type="integer">1</min_disk_size> <allowed_hot_migrate type="boolean">false</allowed_hot_migrate> <note nil="true"/> <admin_note nil="true"/> <suspended type="boolean">false</suspended> <strict_virtual_machine_id nil="true"/> <enable_autoscale type="boolean">false</enable_autoscale> <add_to_marketplace nil="true"/> <state>building</state> <initial_root_password_encrypted type="boolean">false</initial_root_password_encrypted> <edge_server_type nil="true"/> <storage_server_type nil="true"/> <firewall_notrack type="boolean">false</firewall_notrack> <service_password nil="true"/> <preferred_hvs type="array"/> <local_remote_access_ip_address>10.80.0.101</local_remote_access_ip_address> <cpu_units type="integer">10</cpu_units> <cpu_sockets nil="true"/> <draas_keys type="array"/> <iso_id nil="true"/> <cores_per_socket type="integer">0</cores_per_socket> <instance_package_id nil="true"/> <hot_add_cpu nil="true"/> <hot_add_memory nil="true"/> <time_zone nil="true"/> <autoscale_service>0</autoscale_service> <cdboot type="boolean">false</cdboot> <draas_mode type="integer">0</draas_mode> <vapp_id nil="true"/> <vmware_tools nil="true"/> <vcenter_moref nil="true"/> <template_version>1.0</template_version> <openstack_id nil="true"/> <domain>localdomain</domain> <vcenter_reserved_memory type="integer">0</vcenter_reserved_memory> <deleted_at nil="true"/> <properties> </properties> <ip_addresses type="array"> <networking_ip_address> <id type="integer">408</id> <address>10.85.37.111</address> <broadcast>10.85.255.255</broadcast> <network_address>10.85.0.0</network_address> <gateway>10.85.0.1</gateway> <created_at type="dateTime">2018-08-28T15:39:16+03:00</created_at> <updated_at type="dateTime">2018-08-28T15:39:16+03:00</updated_at> <user_id nil="true"/> <pxe type="boolean">false</pxe> <hypervisor_id nil="true"/> <ip_range_id type="integer">2</ip_range_id> <free type="boolean">false</free> <netmask>255.255.0.0</netmask> </networking_ip_address> <networking_ip_address> <id type="integer">409</id> <address>10.84.37.112</address> <broadcast>10.84.255.255</broadcast> <network_address>10.84.0.0</network_address> <gateway>10.84.0.1</gateway> <created_at type="dateTime">2018-08-28T15:39:16+03:00</created_at> <updated_at type="dateTime">2018-08-28T15:39:16+03:00</updated_at> <user_id nil="true"/> <pxe type="boolean">false</pxe> <hypervisor_id nil="true"/> <ip_range_id type="integer">1</ip_range_id> <free type="boolean">false</free> <netmask>255.255.0.0</netmask> </networking_ip_address> <networking_ip_address> <id type="integer">410</id> <address>69.168.237.200</address> <broadcast>69.168.255.255</broadcast> <network_address>69.168.0.0</network_address> <gateway>69.168.237.1</gateway> <created_at type="dateTime">2018-08-28T15:39:16+03:00</created_at> <updated_at type="dateTime">2018-08-28T15:39:16+03:00</updated_at> <user_id nil="true"/> <pxe type="boolean">false</pxe> <hypervisor_id nil="true"/> <ip_range_id type="integer">42</ip_range_id> <free type="boolean">false</free> <netmask>255.255.0.0</netmask> </networking_ip_address> </ip_addresses> <monthly_bandwidth_used type="decimal">0.0</monthly_bandwidth_used> <total_disk_size type="integer">19</total_disk_size> <support_incremental_backups type="boolean">false</support_incremental_backups> <cpu_priority type="integer">1</cpu_priority> <built_from_iso type="boolean">false</built_from_iso> <built_from_ova type="boolean">true</built_from_ova> <acceleration type="boolean">false</acceleration> <acceleration_status>Inactive</acceleration_status> <hypervisor_type>kvm</hypervisor_type> </virtual_machine>
Where:
id - the VS id
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)
template_id - the ID of the template the VS is based on
identifier - the VS identifier
hostname - the host name for this VS
memory - amount of RAM assigned to the VS
cpus - number of CPUs assigned to the VS. For KVM compute resources, this parameter sets CPU sockets by default, unless CPU topology is enabled.
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
created_at - the date in the [YYYY][MM][DD]T[hh][mm][ss]Z format
updated_at - the date when the VS was updated in the [YYYY][MM][DD]T[hh][mm][ss]Z format
built - true if the VS is built, otherwise false
locked - true if the VS is locked; otherwise false
booted - true if the VS is running, otherwise false
xen_id - the VS ID set by the virtualization engine
remote_access_password - the password for the remote access
local_remote_access_port - the port ID used for console access
label - the VS label
recovery_mode - true if recovery mode allowed. Otherwise false
user_id - the ID of a user assigned to this VS
operating_system - operating system used by the VS
operating_system_distro - the distribution of the OS from which this virtual server is built
allowed_swap - true if swap disk is allowed (depends on the template the virtual server is based on); otherwise false
template_label - the name of the template from which this virtual server is built
min_disk_size - the minimum disk size required to build a VS from a specified template
allowed_hot_migrate - true if the template, on which the VS is based, supports hot migration; otherwise false
note - an optional reminder for this virtual server made by a user account
admin_note - an optional note of the administrator
suspended - true if VS is suspended, otherwise false
strict_virtual_machine_id - the ID of a virtual server that will never reside on the same compute resource with this VS
enable_autoscale - true if autoscaling is allowed for this VS
add_to_marketplace - empty for VSs; used for edge servers only
state - parameter reserved for future use
initial_root_password_encrypted - true, if the root password is encrypted, otherwise false.
edge_server_type - true if this is the edge server
storage_server_type - true if this is a storage server
firewall_notrack - true if the NOTRACK rule is set in iptables
service_password - service account password
preferred_hvs - the array of preferable compute resources based on compute zone that meet some VS configuration settings
local_remote_access_ip_address - IP address used for remote access
cpu_units - the amount of CPU units per core if the CPU priority is replaced with CPU units in user billing plan.
cpu_sockets - the amount of CPU sockets per core. This parameter can be set for KVM compute resources only by those users who have Enable CPU topology permission granted
iso_id - the ID of the ISO the VS is based on
cores_per_socket - the amount of cores_per_socket
instance_package_id - ID of the instance package
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
time_zone - the time zone set for the VS. This parameter is applicable only to Windows KVM and XEN virtual servers.
draas_mode - true if DRaaS is enabled for the Cloud; otherwise false
vapp_id - the ID of the vApp
vmware_tools - the ID of the VMware tools
vcenter_moref - the ID of the vCenter unit
template_version - version of the template
domain - specify the domain for this 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.
vcenter_reserved_memory - amount of RAM assigned to the vCenter VS
deleted_at - time when the VS was deleted
ip_addresses - an array of IP addresses with the following parameters:
- networking_ip_address - the address of the network
- id - the ID of the IP address
- address - IP address
- broadcast - broadcast address
- network_address - network address
- gateway - gateway address
- created_at type - the date in the [YYYY][MM][DD]T[hh][mm][ss]Z format
- updated_at type - the date in the [YYYY][MM][DD]T[hh][mm][ss]Z format
- user_id - the ID of the user this IP address is assigned to
- pxe type - true, if this address can be used for cloudbooting a compute resource
- hypervisor_id - the ID of a compute resource the IP address is associated with
- ip_range_id - the ID of the IP range from which the IP address should be assigned
- free - true if free, otherwise false
- netmask - netmask for the IP address
monthly_bandwidth_used - VS monthly bandwidth in KB
total_disk_size - the total disk size in GB of all disks assigned to the VS
support_incremental_backups - 1, if the VS supports incremental backups, and 0 if it does not.
cpu_priority - this is a new parameter reserved for further use; currently will have the same value as cpu_shares
built_from_iso - true if the VS is built from ISO; otherwise false
built_from_ova - true if the VS is built from ISO; otherwise false
acceleration - true if the VS is built from ISO; otherwise false
acceleration_status - the status of acceleration: active or inactive.
hypervisor_type - the type of the compute resource the VS is built on (for example: xen, kvm, vcloud, vmware)
virsh_console - set true to enable Virsh console for the VS, otherwise, false
Page History
v. 6.1 Edge 2
- added the virsh_console parameter