Use the Edit Plans API to update a plans for the VPS. Plans help facilitate the creation of Virtual Private Servers on your server. The API response will contain "done" as "1" if the plan is updated successfully.
HTTP Request
https://hostname:4085/index.php?act=editplan&plid=PLID
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | addplan | The action specified to perform operation | Yes |
plid | POST | Int | The ID of the plan to be edited | Yes |
is_enabled | POST | Boolean | Provide 1 to enable the plan and 0 to disable the plan | |
plan_name | POST | text | Name of the plan | Yes |
cplan | POST | text | The Virt type of Plan(openvz,kvm,xcp,xcphvm,xen,xenhvm,lxc,vzo,vzk, proxo, proxk, proxl) | Yes |
disk_space | POST | Int | Amount of disk space in GB for the VPS | Yes |
guaranteed_ram | POST | Int | Amount of ram in MB for the VPS | Yes |
swapram | POST | Int | Amount of swap ram for the VPS (Required for kvm,xcp, xcphvm, xen, xenhvm, lxc, vzo, vzk, proxo ) | Yes |
burst_ram | POST | Int | Amount of burst ram for the VPS(Required for OpenVz ) | No |
bandwidth | POST | Int | Network bandwidth in GB(Setting 0 will set bandwidth to unlimited) | Yes |
network_speed | POST | Int | Network speed in KB/s | No |
cpu_units | POST | Int | The amount of CPU units to be set | Yes |
cpu_cores | POST | Int | The amount of CPU cores to be set | Yes |
percent_cpu | POST | Int | The total amount of CPU processing in percent to be given to a VPS | Yes |
priority | POST | Int | I/O priority (Required for OpenVz ). Valid values are 1-7. | No |
ips | POST | Int | The number IPv4 ips | No |
ips6_subnet | POST | Int | The number of ipv6 subnet | No |
ips6 | POST | Int | The number of ipv6 address | No |
ips_int | POST | Int | The number of internal ips to be specified | No |
ploop | POST | 1/0 | 1 to enable ploop | No |
virtio | POST | 1/0 | This will enable/disable virtio for the vps | No |
acpi | POST | 1/0 | This will enable/disable acpi for the vps | No |
apic | POST | 1/0 | This will enable/disable apic for the vps | No |
pae | POST | 1/0 | This will enable/disable pae for the vps | No |
mgs | POST | array | This will assign the media group to the vps | No |
upload_speed | POST | Int | The upload speed for the vps in KB/s | No |
band_suspend | POST | 1/0 | The bandwidth suspension option will be enabled for the vps | No |
dns | POST | array | The array of DNS ips will be assigned to the vps | No |
ippoolid | POST | array | The array of Ip pool ID | No |
nic_type | POST | text | This will assign a network interface card. If not selected the default card Realtek will be assigned refer below table for values | No |
control_panel | POST | text | The control panel selected will be installed on the vps (cpanel, webuzo, plesk, webmin, interworx,ispconfig, cwp, vesta) | No |
recipe | POST | Int | A recipe will be assigned to the vps | No |
cpu_mode | POST | text | Refer Values from below table | No |
enable_cpu_topology | POST | 1/0 | This will enable the cpu topology to the vps | No |
topology_sockets | POST | Int | IF cpu topology is enabled then Specify the number of CPU Sockets to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP) | No |
topology_cores | POST | Int | IF cpu topology is enabled then Specify the number of CPU cores to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP) | No |
topology_threads | POST | Int | IF cpu topology is enabled then Specify the number of CPU Threads to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP) | No |
vnc_keymap | POST | text | Allows to select keymap can be 'en-us', 'de-ch', 'ar', 'da', 'et', 'fo', 'fr-be', 'fr-ch', 'hu', 'it', 'lt', 'mk', 'nl', 'no', 'pt', 'ru', 'sv', 'tr', 'de', 'en-gb', 'es', 'fi', 'fr', 'fr-ca', 'hr', 'is', 'ja', 'lv', 'nl-be', 'pl', 'pt-br', 'sl', 'th' | No |
kvm_cache | POST | text | The type disk-cache mechanism can be writeback, writethrough, directsync or default (Only for KVM and Proxmox KVM) | No |
io_mode | POST | text | Sets the I/O policy for the VPS can be native/threads (Only for KVM) | No |
kvm_vga | POST | 1/0 | Enables VGA for the VPS (Only for KVM) | No |
acceleration | POST | 1/0 | If VGA is enabled then this option will enable 2D and 3D acceleration will be for the VPS | No |
total_iops_sec | POST | Int | Assigns Total I/O time to the vps | No |
read_bytes_sec | POST | Int | Assigns Read MB/s value to the vps | No |
write_bytes_sec | POST | Int | Assigns Write MB/s value to the vps | No |
rdp | POST | 1/0 | Enables RDP for the vps | No |
osreinstall_limit | POST | Int | Set OS reinstall limit to the vps | No |
admin_managed | POST | 1/0 | If checked, VPS can not be managed from Enduser panel | No |
disable_nw_config | POST | 1/0 | If checked, Virtualizor will not configure/re-write network when a VPS is rebooted. However, during creation of the VPS, the network file will be written | No |
plan_template | POST | Int | Will copy the plan given in the plan ID | No |
tuntap | POST | 1/0 | Enable disable for VPS | No |
ppp | POST | 1/0 | Enable disable ppp for VPS | No |
fuse | POST | 1/0 | Enable disable fuse for Containers | No |
ipip | POST | 1/0 | Enable disable ipip for Containers | No |
ipgre | POST | 1/0 | Enable disable ipgre for Containers | No |
nfs | POST | 1/0 | Enable disable nfs for Containers | No |
quotaugidlimit | POST | Int | Enables or disables in-container per-user and per-group disk quotas. If the value is set to 0 or not set, disk quotas inside the container is disabled and not accounted | No |
iolimit | POST | Int | If set, IO operation will not exceed the specified limit while performing IO operations. | No |
iopslimit | POST | Int | If set, IO operations per second will not exceed the soecified limit | No |
install_xentools | POST | 1/0 | If enabled will install xentools for XEN | No |
shadow | POST | Int | Shadow Memory in MB Recommended value:8 MB | No |
pv_on_hvm | POST | 1/0 | The primary goal of PV on HVM is to boost performance of fully virtualized HVM guests through use of specially optimized paravirtual device drivers | No |
vif_type | POST | text | If you want to change the network interface emulation type. Options are netfront or ioemu | No |
numa | POST | 1/0 | Enable disable Numa for Proxmox KVM/Qemu | No |
h_rate[-1] | POST | Int | Hourly Pricing Rate for server, for specific server you need to pass server ID in place of '-1' | No |
m_rate[-1] | POST | Int | Monthly Pricing Rate for server, for specific server you need to pass server ID in place of '-1' | No |
y_rate[-1] | POST | Int | Yearly Pricing Rate for server, for specific server you need to pass server ID in place of '-1' | No |
os_type | POST | text | Setting the proper os_type allows Proxmox VE to optimize some low level parameters, Please refer following table for valid os_type values (For Proxmox kvm only) | No |
rtc | POST | 1/0 | If rtc is is set to1 then it is enabled else it is disabled (For Proxmox kvm only) | No |
kvm_vga | POST | Int | Assign vga vram value in MB. By default virtualizor will assign 8MB. (For KVM only) | No |
ssd_emulation | POST | Int | Provide 1 for to enable ssd_emulation. (For KVM and Promox kvm only) | No |
disable_password | POST | Int | If enabled then password authentication will be restricted for SSH. | No |
discard | POST | Int | Provde 1 to enable disacrd option (Only for Promox KVM) | No |
Vertical scaling parameters (Since V3.1.3)
Note
- Vertical scaling is supported on KVM based virtualization only.
- QEMU version should be greater than or equal to 1.5, To check QEMU Version run "/usr/bin/virsh version"
- Vertical scaling is currently not supported on Windows VPS
Name | Method | Value | Description | Required |
---|---|---|---|---|
enable_ver_scaling | Post | 1/0 | Pass 1 to enable vertical scaling, If you have already enabled scaling in master settings then no need to pass it | No |
ver_max_ram | Post | int (MB) | To set the maximum value for the VM. If provided then it will override the global setting value in master settings. |
No |
ver_ram_threshold | Post | int (%) | To set the threshold to increase the RAM by value provided. If provided then it will override the global setting value in master settings. |
No |
ver_ram_inc_by | Post | int (GB) | To increase the RAM after the threshold matches the value. If provided then it will override the global setting value in master settings. |
No |
ver_max_cpu | Post | int (Cores) | To set the maximum value for the Cores. If provided then it will override the global setting value in master settings. |
No |
ver_cpu_threshold |
Post | int (%) | To set the threshold to increase the cores by value provided. If provided then it will override the global setting value in master settings. | No |
ver_cpu_inc_by |
Post | int (Core) | To increase the Cores after the threshold matches the value. If provided then it will override the global setting value in master settings. | No |
CPU Mode values for Proxmox KVM
( host-model | host-passthrough | 486 | athlon | pentium | pentium2 | pentium3 | coreduo | core2duo | kvm32 | qemu32 | qemu64 | phenom | Conroe | Penryn | Nehalem | SandyBridge | IvyBridge | Haswell | Broadwell | Opteron_G1 | Opteron_G2 | Opteron_G3 | Opteron_G4 | Opteron_G5 ) |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$post['plid'] = 4;
$post['is_enabled'] = 1; //to enable the plan.
$post['virt'] = 'kvm';
$post['cpu_cores'] = 4;
$post['burst_ram'] = '';
$post['percent_cpu'] = 0;
$post['priority'] ='';
$post['cpu_units'] = 1024;
$post['swapram'] = 1024;
$post['topology_sockets'] = 1;
$post['topology_cores'] = 2;
$post['topology_threads'] = 2;
$post['acpi'] = 1;
$post['apic'] = 1;
$post['pae'] = 1;
$post['plan_name'] = 'test_api_edit';
$post['disk_space'] = 10;
$post['guaranteed_ram'] = 1024;
$post['bandwidth'] = 0;
$post['ips'] = 1;
$post['ips6'] = 2;
$post['ips6_subnet'] = 0;
$post['ips_int'] = 0;
$post['network_speed'] = 0;
$post['nic_type'] = 'e1000';
$post['virtio'] = 0;
$post['ploop'] = 0;
$post['upload_speed'] = 0;
$post['tuntap'] = 0;
$post['ppp'] = '';
$post['rdp'] = 0;
$post['ubcsettings'] = 0;
$post['band_suspend'] = 0;
$post['control_panel'] = 'webuzo';
$post['cpu_mode'] = 'host-model';
$post['sec_iso'] = 0;
$post['iso'] = 0;
$post['osreinstall_limit'] = 5;
$post['osid'] = 272;
$post['kvm_vga'] = 0;
$post['acceleration'] = 0;
$post['vnc'] = 1;
$post['admin_managed'] = 0;
$post['recipe'] = 13;
$post['disable_nw_config'] = 0;
$post['shadow'] = 8;
$post['pv_on_hvm'] = 0;
$post['vif_type'] = '';
$post['mgs'] = '';
$post['dns'] = '';
$post['vnc_keymap'] = 'en-gb';
$post['kvm_cache'] = 'writeback';
$post['io_mode'] = 0;
$post['total_iops_sec'] = 8;
$post['read_bytes_sec'] = 5;
$post['write_bytes_sec'] = 6;
$output = $admin->editplan($post);
print_r(json_encode($output));
?>
Output
{
"title": "Edit Plan",
"done": 1,
"plan": {
"plid": "4",
"plan_name": "Api Plan Edit",
"virt": "xcp",
"ips": "0",
"ips6": "0",
"ips6_subnet": "0",
"ips_int": "0",
"space": "1",
"inodes": "0",
"ram": "128",
"burst": "0",
"swap": "128",
"cpu": "1000",
"cores": "2",
"cpu_percent": "10.00",
"bandwidth": "0",
"network_speed": "0",
"upload_speed": "0",
"nic_type": "",
"io": "0",
"virtio": "0",
"ubc": false,
"ploop": "0",
"band_suspend": "0",
"dns_nameserver": false,
"ppp": "0",
"tuntap": "0",
"control_panel": "",
"mgs": [
""
],
"cpu_mode": "",
"sec_iso": "",
"hvm": "0",
"kvm_cache": "",
"io_mode": "",
"osreinstall_limit": "0",
"total_iops_sec": "0",
"read_bytes_sec": "0",
"write_bytes_sec": "0",
"vnc_keymap": "",
"osid": "1",
"kvm_vga": "0",
"acceleration": "0",
"vif_type": "",
"pv_on_hvm": "0",
"iso": "",
"vnc": "0",
"admin_managed": "0",
"shadow": "0",
"acpi": "0",
"apic": "0",
"pae": "0",
"recipe": "0",
"topology_sockets": "0",
"topology_cores": "0",
"topology_threads": "0",
"disable_nw_config": "0",
"rdp": "0",
"openvz_features": "",
"speed_cap": "",
"numa": "0",
"bpid": "0",
"install_xentools": "0",
"ippoolid": null,
"is_enabled": "1"
},
"servergroups": {
"0": {
"sgid": 0,
"sg_name": "Default",
"sg_reseller_name": "Default",
"sg_desc": "Default Group",
"sg_select": 0
},
"2": {
"sgid": "2",
"sg_name": "test_sg",
"sg_reseller_name": "US",
"sg_desc": "This is just test",
"sg_select": "0"
}
},
"timenow": 1535660933,
"time_taken": "0.257"
}