On Thu, Aug 19, 2010 at 02:53:39PM +0100, Daniel P. Berrange wrote:
On Tue, Aug 17, 2010 at 08:26:09PM -0700, Thomas Graves wrote:
> Hello all,
>
> I am running xen on rhel5 and using libvirt0.7.2 (I also tried 0.7.7) and it
> looks like the routines string2sexpr and sexpr2string seem to lose the
> quotes around the image args in the configuration.
>
> Has anyone seen this and have a patch for this?
>
> I have the following libvirt config:
> <os>
> <type>linux</type>
> <kernel>/usr/lib/xen/boot/pv-grub-x86_64.gz</kernel>
> <cmdline>(hd0,0)/grub/menu.lst</cmdline>
> </os>
>
> It generates the xm config info:
> (image
> (linux
> (kernel /usr/lib/xen/boot/pv-grub-x86_64.gz)
> (args '(hd0,0)/grub/menu.lst')
> (device_model /usr/lib64/xen/bin/qemu-dm)
> )
> )
>
> I call virDomainSetAutostart on the domain and traced it through and saw
> that it gets the string quoted (args '(hd0,0)/grub/menu.lst') from xen then
> ends up calling string2sexpr, changes the xend_on_start, and then
> sexpr2string, and it ends up without quotes (args (hd0,0)/grub/menu.lst) and
> that is what it sends back to xen. Xen then seems to chop it off to (args
> ('hd0,0'))
Try adding this patch to sexpr2string
index 7e370db..df7057e 100644
--- a/src/xen/sexpr.c
+++ b/src/xen/sexpr.c
@@ -244,7 +244,9 @@ sexpr2string(const struct sexpr * sexpr, char *buffer, size_t
n_buffer)
ret += tmp;
break;
case SEXPR_VALUE:
- if (strchr(sexpr->u.value, ' '))
+ if (strchr(sexpr->u.value, ' ') ||
+ strchr(sexpr->u.value, ')') ||
+ strchr(sexpr->u.value, '('))
tmp = snprintf(buffer + ret, n_buffer - ret, "'%s'",
sexpr->u.value);
else
Okay, I see this has been commited now,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/