API Description
The Create load balancer API allows you to create virtual private servers on your server as a load balancer.
Parameters
Note
(Almalinux 8 | Almalinux 9 | Ubuntu 20 | Ubuntu 22 | Ubuntu 24)
2. Bandwidth should be 0 while creating load balancer.
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); $lb_uuid = 'ZhqpaJnLO0Wbsyv4'; $post = array(); $post['serid'] = 0; $post['virt'] = 'kvm'; $post['uid'] = 6; $post['fname'] = 'jayesh'; $post['lname'] = 'gawade'; $post['plid'] = 5; $post['osid'] = 1138; $post['hostname'] = 'www.hostname.com'; $post['rootpass'] = 'Jayesh@12'; $post['ips'] = array('192.168.1.254'); $post['num_ips6'] = 0; $post['num_ips6_subnet'] = 0; $post['stid'] = 9; $post['space'] = array(0=>array( 'size' => 8, 'st_uuid'=>'dpmXT5Hr2RQ3O7dm'), ); //For VPS with Multi-Disk $post['ram'] = 512; $post['swapram'] = 0; $post['bandwidth'] = 0; $post['network_speed'] = 0; $post['cpu'] = 100; $post['cores'] = 1; $post['cpu_percent'] = 100.00; $post['vnc'] = 1; $post['vncpass'] = 'test123'; $post['kvm_cache'] = 0; $post['io_mode'] = 0; $post['vnc_keymap'] = 'en-us'; $post['nic_type'] = 'default'; $post['osreinstall_limit'] = 0; $post['speed_cap_up'] = 64000; $output = $admin->create_load_balancer($post); print_r(json_encode($output)); ?>
Output
{ "title":"Add Virtual Server", "error":[], "vs_info":{ "uuid":"F6XZLvXePoGRmg2i", "plid":5, "space":8, "bus_driver":"", "bus_driver_num":0, "ram":512, "bandwidth":0, "network_speed":0, "upload_speed":-1, "cores":1, "cpupin":-1, "uid":6, "io":0, "burst":0, "cpu_percent":100, "swap":0, "acpi":1, "apic":1, "pae":"1", "vnc":1, "vncport":0, "shadow":0, "virt":"kvm", "hvm":0, "iso":"", "boot":"cda", "band_suspend":0, "speed_cap_down":0, "speed_cap_up":64000, "tuntap":0, "ppp":0, "mac_status":0, "osreinstall_limit":0, "mg":[], "kvm_cache":"0", "io_mode":"0", "vnc_keymap":"en-us", "virtio":1, "numa":0, "cpu_mode":"host-passthrough", "admin_managed":1, "rdp":0, "disable_nw_config":0, "topology_sockets":0, "topology_cores":0, "topology_threads":0, "openvz_features":"", "bpid":0, "install_xentools":0, "sec_iso":"", "ha":0, "unprivileged":0, "demo":0, "dont_add_ptr":0, "admin_fwid":0, "fwid":0, "hostname":"www.loadbalancerjay.com", "pass":"Jayesh@12", "os_type":0, "rtc":0, "vnc_auto_port":0, "nested_virt":0, "vga_vram":0, "discard":0, "vlan_tag":0, "enable_guest_agent":1, "ssd_emulation":0, "machine_type":0, "bios":"seabios", "enable_tpm":0, "disable_password":"", "ssh_options":"", "added_keys":[], "io_uring":0, "min_ram":0, "vga":0, "vga_memory":0, "cpu_flags":0, "scsi_controller":0, "enable_cpu_threshold":0, "cpu_threshold":0, "cpu_threshold_time":0, "disable_guest_agent":0, "disable_autostart":0, "iothread":0, "nesting":0, "enable_ver_scaling":0, "ver_max_ram":0, "ver_ram_threshold":0, "ver_ram_inc_by":0, "ver_max_cpu":0, "ver_cpu_threshold":0, "ver_cpu_inc_by":0, "speed_cap":{"down":0, "up":64000, "reason":"", "bw":0}, "mac":"", "osid":1138, "cpu":100, "total_iops_sec":0, "read_bytes_sec":0, "write_bytes_sec":0, "kvm_vga":0, "acceleration":0, "disable_ebtables":0, "webuzo":0, "vncpass":"test123", "nic_type":"default", "vps_name":"v1249", "ubc":"a:0:{}", "data":{ "os_type":0, "rtc":0, "unprivileged":0, "vnc_auto_port":0, "nested_virt":0, "vga_vram":0, "discard":0, "vlan_tag":0, "enable_guest_agent":1, "ssd_emulation":0, "machine_type":0, "bios":"seabios", "enable_tpm":0, "disable_password":1, "ssh_options":"", "added_keys":[], "io_uring":0, "min_ram":0, "vga":0, "vga_memory":0, "cpu_flags":0, "scsi_controller":0, "demo":0, "enable_cpu_threshold":0, "cpu_threshold":0, "cpu_threshold_time":0, "disable_guest_agent":0, "disable_autostart":0, "iothread":0, "nesting":0, "enable_ver_scaling":0, "ver_max_ram":0, "ver_ram_threshold":0, "ver_ram_inc_by":0, "ver_max_cpu":0, "ver_cpu_threshold":0, "ver_cpu_inc_by":0, "crypted_pass":"UDT2OrR32SEhBaWp+p3KtFSW1g0vRWi9Ew==", "crypted_salt":"OO62lnaX" }, "vpsid":"1032", "disks":[ { "primary":1, "path":"\/dev\/CrucialVG\/vsv1249-dkJyS9cxJNi1OBda-F6XZLvXePoGRmg2i", "st_uuid":"dpmXT5Hr2RQ3O7dm", "type":"block", "size":"8", "size_unit":"", "vpsid":"1032", "rescue":0, "target_name":"", "format":"raw", "disk_uuid":"dkJyS9cxJNi1OBda", "user_uid":"", "disk_name":"", "mnt_point":"", "num":0, "bus_driver":null, "bus_driver_num":null }], "ips":["192.168.1.254"], "ipv6":[], "ipv6_subnet":[], "ipv6_subnet_w_prefix":[], "ips_int":[] }, "new_keys":null, "globals":{ "cookie_name":"SIMCookies3508" }, "done":"1032" }