Test

Da Wiki Neen.
(Differenze fra le revisioni)
(Pagina svuotata)
 
(2 revisioni intermedie di un utente non mostrate)
Riga 1: Riga 1:
<br>
 
  
<br> 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 '&lt;virtual_machine&gt;&lt;template_id&gt;8&lt;/template_id&gt;&lt;licensing_key&gt;&lt;/licensing_key&gt;&lt;label&gt;zaza&lt;/label&gt;&lt;hostname&gt;zaza&lt;/hostname&gt;&lt;hypervisor_group_id&gt;14&lt;/hypervisor_group_id&gt;&lt;hypervisor_id&gt;1&lt;/hypervisor_id&gt;&lt;initial_root_password&gt;ehgebhewvtwh&lt;/initial_root_password&gt;&lt;memory&gt;128&lt;/memory&gt;&lt;cpus&gt;1&lt;/cpus&gt;&lt;cpu_shares&gt;1&lt;/cpu_shares&gt;&lt;data_store_group_primary_id&gt;18&lt;/data_store_group_primary_id&gt;&lt;primary_disk_size&gt;5&lt;/primary_disk_size&gt;&lt;primary_disk_min_iops&gt;100&lt;/primary_disk_min_iops&gt;&lt;data_store_group_swap_id&gt;18&lt;/data_store_group_swap_id&gt;&lt;swap_disk_size&gt;1&lt;/swap_disk_size&gt;&lt;swap_disk_min_iops&gt;100&lt;/swap_disk_min_iops&gt;&lt;primary_network_group_id&gt;19&lt;/primary_network_group_id&gt;&lt;selected_ip_address_id&gt;386&lt;/selected_ip_address_id&gt;&lt;rate_limit&gt;1&lt;/rate_limit&gt;&lt;required_ip_address_assignment&gt;1&lt;/required_ip_address_assignment&gt;&lt;required_automatic_backup&gt;0&lt;/required_automatic_backup&gt;&lt;required_virtual_machine_build&gt;1&lt;/required_virtual_machine_build&gt;&lt;required_virtual_machine_startup&gt;1&lt;/required_virtual_machine_startup&gt;&lt;type_of_format&gt;ext4&lt;/type_of_format&gt;&lt;enable_autoscale&gt;0&lt;/enable_autoscale&gt;&lt;custom_recipe_variables&gt;&lt;custom_recipe_variable&gt;&lt;name&gt;varname&lt;/name&gt;&lt;value&gt;value&lt;/value&gt;&lt;enabled&gt;1&lt;/enabled&gt;&lt;recipe_ids type='array'&gt;&lt;recipe_id&gt;11&lt;/recipe_id&gt;&lt;/recipe_ids&gt;&lt;/custom_recipe_variable&gt;&lt;/custom_recipe_variables&gt;&lt;/virtual_machine&gt;' --url http://onapp.test/virtual_machines.xml
 
 
<br> JSON Request example
 
 
curl -i -X POST -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass -d '{"virtual_machine":{"template_id":"8", "licensing_key":"", "label":"zaza", "hostname":"zaza", "hypervisor_group_id":"14", "hypervisor_id":"1", "initial_root_password":"tyrhsghj657th", "memory":"128", "cpus":"1", "cpu_shares":"1", "data_store_group_primary_id":"18", "primary_disk_size":"5", "primary_disk_min_iops":"100", "data_store_group_swap_id":"18", "swap_disk_size":"1", "swap_disk_min_iops":"100", "primary_network_group_id":"19", "selected_ip_address_id":"386", "rate_limit":"1", "required_ip_address_assignment":"1", "required_automatic_backup":"0", "required_virtual_machine_build":"1", "required_virtual_machine_startup":"1", "type_of_format":"ext4", "enable_autoscale":"0","recipe_ids":["11"],"custom_recipe_variables":{"custom_recipe_variable":{"name":"varname","value":"var_value","enabled":"1"}}}}' --url http://onapp.test/virtual_machines.json
 
 
<br> The following parameters should be sent:
 
 
memory* - amount of RAM assigned to the VS
 
 
cpus* - number of CPUs assigned to the VS
 
 
cpu_shares* - required parameter. For KVM hypervisor 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
 
 
primary_disk_min_iops - minimum number of IO operations per second for primary disk (this is a SolidFire related parameter)
 
 
swap_disk_min_iops - minimum number of IO operations per second for swap disk (this is a SolidFire related parameter)
 
 
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"
 
 
selected_ip_address_id - specify ID of an IP address to assign to this VS
 
 
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 licensing server/template group – this parameter is for Windows XP/7 virtual machines only
 
 
licensing_type - the type of a license: MAK, KMS or user own license. This parameter is for Windows XP/7 virtual machines only
 
 
licensing_key - the key of a license. This parameter is for Windows XP/7 virtual machines only
 
 
hypervisor_group_id - the ID of the hypervisor zone in which the VS will be created. Optional: if no hypervisor zone is set, the VS will be built in any available hypervisor zone
 
 
hypervisor_id - the ID of a hypervisor where the VS will be built. Optional: if no hypervisor ID is specified, the VS will be built on the hypervisor 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 [ _ ]. You can use both lowercase and uppercase letters
 
 
initial_root_password_encryption_key - specify the password encryption passphrase
 
 
(lightbulb)recipe_ids - an array of recipe ID you want to run on the virtual server provisioning
 
 
(lightbulb) 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
 
 
XML Output example
 
 
&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;virtual_machine&gt;
 
 
  &lt;add_to_marketplace nil="true"/&gt;
 
