Softaculous


Topic : Bug when creating a VPS through the API with a plan


Posted By: mahostca on January 27, 2016, 9:42 pm
So,
No matter what parameters I pass to the API call, they get overwritten or just not used.
Here is what I've been using:
$vps = array();
  $vps['uid'] = $user['uid'];
  $vps['virt'] = 'kvm';
  $vps['plid'] = 6;
  $vps['osid'] = 314;
  $vps['rootpass'] = 'test123';
  $vps['vnc'] = 1;
  $vps['vncpass'] = 'test123'; // Doesn't work
  $vps['nic_type'] = 'virtio'; //I already tried default, and the other one.
  $vps['virtio'] = 1; // Doesn't work
  $vps['band_suspend'] = 0; // Doesn't work

  $vpsResult = $admin->addvs($vps);

I have the plan setup the way I want. First I tried to create the vps with just the user id, plan id and osid but as I said nothing gets setup as my plan is.

Any ideas?

Posted By: asim_shaikh on January 28, 2016, 10:56 am | Post: 1
Quote
I have the plan setup the way I want. First I tried to create the vps
with just the user id, plan id and osid but as I said nothing gets setup
as my plan is.


Hi,

What are the values  set for  $vps['vncpass']  ,$vps['nic_type'],  $vps['virtio'] , $vps['band_suspend'] in the plan ?

Can you please post the output of the return array ? (please remove the sensitive information)


-----------------------
Regards,
Virtualizor Team
http://www.virtualizor.com

Posted By: mahostca on January 28, 2016, 4:19 pm | Post: 2
Quote From : asim_shaikh January 28, 2016, 10:56 am

Hi,

What are the values  set for  $vps['vncpass']  ,$vps['nic_type'],  $vps['virtio'] , $vps['band_suspend'] in the plan ?

Can you please post the output of the return array ? (please remove the sensitive information)


So here it is:
my script:
 
PHP Code

 $post = array();
  
$post['uid'] = 11;
  
$post['plid'] = 6;
  
$post['osid'] = 314;
  
$post['hostname'] = 'test12345.com';
  
$post['rootpass'] = 'test123';
  
$post['vnc'] = 1;
  
$post['vncpass'] = 'test123';

  
$test $admin->addvs($post); 



The result:
Code
Array
(
    [title] => Add Virtual Server
    [error] => Array
        (
        )

    [vs_info] => Array
        (
            [uuid] => qjnanyw1fhlpb8l7
            [pass] => test123
            [plid] => 6
            [hostname] => test12345.com
            [space] => 10
            [ram] => 512
            [bandwidth] => 0
            [network_speed] => 0
            [upload_speed] => -1
            [cores] => 4
            [cpupin] => -1
            [uid] => 11
            [io] => 0
            [burst] => 0
            [cpu_percent] => 100
            [swap] => 1024
            [acpi] => 1
            [apic] => 1
            [pae] => 1
            [vnc] => 1
            [vncport] => 0
            [shadow] => 0
            [virt] => kvm
            [hvm] => 0
            [iso] =>
            [boot] => cda
            [band_suspend] => 1
            [pv_on_hvm] => 0
            [tuntap] => 0
            [ppp] => 0
            [mac_status] => 0
            [osreinstall_limit] => 0
            [mg] => Array
                (
                )

            [webuzo] => 0
            [kvm_cache] => 0
            [io_mode] => 0
            [vnc_keymap] => en-us
            [virtio] => 0
            [cpu_mode] => default
            [admin_managed] => 0
            [mac] =>
            [osid] => 314
            [cpu] => 1000
            [sec_iso] =>
            [total_iops_sec] => 0
            [read_bytes_sec] => 0
            [write_bytes_sec] => 0
            [kvm_vga] => 0
            [acceleration] => 0
            [vncpass] => test123
            [disable_ebtables] => 0
            [nic_type] => default
            [vif_type] => netfront
            [vps_name] => v1008
            [ubc] => a:0:{}
            [vpsid] => 16
            [disks] => Array
                (
                    [0] => Array
                        (
                            [primary] => 1
                            [path] => /dev/vms-vg/vsv1008-0gyr-qjnanyw1fhlpb8l7
                            [st_uuid] => nyh8lxdwgkbqqmsz
                            [type] => block
                            [size] => 10
                            [size_unit] =>
                            [vpsid] => 16
                            [rescue] => 0
                            [target_name] =>
                            [format] =>
                            [disk_uuid] => gyr
                        )

                )

            [ips] => Array
                (
                    [0] => ...
                )

            [ipv6] => Array
                (
                )

            [ipv6_subnet] => Array
                (
                )

            [ips_int] => Array
                (
                )

        )

    [globals] => Array
        (
            [cookie_name] => ...
        )

)


Posted By: mahostca on January 28, 2016, 4:24 pm | Post: 3
Just to add:
1. The plan chosen is just 1 core cpu that the API is not getting it. Actually the API doesn't get any CPU information right from the plan.
2. Doesn't enable virtio as the IO virtualization like it is setup on the plan.
3. Doesn't set the network as virtio like the plan is setup.

Excuse my rudeness but if we can use the plan on the API, what is the purpose of it?

And honestly, thank you for looking into that for me.

Posted By: asim_shaikh on January 29, 2016, 7:15 am | Post: 4
Hi,

Sir, We do clean the POST variables sent from API and Set Defaults Values for the POST fields which are required to create the VPS.

If you want you can skip this step and comment the line no 261 in sdk/admin.php file which is responsible for doing the clean post.


-----------------------
Regards,
Virtualizor Team
http://www.virtualizor.com

Powered By AEF 1.0.8 © 2007-2008 Electron Inc.