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

Re: [Libvir] [PATCH] Have xen fv acknowledge <boot> tag



Daniel Veillard wrote:
> On Wed, Mar 05, 2008 at 05:26:47PM -0500, Cole Robinson wrote:
>> https://bugzilla.redhat.com/show_bug.cgi?id=428868
>>
>> Defining a xen fullvirt guest with a <boot dev="{hd,cdrom,etc.}"> 
>> tag currently ignores this tag and forces in a kernel tag.
>> Dan pointed out the fix in the bz, which I verified does the trick.
>>
>> Patch attached.
> 
>   Hum, I get a segfault in make check when trying this patch,
> /bin/sh: line 4: 32579 Segmentation fault      abs_top_builddir=`pwd`/'..' abs_top_srcdir=`pwd`/'..' PATH="$abs_top_builddir/qemud:$PATH" ${dir}$tst
> FAIL: sexpr2xmltest
> it's a bit late tonight for a debugging session, I will look at it 
> tomorrow if you don't find it. Should be easy but in:
> 
>     if ((kernel) && (STRNEQ(kernel, loader))) {
>        ...
>     } else {
>         if (hvm) {
> 
> I assume you want to go into that 'else' if kernel and
> loader are the same string, but there is apparently a side effect
> at least in some case hit by the regression tests,
> 
> Daniel
> 

Yeah it was basically just poor checking. If there was no loader tag,
loader == NULL, which caused STRNEQ to segfault. Corrected patch
attached. I verified all the tests passed as expected.

- Cole


diff --git a/src/xend_internal.c b/src/xend_internal.c
index 8bbc28f..5de9930 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -1323,7 +1323,7 @@ xend_parse_sexp_desc_os(virConnectPtr xend, struct sexpr *node, virBufferPtr buf
     if (hvm)
         virBufferVSprintf(buf, "    <loader>%s</loader>\n", loader);
 
-    if (kernel) {
+    if (kernel && (!loader || STRNEQ(kernel, loader))) {
         virBufferVSprintf(buf, "    <kernel>%s</kernel>\n", kernel);
         if (initrd && initrd[0])
             virBufferVSprintf(buf, "    <initrd>%s</initrd>\n", initrd);

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