&lt;admin_note nil="true"/&gt;
 
&lt;allow_resize_without_reboot type="boolean"&gt;false&lt;/allow_resize_without_reboot&gt;
 
&lt;allowed_hot_migrate type="boolean"&gt;true&lt;/allowed_hot_migrate&gt;
 
&lt;allowed_swap type="boolean"&gt;true&lt;/allowed_swap&gt;
 
&lt;booted type="boolean"&gt;false&lt;/booted&gt;
 
&lt;built type="boolean"&gt;false&lt;/built&gt;
 
&lt;cpu_shares type="integer"&gt;1&lt;/cpu_shares&gt;
 
&lt;cpus type="integer"&gt;1&lt;/cpus&gt;
 
&lt;created_at type="datetime"&gt;2013-06-11T16:03:58+03:00&lt;/created_at&gt;
 
&lt;customer_network_id nil="true"/&gt;
 
&lt;deleted_at nil="true"/&gt;
 
&lt;edge_server_type nil="true"/&gt;
 
&lt;enable_autoscale type="boolean"&gt;false&lt;/enable_autoscale&gt;
 
&lt;enable_monitis type="boolean"&gt;false&lt;/enable_monitis&gt;
 
&lt;firewall_notrack type="boolean"&gt;false&lt;/firewall_notrack&gt;
 
&lt;hostname&gt;zaza&lt;/hostname&gt;
 
&lt;hypervisor_id type="integer"&gt;1&lt;/hypervisor_id&gt;
 
&lt;id type="integer"&gt;15&lt;/id&gt;
 
&lt;identifier&gt;l2lnf62bs44bjf&lt;/identifier&gt;
 
 
&lt;initial_root_password&gt;ehgebhewvtwh&lt;/initial_root_password&gt;
 
 
  &lt;initial_root_password_encrypted type="boolean"&gt;false&lt;/initial_root_password_encrypted&gt;
 
&lt;label&gt;zaza&lt;/label&gt;
 
 
&lt;local_remote_access_ip_address&gt;109.123.91.35&lt;/local_remote_access_ip_address&gt;
 
 
  &lt;local_remote_access_port nil="true"/&gt;
 
&lt;locked type="boolean"&gt;true&lt;/locked&gt;
 
&lt;memory type="integer"&gt;128&lt;/memory&gt;
 
&lt;min_disk_size type="integer"&gt;5&lt;/min_disk_size&gt;
 
&lt;note nil="true"/&gt;
 
&lt;operating_system&gt;linux&lt;/operating_system&gt;
 
 
&lt;operating_system_distro&gt;ubuntu&lt;/operating_system_distro&gt;
 
 
  &lt;preferred_hvs type="array"/&gt;
 
&lt;recovery_mode nil="true"/&gt;
 
 
&lt;remote_access_password&gt;x9yk3fIMXZBG&lt;/remote_access_password&gt;
 
 
  &lt;service_password nil="true"/&gt;
 
&lt;state&gt;new&lt;/state&gt;
 
&lt;storage_server_type nil="true"/&gt;
 
&lt;strict_virtual_machine_id nil="true"/&gt;
 
&lt;suspended type="boolean"&gt;false&lt;/suspended&gt;
 
&lt;template_id type="integer"&gt;8&lt;/template_id&gt;
 
&lt;template_label&gt;Ubuntu 13.04 x64&lt;/template_label&gt;
 
&lt;updated_at type="datetime"&gt;2013-06-11T16:03:59+03:00&lt;/updated_at&gt;
 
&lt;user_id type="integer"&gt;1&lt;/user_id&gt;
 
&lt;vip nil="true"/&gt;
 
&lt;xen_id nil="true"/&gt;
 
