The configuration parameters can be passed by specifying the ID of a sample configuration. In this case, the values will be read from the sample configuration file. Using this approach, you can modify a single parameter, a set of parameters, all parameters from a selected category, or an entire configuration. The parameters in Virtuozzo Container configuration are categorized. Only those parameters that belong to the category applicable_conf
can be set using this functionality. The following request will retrieve the list of the parameters than can be set using this function.
<packet version="4.0.0">
<data>
<system>
<get_vocabulary>
<category>applicable_conf</category>
</get_vocabulary>
</system>
</data>
</packet>
The applicable_conf
category is the "master" category which contains the "subcategories" which in turn contain the parameters that can be applied to Containers from sample configurations. The output of the request above will have the parameters and the categories in it. To get the list of the categories, you will have to search the returned XML structure for them. Here's a snippet of the output (the complete output is very long):
<vocabulary>
<name>VZABasicFunctionality</name>
<parameter>
<id>diskspace</id>
<measure>1K-blocks</measure>
<type>int</type>
<name>diskspace</name>
<complex>2</complex>
<category>qos</category>
<category>quota</category>
<category>params</category>
<category>ve_local</category>
<category>applicable_conf</category>
<category>resource_alert</category>
<category>counters_vz_quota</category>
<category>virtuozzo</category>
<short>Disk space in 1 kilobyte blocks which can be used</short>
<min>0:0</min>
<max>2147483647:2147483647</max>
<unlimited>2147483647:2147483647</unlimited>
<default>2147483647:2147483647</default>
<basic>1048576:1153434</basic>
<value_type>1</value_type>
<counter_type>0</counter_type>
</parameter>
...
<category>
<id>quota</id>
<name>Disk Quota</name>
<category>qos</category>
<category>applicable_conf</category>
<category>virtuozzo</category>
<category>resource_alert</category>
<short>Disk quota parameters</short>
</category>
...
</vocabulary>
<vocabulary>
<name>generic</name>
<category>
<id>general_conf</id>
<name>General</name>
<category>applicable_conf</category>
<short>General applicable Environment parameters (in Env config file)</short>
</category>
<category>
<id>qos</id>
<name>QOS</name>
<category>applicable_conf</category>
<short>Quality Of Service (QOS) parameters (UBC, Disk quota, CPU).</short>
</category>
<vocabulary>
The category information is contained inside the category
nodes that are the children of the <vocabulary>
node. The id
elements contain the names of the parameters or categories.
Let's say now that we want to take all of the QoS parameters from a sample configuration file and apply their values to an existing Container. First, we have to get the name of the category from the output above. It is the last category in the example and its name is qos
. After that we will need the sample configuration ID that we would like to get the QoS parameters from. Finally, we need the Server ID of the target Container. The request that will apply these parameters to the Container configuration is shown below:
<packet version="4.0.0" id="654">
<target>vzaenvm</target>
<data>
<vzaenvm>
<set>
<eid>6dbd99dc-f212-45de-a5f4-ddb78a2b5280</eid>
<apply_config>
<sample_conf>f8e96630-7fd8-4eee-93b2-3ad7b6b53916</sample_conf>
<category>qos</category>
</apply_config>
</set>
</vzaenvm>
</data>
</packet>
As a result, all QoS parameter values in the configuration of the target Container will be replaced with the QoS values from the specified sample configuration.