Get Virtualizor

Default VPS Configuration

Use the Default VPS configuration API to change the default VPS configuration (Only for Open VZ). This API will write in the configuration file vz.conf of the OpenVZ VPS. This file keeps system-wide settings, such as the default location of templates and global network settings. The API response will contain "done" as "1" after successful update of the configurations.

HTTP Request

https://hostname:4085/index.php?act=defaultvsconf

Parameters

NameMethodValueDescriptionRequired
actGETdefaultvsconfThe action specified to perform operation and retrieve dataYes
saveconfPOST1If set then the configuration will be savedNo
confinfoPOSTtextIt is the configuration of the vps that will be savedNo

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['saveconf'] = 1;
    $post['confinfo'] = '###################################################
    ## Virtualizor OpenVZ Default Configuration File ##
    ###################################################

    ONBOOT="yes"

    # UBC parameters (in form of barrier:limit)
    KMEMSIZE="unlimited"
    LOCKEDPAGES="unlimited"
    PRIVVMPAGES="unlimited"
    SHMPAGES="unlimited"
    NUMPROC="unlimited"
    PHYSPAGES="0:262144"
    SWAPPAGES="0:262144"
    VMGUARPAGES="unlimited"
    OOMGUARPAGES="unlimited"
    NUMTCPSOCK="unlimited"
    NUMFLOCK="unlimited"
    NUMPTY="unlimited"
    NUMSIGINFO="unlimited"
    TCPSNDBUF="unlimited"
    TCPRCVBUF="unlimited"
    OTHERSOCKBUF="unlimited"
    DGRAMRCVBUF="unlimited"
    NUMOTHERSOCK="unlimited"
    DCACHESIZE="unlimited"
    NUMFILE="unlimited"
    AVNUMPROC="unlimited"
    NUMIPTENT="unlimited"

    # Disk quota parameters (in form of softlimit:hardlimit)
    DISKSPACE="10485760:10485760"
    DISKINODES="100000000:100000000"
    QUOTATIME="0"

    # CPU fair sheduler parameter
    CPUUNITS="1001"


    VE_ROOT="/vz/root/$VEID"
    VE_PRIVATE="/vz/private/$VEID"
    OSTEMPLATE="centos-5.0-x86"
    ORIGIN_SAMPLE="vps.basic"
    IP_ADDRESS=""
    HOSTNAME=""
    NAMESERVER=""
    QUOTAUGIDLIMIT="10000"
    IOPRIO="3"
    CPULIMIT="5"
    CPUS="4"
    ';

    $output = $admin->defaultvsconf($post);

    print_r(json_encode($output));
?>

Output

{
    "title": "Default VPS Configuration",
    "done": "1",
    "defaultvsconf": "###################################################\n## Virtualizor OpenVZ Default Configuration File ##\n###################################################\n\nONBOOT=\"yes\"\n\n# UBC parameters (in form of barrier:limit)\nKMEMSIZE=\"unlimited\"\nLOCKEDPAGES=\"unlimited\"\nPRIVVMPAGES=\"unlimited\"\nSHMPAGES=\"unlimited\"\nNUMPROC=\"unlimited\"\nPHYSPAGES=\"0:262144\"\nSWAPPAGES=\"0:262144\"\nVMGUARPAGES=\"unlimited\"\nOOMGUARPAGES=\"unlimited\"\nNUMTCPSOCK=\"unlimited\"\nNUMFLOCK=\"unlimited\"\nNUMPTY=\"unlimited\"\nNUMSIGINFO=\"unlimited\"\nTCPSNDBUF=\"unlimited\"\nTCPRCVBUF=\"unlimited\"\nOTHERSOCKBUF=\"unlimited\"\nDGRAMRCVBUF=\"unlimited\"\nNUMOTHERSOCK=\"unlimited\"\nDCACHESIZE=\"unlimited\"\nNUMFILE=\"unlimited\"\nAVNUMPROC=\"unlimited\"\nNUMIPTENT=\"unlimited\"\n\n# Disk quota parameters (in form of softlimit:hardlimit)\nDISKSPACE=\"10485760:10485760\"\nDISKINODES=\"100000000:100000000\"\nQUOTATIME=\"0\"\n\n# CPU fair sheduler parameter\nCPUUNITS=\"1001\"\n\n\nVE_ROOT=\"\/vz\/root\/$VEID\"\nVE_PRIVATE=\"\/vz\/private\/$VEID\"\nOSTEMPLATE=\"centos-5.0-x86\"\nORIGIN_SAMPLE=\"vps.basic\"\nIP_ADDRESS=\"\"\nHOSTNAME=\"\"\nNAMESERVER=\"\"\nQUOTAUGIDLIMIT=\"10000\"\nIOPRIO=\"3\"\nCPULIMIT=\"5\"\nCPUS=\"4\"\n",
    "timenow": "1473915377",
    "time_taken": "0.097"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list