Get Virtualizor

Migrate VPS

Use the Migrate VPS API to migrate the VPS(s) present on master server to your slave server. You can select the storage disk on which migration of the VPS will take place, for migration single VPS.

For migration of multiple VPSes do not pass the storage ID of the destination server as virtualizor automatically chooses the storage disk on which the migration will take place.

The API response will contain "actid" which can be used to monitor the migration process at admin panel or using the Task API.

It is recommended that you save the VPS data before starting this process as Virtualizor will power off the VPS to do the transfer.

For more information, you can refer this GUI Migration Guide.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETmigrateThe action specified to carry out operation and return data after vps has been migratedYes
vpsidPOSTarrayThe array of vpsid that need to be migratedYes
storagePOSTarrayThe array of storage ID of the slaveYes
from_serverPOSTIntThe server ID from which the vps needs to be migratedNo
from_ipPOSTtextThe server ip from which vps needs to be migratedYes
from_passPOSTtextThe server password from which the vps needs to be migratedYes
migratePOSTIntIf set to 1, then the vps migration process will beginYes
migrate_butPOSTIntIf set to 1 the migration process will beginYes
speed_limitPOSTIntSetting a speed limit for vps migration in Mb/sNo
to_serverPOSTIntThe server ID to which the vps will be migratedNo
preserve_ipPOST1/0Set this option to use same IP Address(s) on the migrated VPSNo
del_origPOST1/0Set this option to delete the source VPS after successful MigrationNo
ignore_if_vdfconflictPOST1/0If set, the HAProxy VPS Domain Forwarding records will be ignored, if a conflict is found with records on the destination serverYes
disable_gzipPOST1/0If checked, compression (i.e. gzip) will not be used during migrationYes

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 = array();
    $post['from_ip'] = 0;
    $post['from_server'] = 0;
    $post['speed_limit'] = 100;
    $post['to_server'] = 1;
    $post['migrate'] = 1;
    $post['migrate_but'] = 1;
    $post['vpsid'] = array(3801);
    $post['storage'] = array(279);

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

    print_r(json_encode($output));
?>

Output

{
    "title": "KVMTestServer",
    "actid": "4902",
    "timenow": 1481700829,
    "time_taken": "6.139"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list