[libvirt] [PATCH] Fix sexpr2string() to handle empty list

Finally have some time to submit this small patch for a bug I'm seeing with Xen 3.3.1. If s-expression returned by xend contains an empty list, sexpr2string() failed to serialize it. E.g. sexpr containing (cpus (()())) would cause sexpr2string() to fail. I spoke with danpb on IRC about this bug and he suggested adding a XML/sexpr pair that exhibits the problem to tests/xml2sexprtest.c. I can easily produce the sexpr but not the case with XML. The empty cpus lists indicate no explicit affinity and AFAIK the only way to express this in XML is absence of cpuset attribute in vcpu element. But IMO we should not produce the (cpus (()()...)) sexpr in this case. It should only be produced when user has explicitly specified affinity. Does this sound reasonable? Regards, Jim

On Wed, Aug 26, 2009 at 11:39:54AM -0600, Jim Fehlig wrote:
Finally have some time to submit this small patch for a bug I'm seeing with Xen 3.3.1.
If s-expression returned by xend contains an empty list, sexpr2string() failed to serialize it. E.g. sexpr containing (cpus (()())) would cause sexpr2string() to fail.
I see that Dan already applied you patch, so that's in !
I spoke with danpb on IRC about this bug and he suggested adding a XML/sexpr pair that exhibits the problem to tests/xml2sexprtest.c. I can easily produce the sexpr but not the case with XML. The empty cpus lists indicate no explicit affinity and AFAIK the only way to express this in XML is absence of cpuset attribute in vcpu element. But IMO we should not produce the (cpus (()()...)) sexpr in this case. It should only be produced when user has explicitly specified affinity. Does this sound reasonable?
I think so, yes. But it depends mostly on xend expectations, and that too may have changed over time (I hope not). 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/
participants (2)
-
Daniel Veillard
-
Jim Fehlig