
2009/3/16 Anton Protopopov <aspsk2@gmail.com>
Hi all.
When libvirt creates an OpenVZ machine, it does smth like # vzctl create $ctid --ostemplate `ostemplate` And we can't specify an --config `config` argument. In this case vzctl chooses a default config file (a value of CONFIG variable from /etc/vz/vz.conf).
But there are cases when we want to specify a config file directly, as in # vzctl create $ctid --ostemplate `ostemplate` --config `config`
I think, that we can try to use the same `ostemplate` name as --config value, if corresponding template exists, i.e., if there is a file /etc/vz/conf/ve-`ostemplate`.conf-sample, libvirt will run a command # vzctl create $ctid --ostemplate `ostemplate` --config `ostemplate` Otherwise, it will run it's default command # vzctl create $ctid --ostemplate `ostemplate` (the same arguments.)
----------- Example of creating a machine with nondefault config:
1. Create /etc/vz/conf/ve-altlinux-test.conf-sample 2. Create /var/lib/vz/template/cache/altlinux-test.tar 3. Use libvirt with (hypothetical) XML: <domain type="openvz"> <name>100</name> <memory>1</memory> <os><type>exe</type></os> <devices> <filesystem type="template"> <source name="altlinux-test"/> <target dir="/"/> </filesystem> </devices> </domain>
----------- Example of creating a machine with default config:
1. Ensure there is no /etc/vz/conf/ve-altlinux-test.conf-sample 2. Create /var/lib/vz/template/cache/altlinux-test.tar 3. Use libvirt with (the same as above) XML file -----------
ping?