Previous page

Next page

Locate page in Contents

Print this page

Backing up a Container

The following sample illustrates how to use the backupmBinding.backup_env method to create a backup of a Virtuozzo Container.

Sample Function Parameters:

Name

Description

eid

The Server ID of the source Container.

description

Backup description.

type

Backup type:

0 -- Full (default). A full backup is a starting point for all other backup types.

1 -- Incremental. Only the files that have changed since the last full, incremental, or differential backup are included. When restoring from an incremental backup, you'll need the latest full backup as well as every incremental and/or differential backup that you've made since the last full backup.

2 -- Differential. Only the files that have changed since the last full backup are included. When restoring from a differential backup, only the latest differential backup itself and the latest full backup is needed.

compression

Compression level:

0 -- no compression.

1 -- normal (default).

2 -- high.

3 -- maximum.

 

The following parameters are used to specify the backup server connection and login information. The sample function provided here illustrates how to specify the backup server connection and login information manually.

Note: To use a remote computer as a backup server, you must install Virtuozzo Containers software on it.

ip

Backup server IP address.

user

Login name.

password

Login password.

realm

Realm ID against which to authenticate the user. The Realm definition must exist in the Agent configuration on the backup server.

On a fresh Agent installation, the only Realm available is System -- a predefined Realm that refers to the operating system user registry on the Hardware Node. The System Realm ID is 00000000-0000-0000-0000-000000000000.

protocol

Communication protocol:

SSL -- SSL over TCP/IP.

TCP -- plain TCP/IP.

NamedPipe -- named pipe.

port

Port number. Agent on the source server will be connecting to the Agent on the backup server, the TCP port numbers therefore are the standard Agent options:

4433 -- TCP/IP connection.

4434 -- SSL over TCP/IP connection.

 

Sample Function:

/// <summary>

/// Sample function BackupVE.

/// Performs a Container backup.

/// </summary>

/// <param name="eid">Server ID of the source Container.</param>

/// <param name="description">

/// User-defined backup description.

/// </param>

/// <param name="type">Backup type.</param>

/// <param name="compression">Compression level.</param>

/// <param name="ip">Target HN IP address.</param>

/// <param name="user">

/// User name with which to login to

/// the target Nardware Node.

/// </param>

/// <param name="password">User password.</param>

/// <param name="realm">Realm ID.</param>

/// <param name="protocol">Communication protocol.</param>

/// <param name="port">Target HN port number</param>

/// <returns>Backup ID.</returns>

///

public string BackupVE(string eid, string description, int type, int compression, string ip, string user, string password, string realm, string domain, string protocol, uint port)

{

    try {

        // Instantiate the proxy class

        backupmBinding backupm = (backupmBinding)binder.InitBinding(typeof(backupmBinding));

    

        // The main input object.

        backup_env backup_input = new backup_env();

    

        // Set Server ID of the Container.

        backup_input.env_list = new string[1];

        backup_input.env_list[0] = eid;

    

        // Set backup options.

        backup_optionsType options = new backup_optionsType();

    

        // Backup description.

        options.description = System.Text.ASCIIEncoding.ASCII.GetBytes(description);

    

        // Backup type.

        options.typeSpecified = true;

        options.type = type;

    

        // Compression level.

        options.compressionSpecified = true;

        options.compression = compression;

    

        // Set the backup server login information.

        auth_nameType login_info = new auth_nameType();

    

        // User name.

        login_info.name = System.Text.ASCIIEncoding.ASCII.GetBytes(user);

    

        // Realm ID.

        login_info.realm = realm;

    

        // Domain name.

        login_info.domain = System.Text.ASCIIEncoding.ASCII.GetBytes(domain);

    

        // Set the backup server connection information.

        connection_infoType connection = new connection_infoType();

    

        // Backup server IP address.

        connection.address = ip;

    

        // Communication protocol.

        connection.protocol = protocol;

    

        // Port number.

        connection.portSpecified = true;

        connection.port = port;

    

        // Password.

        connection.password = System.Text.ASCIIEncoding.ASCII.GetBytes(password);

    

        // Finalize the input.

        connection.login = login_info;

        backup_input.backup_server = connection;

        backup_input.backup_options = options;

    

        // Set infinite timeout for the request.

        backupm.Timeout = -1;

    

        // Start backup.

        return backupm.backup_env(backup_input)[0].id;

    

    }

    catch (Exception e) {

        return "Exception: " + e.Message;

    }

}

The function invocation example:

createBackup( "ac57a9c3-573b-481a-b398-d2fb0467cf4b", "my backup", 0, 0, "10.16.3.80", "root", "my_password", "00000000-0000-0000-0000-000000000000", "TCP", 4433 );

Please send us your feedback on this help page