A Container configuration information is stored on the Hardware Node. This configuration (also called virtual configuration) is used by Virtuozzo Containers to set the necessary Container parameters when the Container is started. To retrieve a Copntainer configuration, use the vzaenvmBinding.get_info
method. For the complete list and description of the input parameters, see the vzaenvm/get_info
call in the Parallels Agent XML Programmer's Reference guide.
The following sample shows how to retrieve the complete configuration information for the specified Container.
/// <summary>
/// Sample function GetConfig.
/// Retrives Container configuration information.
/// </summary>
/// <param name="ve_eid">The Container Server ID.</param>
/// <returns>
/// A string containing the Container configuration information.
/// </returns>
public string GetConfig(string ve_eid)
{
string ve_info = "";
try {
// Instantiate the proxy class.
vzaenvmBinding env = (vzaenvmBinding)binder.InitBinding(typeof(vzaenvmBinding));
// The input parameters.
get_info2 getInfo_input = new get_info2();
string[] eids = new string[1];
// Set the Server ID of the Container for which to get the info.
eids[0] = ve_eid;
getInfo_input.eid = eids;
// Get the Container information from the Hardware Node.
envType[] envtype = env.get_info(getInfo_input);
// Get the Container configuration from the returned object.
venv_configType veconfig = envtype[0].virtual_config;
// Get Container name.
ve_info += "Name: " + envtype[0].virtual_config.name + "\n";
// Get Container description.
if (envtype[0].virtual_config.description != null && envtype[0].virtual_config.description.Length != 0)
ve_info += "Description: " +
System.Text.Encoding.ASCII.GetString(envtype[0].virtual_config.description) + "\n" +
//Get network configuration.
"Network configuration: \n";
if (envtype[0].virtual_config.address != null) {
ve_info += "IP: " + veconfig.address[0].ip + "\n" +
"Netmask: " + veconfig.address[0].netmask + "\n";
}
// Get Container hostname.
ve_info += "HostName: " + veconfig.hostname + "\n" +
// Get architecture
"Architecture: " + veconfig.architecture + "\n" +
// Get OS
"OS name: " + veconfig.os.name + "\n" +
"OS platform: " + veconfig.os.platform + "\n" +
"OS kernel: " + veconfig.os.kernel + "\n" +
"OS version: " + veconfig.os.version + "\n" +
// Get status
"Status: " + envtype[0].status.state.ToString() + "\n" +
// Get QoS information.
"QoS cur: " + veconfig.qos[0].cur.ToString() + "\n" +
"QoS hard: " + veconfig.qos[0].hard.ToString() + "\n" +
"QoS id: " + veconfig.qos[0].id + "\n" +
"QoS soft: " + veconfig.qos[0].soft.ToString();// +"\n";
}
catch (Exception e) {
ve_info += "Exception: " + e.Message;
}
return ve_info;
}