Previous page

Next page

Locate page in Contents

Print this page

Getting Container Information From a Backup

Use the backupmBinding.get_info method to get the detailed Container information from the specified backup archive. The information that can be retrieved includes the basic Container information (Server ID, status, host Server ID) and the complete Container configuration.

On a standalone Hardware Node, the method can access only the local backups. To get the info about a backup on a remote backup server, you'll have to establish a direct Agent connection with it. In a Virtuozzo group, the method can get information about a backup located on any Slave Node.

The following sample shows how to retrieve the Container information from a backup.

Sample Function:

/// <summary>

/// Sample function GetInfo.

/// Retrives information about the Container stored in the

/// specified backup.

/// </summary>

/// <param name="backup_id">Backup ID.</param>

/// <returns>Container information.</returns>

///

public string GetInfo(string backup_id)

{

    string info_result = "";

    

    try {

    

        // Instantiate the proxy class

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

    

        // The main input object.

        get_info3 info = new get_info3();

    

        // Set backup id.

        info.backup_id = backup_id;

    

        // Populate the retrieval criteria.

        get_env_info_optionsType options = new get_env_info_optionsType();

    

        /* The options.env option is used as a flag.

         * If the options.env object is created, the result will

         * contain the complete Container info, including the Container configuration.

         * If not, only the basic Container info will be included.

         */

        options.env = new get_env_info_optionsTypeEnv();

    

        /* If options.excludes object is created,

         * the result will also contain the names of

         * the Container files and directories that were included in

         * or excluded from the backup.

         */

        options.excludes = new object();

    

        // Set the options.

        info.options = options;

    

        // Get the Container info.

        env_backup_dataType data = (env_backup_dataType)backupm.get_info(info).info;

    

        // Populate a string variable with the returned data.

        info_result += "\nEnvironment info:" +

            "\n  Eid: " + data.env.eid +

            "\n  Parent eid: " + data.env.parent_eid +

            "\n  Name: " + data.env.virtual_config.name;

    

        // Get the configuration description.

        if (data.env.virtual_config.description != null &&

            data.env.virtual_config.description.Length != 0) {

            info_result += "\n  Description: " +

                System.Text.ASCIIEncoding.ASCII.GetString(data.env.virtual_config.description);

        }

    

        // Get the OS info.

        info_result += "\n  Status: " + data.env.status.state.ToString()+

            "\n  Architecture: " + data.env.virtual_config.architecture+

            "\n  OS name: " + data.env.virtual_config.os.name+

            "\n  OS platform: " + data.env.virtual_config.os.platform+

            "\n  OS version: " + data.env.virtual_config.os.version+

            "\n  OS kernel: " + data.env.virtual_config.os.kernel;

    

        // Get the Container IP address.

        if (data.env.virtual_config.address != null) {

            info_result += "\n  IP: " + data.env.virtual_config.address[0].ip;

        }

        else {

            info_result += "\n  No IP address!";

        }

    

        // Get the hostname.

        if (data.env.virtual_config.hostname != null) {

            info_result += "\n  Hostname: " + data.env.virtual_config.hostname;

        }

    

        // Get the sample configuration ID.

        if (data.env.virtual_config.base_sample_id != null) {

            info_result += "\n  Base sample id: " + data.env.virtual_config.base_sample_id;

        }

    }

    catch (Exception e) {

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

    }

    return info_result;

}

Please send us your feedback on this help page