The configuration parameters can be passed explicitly by specifying the parameters and the new values in the request. By using this approach, you can modify a single parameter, a set of parameters, or the entire configuration information. The request is similar to the create
request that creates a Container. It accepts the Server ID of the Container that you would like to update, the configuration structure (venv_configType
), and a couple of other parameters. To execute a request, first populate the configuration structure with the parameters and values that you would like to modify (all of the parameters are optional so you can include or exclude any of them) and then pass it to Agent using the vzanevm/set
request. The following example assigns a new hostname and adds a search domain to an existing Virtuozzo Container. It is also adding two DNS servers to the default venet0
virtual network adapter.
<packet version="4.0.0" id="34">
<target>vzaenvm</target>
<data>
<vzaenvm>
<set>
<eid>3288bb6b-8a49-4230-b565-6ad5521182aa</eid>
<config>
<hostname>myhost</hostname>
<search_domain>ts6.com</search_domain>
<net_device>
<id>venet0</id>
<nameserver>192.168.1.51</nameserver>
<nameserver>192.168.1.52</nameserver>
</net_device>
</config>
</set>
</vzaenvm>
</data>
</packet>
The following example will modify the IP address configuration for the venet0
network adapter, which is the default virtual adapter inside a Container. This modification works in such a way that the existing IP addresses are first removed from the adapter configuration and then the passed addresses are added replacing the old ones. To add an IP address without removing the old ones, first retrieve the existing addresses, then add the new address (or addresses) to the list, and then include the entire list in the request.
<packet version="4.0.0">
<target>vzaenvm</target>
<data>
<vzaenvm>
<set>
<eid>72145bf0-7562-43d4-b707-cc33d37e3f10</eid>
<config>
<net_device>
<id>venet0</id>
<ip_address>
<ip>10.130.1.1</ip>
</ip_address>
<ip_address>
<ip>10.130.1.2</ip>
</ip_address>
<ip_address>
<ip>10.130.1.3</ip>
</ip_address>
<host_routed/>
</net_device>
</config>
</set>
</vzaenvm>
</data>
</packet>