Previous page

Next page

Locate page in Contents

Print this page

Listing Backups

To get the list of the existing backups, use the backupmBinding.list method. The method retrieves the list of backups from the Hardware Node. If your backup archives are located on a remote backup server, you have to establish a direct Agent connection with it and execute the call there. If you have a Virtuozzo group set up, you can use this method on the Master Node to get the list of backups from any Slave Node in the group.

The backupmBinding.list method returns the following backup information:

Name

Description

time

Backup date and time.

size

The size of the backup archive.

type

Backup type:

0 -- Full.

1 -- Incremental.

2 -- Differential.

id

Backup ID. The ID is assigned to a backup by Agent when the backup is created. The backup ID is universally unique.

You have to obtain the backup ID in order to restore a Container from a backup.

storage_eid

Server ID of the Node where the backup archive is located.

info

Additional backup information.

eid

The original Server ID of the source Container.

description

Backup description. An optional property set by user. May be empty.

count

The total number of backups stored on this Node (storage_eid) for this Container (eid).

capability

Backup capabilities. Specifies miscellaneous backup properties.

The following sample illustrates how to use the  backupmBinding.list method to get the list of all of the available backups from the Hardware Node.

Sample Function:

/// <summary>

/// Sample function LisBackups.

/// Retrives the list of backups from the

/// Hardware Node.

/// </summary>

/// <returns>

/// A string containing the list of backups

/// with detailed information for each backup.

/// </returns>

///

public string ListBackups()

{

    string list_result = "";

    try {

        // Instantiate the proxy class

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

    

        // The main input parameter.

        list7 list_input = new list7();

    

        // Get the list of backups.

        backupType[] backups = backupm.list(list_input);

    

        // Itereate through the returned backup structure and

        // populate a string variable with the results.

        if (backups.Length != 0) {

            foreach (backupType backup in backups) {

                if (backup.description != null) {

                    list_result += "\nDescription: ";

                }

    

                list_result += System.Text.ASCIIEncoding.ASCII.GetString(backup.description) +

                    "\nID: " + backup.id +

                    "\nServer ID: " + backup.eid +

                    "\nCount: " + backup.count.ToString() +

                    "\nSize: " + backup.size.ToString() +

                    "\nType: " + backup.type.ToString() +

                    "\nInfo name: " + backup.info.name +

                    "\nTime: " + backup.time.ToString();

            }

        }

        else {

            list_result += "\nNo backups found.";

        }

    }

    catch (Exception e) {

        list_result += "Exception: " + e.Message;

    }

    

    return list_result;

}

The following example illustrates how to use the optional parameters in the backup listing call. The sample function retrieves the most recent backup for the specified Virtuozzo Container from the specified Slave Node in a Virtuozzo group.

Sample Function Parameters:

Name

Description

slave_eid

The Server ID of the Slave Node where the backups are stored. This can be any Slave Node in a Virtuozzo group. To get the Server IDs of the Slave Nodes, use the server_groupBinding.get_list method.

ve_eid

The Server ID of the Virtuozzo Container to get the backup info for. The Container can reside on any Node in the Virtuozzo group.

latest

A flag indicating whether to retrieve the information about the most recent backup or about all of the available backups.

Sample Function:

/// <summary>

/// Sample function ListBackupsVZgroup.

/// </summary>

/// <param name="slave_eid">

/// Server ID of a slave Node from which to get the list of backups.

/// </param>

/// <param name="ve_eid">

/// Server ID of the Container to search for in the backups.

/// </param>

/// <param name="latest">

/// A flag. If set to true, the function will retrieve the

/// information about the latest available backup only.

/// If set to false, all available backups matching the

/// specified criteria will be retrieved.

/// </param>

/// <returns>A string containing the backup informaiton.</returns>

///

public string ListBackupsVZgroup(string slave_eid, string ve_eid, Boolean latest)

{

    string list_result = "";

    try {

        // Instantiate the proxy class

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

    

        // The main input object.

        list7 list_input = new list7();

    

        // Set slave Node's Server ID.

        list_input.options.storage_eid = slave_eid;

    

        // Set Container's Server ID.

        list_input.options.eid = ve_eid;

    

        // Set the "latest" flag.

        if (latest) {

            list_input.options.latest = new Object();

        }

    

        // Get the backup info.

        backupType[] backups = backupm.list(list_input);

    

        // Itereate through the returned backup array.

        if (backups.Length != 0) {

            foreach (backupType backup in backups) {

                if (backup.description != null) {

                    list_result += "\nDescription: ";

                }

    

                list_result += System.Text.ASCIIEncoding.ASCII.GetString(backup.description) +

                    "\nID: " + backup.id +

                    "\nServer ID: " + backup.eid +

                    "\nCount: " + backup.count.ToString() +

                    "\nSize: " + backup.size.ToString() +

                    "\nType: " + backup.type.ToString() +

                    "\nInfo name: " + backup.info.name +

                    "\nTime: " + backup.time.ToString();

            }

        }

        else {

            list_result += "\nNo backups found.";

        }

    }

    catch (Exception e) {

        list_result += "Exception: " + e.Message;

    }

    

    return list_result;

}

Please send us your feedback on this help page