Re: Xen string2sexpr and sexpr2string lose quotes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]