&lt;ip_addresses type="array"&gt;
 
  &lt;ip_address&gt;
 
    &lt;address&gt;109.123.91.171&lt;/address&gt;
 
    &lt;broadcast&gt;109.123.91.191&lt;/broadcast&gt;
 
    &lt;created_at type="datetime"&gt;2013-06-11T14:16:21+03:00&lt;/created_at&gt;
 
    &lt;customer_network_id nil="true"/&gt;
 
    &lt;disallowed_primary type="boolean"&gt;false&lt;/disallowed_primary&gt;
 
    &lt;gateway&gt;109.123.91.129&lt;/gateway&gt;
 
    &lt;hypervisor_id nil="true"/&gt;
 
    &lt;id type="integer"&gt;386&lt;/id&gt;
 
    &lt;ip_address_pool_id nil="true"/&gt;
 
    &lt;network_address&gt;109.123.91.128&lt;/network_address&gt;
 
    &lt;network_id type="integer"&gt;9&lt;/network_id&gt;
 
    &lt;pxe type="boolean"&gt;false&lt;/pxe&gt;
 
    &lt;updated_at type="datetime"&gt;2013-06-11T14:16:21+03:00&lt;/updated_at&gt;
 
    &lt;user_id nil="true"/&gt;
 
    &lt;free type="boolean"&gt;false&lt;/free&gt;
 
    &lt;netmask&gt;255.255.255.192&lt;/netmask&gt;
 
  &lt;/ip_address&gt;
 
&lt;/ip_addresses&gt;
 
&lt;monthly_bandwidth_used&gt;0&lt;/monthly_bandwidth_used&gt;
 
&lt;total_disk_size type="integer"&gt;6&lt;/total_disk_size&gt;
 
 
&lt;/virtual_machine&gt;
 
 
Where:
 
 
add_to_marketplace – true, if the edge server is added to marketplace. The default value is "false". This parameter is for CDN servers only.
 
 
admin_note - administrator comment for the VS
 
 
allowed_resize_without_reboot – true if resize without reboot is allowed, otherwise false
 
 
allowed_hot_migrate – true if hot migration is allowed, otherwise false
 
 
allowed_swap – true if swap is allowed, otherwise false
 
 
booted - true, if the VS is boothed, otherwise false
 
 
built - true, if the VS is built, otherwise false
 
 
cpu_shares - the percentage of allocated CPU priority resource
 
 
cpus - number of CPUs assigned to the VS
 
 
created_at – the date when the VS was created in the [YYYY][MM][DD]T[hh][mm][ss] format
 
 
updated_at – the date when the VS was updated in the [YYYY][MM][DD]T[hh][mm][ss] format
 
 
customer_network_id - ID of the customer network
 
 
edge_server_type - type of the CDN edge server. This parameter is for CDN servers only.
 
 
enable_autoscale — true if autoscaling is allowed for this VS
 
 
enable_monitis - deprecated attribute
 
 
firewall notrack - parameter for adding firewall rules. It true for edge servers only.
 
 
hostname - VS hostname
 
 
hypervisor_id – the ID of the hypervisor, on which the server is deployed
 
 
id – the VS ID in OnApp CP database
 
 
identifier – the VS identifier
 
 
initial_root_password — the VS root password
 
 
initial_root_password_encrypted - true, if the root password is encrypted, otherwise false
 
 
label - user-friendly VS description
 
 
local_remote_access_ip_address - IP address for remote connection
 
 
local_remote_access_port - port for remote connection
 
 
locked - true if the VS is locked; otherwise false
 
 
memory - the RAM size allocated to this VS
 
 
min_disk_size — the minimum disk size required to build a VS from a specified template
 
 
operating_system — operating system used by the VS
 
 
operating_system_distro — the distribution of the OS from which this VS is built
 
 
recovery_mode - true if recovery mode allowed, otherwise false
 
 
remote_access_password — the password for the remote access
 
 
service_password - password of a service user
 
 
storage_server_type -
 
 
strict_virtual_machine_id - the ID of a virtual machine that will never reside on the same HV with this VS
 
 
suspended - true if VS is suspended, otherwise false
 
 
template_id - the ID of the template the VS is based on
 
 
template_label - the name of the template from which this VS is built
 
 
user_id — the ID of a user assigned to this VS
 
 
vip — true if the VS has VIP status (gives migration priority)
 
 
xen_id — the VS ID set by the virtualization engine
 
 
ip_addresses - an array of IP addresses with the following parameters:
 
 
    address - IP address
 
  broadcast - broadcast address
 
  created_at - the date when the IP address was created in the [YYYY][MM][DD]T[hh][mm][ss]Z format
 
  disallowed_primary - true if not allowed to be used as primary (for VS build), otherwise false
 
  gateway - gateway address
 
  id - the ID of the IP address
 
  ip_address_pool_id - ID of the IP address pool to the IP address belongs to
 
  network_address - the address of the network
 
  network_id - the ID of the network
 
  updated_at - the date when the IP address was updated in the [YYYY][MM][DD]T[hh][mm][ss]Z format
 
  user_id - the ID of a user associated with this IP address
 
  free - true if free, otherwise false
 
  netmask - netmask for the IP address
 
 
monthly_bandwidth_used - VS monthly bandwidth
 
 
total_disk_size - total VS disk size Page history
 
 
In the 3.1 version the following parameters have been added to the Create VS API request:
 
 
    custom_variables
 
  enabled
 
  id
 
  name
 
  value
 
 
<br>
 
 
<br>
 

Versione attuale delle 12:24, 20 feb 2014

Strumenti personali
Namespace
Varianti
Azioni
Navigazione
Strumenti