[libvirt] [PATCH] cleanup functions which exec OpenVZ tools

On Fri, Jul 11, 2008 at 07:55:11PM +0400, Evgeniy Sokolov wrote:
Patch improve code which execute external OpenVZ tools.
+/* generate arguments to create OpenVZ container + return -1 - error + 0 - OK +*/ +static int openvzDomainDefineCmd(const char *args[], int maxarg, struct openvz_vm_def *vmdef)
Rather than passing in the pre-allocated args array of a fixed length, grab the 'ADD_ARG' and 'ADD_ARG_LIT' macros from the qemu_conf.c file in the qemudBuildCommandLine() method. They let you easily dynamically grow the argv as required, without complicating the code significantly. Apart from this, the rest of the patch looks good tome. 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 :|

Patch improve code which execute external OpenVZ tools.
+/* generate arguments to create OpenVZ container + return -1 - error + 0 - OK +*/ +static int openvzDomainDefineCmd(const char *args[], int maxarg, struct openvz_vm_def *vmdef)
Rather than passing in the pre-allocated args array of a fixed length, grab the 'ADD_ARG' and 'ADD_ARG_LIT' macros from the qemu_conf.c file in the qemudBuildCommandLine() method. They let you easily dynamically grow the argv as required, without complicating the code significantly.
I thought about it, but I planned to add in one of next patches. Thanks for review! fixed patch is attached.

On Mon, Jul 14, 2008 at 04:04:01PM +0400, Evgeniy Sokolov wrote:
Patch improve code which execute external OpenVZ tools.
+/* generate arguments to create OpenVZ container + return -1 - error + 0 - OK +*/ +static int openvzDomainDefineCmd(const char *args[], int maxarg, struct openvz_vm_def *vmdef)
Rather than passing in the pre-allocated args array of a fixed length, grab the 'ADD_ARG' and 'ADD_ARG_LIT' macros from the qemu_conf.c file in the qemudBuildCommandLine() method. They let you easily dynamically grow the argv as required, without complicating the code significantly.
I thought about it, but I planned to add in one of next patches.
Thanks for review!
fixed patch is attached.
Sorry for the delay, way cleaner, and smaller, very good :-) applied and commited, thanks a lot ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Evgeniy Sokolov