[libvirt] [PATCH] Openvz: how to use a nondefault config

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 -----------

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?

2009/3/27 Daniel Veillard <veillard@redhat.com>
I would like to make a new release mid or end of next week, considering the number of fixes accumulated in CVS compared to 0.6.1, I guess 0.6.2 makes sense. I think we should look at integrating the new SCSI pool patch, hopefully there is no big issues. If there are mails or patchs which are pending and we forgot to review or ACK, please raise them again so that we can try to get them in time for next release,
Here is one. This patch is a bit old now (it was obsoleted by patch from Florian Vichot), but I'm interesting if you agree with an idea. If you are, then I'll write new patch.

On Fri, Mar 27, 2009 at 12:35:27PM +0300, Anton Protopopov wrote:
2009/3/27 Daniel Veillard <veillard@redhat.com>
I would like to make a new release mid or end of next week, considering the number of fixes accumulated in CVS compared to 0.6.1, I guess 0.6.2 makes sense. I think we should look at integrating the new SCSI pool patch, hopefully there is no big issues. If there are mails or patchs which are pending and we forgot to review or ACK, please raise them again so that we can try to get them in time for next release,
Here is one. This patch is a bit old now (it was obsoleted by patch from Florian Vichot), but I'm interesting if you agree with an idea. If you are, then I'll write new patch.
Yup I was thinking about your patch when writing this :-) I would have to dig again to see how much in line it is with current practice for OpenVZ, if Evgeniy could voice his opinion that would be more improtant than my uninformed viewpoint on this ... Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

2009/3/27 Daniel Veillard <veillard@redhat.com>
On Fri, Mar 27, 2009 at 12:35:27PM +0300, Anton Protopopov wrote:
2009/3/27 Daniel Veillard <veillard@redhat.com>
I would like to make a new release mid or end of next week, considering the number of fixes accumulated in CVS compared to 0.6.1, I guess 0.6.2 makes sense. I think we should look at integrating the new SCSI pool patch, hopefully there is no big issues. If there are mails or patchs which are pending and we forgot to review or ACK, please raise them again so that we can try to get them in time for next release,
Here is one. This patch is a bit old now (it was obsoleted by patch from Florian Vichot), but I'm interesting if you agree with an idea. If you are, then I'll write new patch.
Yup I was thinking about your patch when writing this :-) I would have to dig again to see how much in line it is with current practice for OpenVZ, if Evgeniy could voice his opinion that would be more improtant than my uninformed viewpoint on this ...
As a week past and Evgeniy is still silent, I'm sending a new patch to be in time for reslease.
Daniel
-- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Mon, Mar 16, 2009 at 06:12:07PM +0300, Anton Protopopov wrote:
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.)
I don't particularly like the fact that there are all these extra hidden config parameters in the template config. We should aim to get these all exposed in the libvirt XML and/or APIs as applicable. That said, this patch you are suggesting seems like a reasonable approach for this point in time. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Hi Anton, I'm sorry for delay. I was on vacation.
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.)
Config /etc/vz/conf/ve-XXX.conf-sample define there are many parameters like memory, CPU etc. This parameters are not properties of <filesystem>. Daniel, usage of pre-defined configs in really usefull. Can we create additional tag inside <domain></domain>?
----------- 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 -----------
------------------------------------------------------------------------
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Thu, Apr 02, 2009 at 06:36:15PM +0400, Evgeniy Sokolov wrote:
Config /etc/vz/conf/ve-XXX.conf-sample define there are many parameters like memory, CPU etc. This parameters are not properties of <filesystem>.
Daniel, usage of pre-defined configs in really usefull. Can we create additional tag inside <domain></domain>?
The trouble with this is that given the XML config of a guest, you can no longer determine what its configuration is, because a large amount of configuration is hidden in this opaque 'template'. If we're to support templates, I think we need to make them first class objects, so you can query what templates exist, and see their associated config settings. eg, expose a simple API virDomainTemplatePtr; int virConnectListDomainTemplates(virConnectPtr conn, const char **names); virDomainTemplatePtr virDomainTemplateLookupbyName(virConnectPtr con, const char *name) char *virDomainTemplateGetXMLDesc(virDomainTemplatePtr tmpl); virDomainTemplatePtr virDomainTemplateDefineXML(virConnectPtr conn, const char *xml) int virDomainTemplateUndefine(virDomainTemplatePtr tmpl); int virDomainTemplateFree(virDomainTemplatePtr tmpl); Then, we could either include a <template>$NAME</template> parameter in the XML for a guest. Or have an alternate API for creating guests virDomainCreateXMLWithTemplate(virConnectPtr conn, const char *xmlDesc, const char *template) It depends whether we'd want to track the template <-> guest association forever, or just use it once to fill-in the guest XML and then forget about the template after that. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (4)
-
Anton Protopopov
-
Daniel P. Berrange
-
Daniel Veillard
-
Evgeniy Sokolov