<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 18, 2018 at 5:28 PM Martin Kletzander <<a href="mailto:mkletzan@redhat.com">mkletzan@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Oct 18, 2018 at 02:12:36PM +0800, Han Han wrote:<br>
>On Wed, Oct 17, 2018 at 4:46 PM Martin Kletzander <<a href="mailto:mkletzan@redhat.com" target="_blank">mkletzan@redhat.com</a>><br>
>wrote:<br>
><br>
>> On Tue, Oct 16, 2018 at 07:19:41PM -0400, John Ferlan wrote:<br>
>> ><br>
>> ><br>
>> >On 10/14/18 10:26 AM, Han Han wrote:<br>
>> >> <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1535930" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=1535930</a><br>
>> >><br>
>> >> Report more clear err msg instead of unknown error when coalesce<br>
>> >> settings is incomplete.<br>
>> >><br>
>><br>
>> Incomplete is not an error.  It's request for removal of the missing<br>
>> setting.<br>
>> There is no problem if it is incomplete.<br>
>><br>
>> Well, I think incomplete xml is the problem because I have reproduce it on<br>
>an inactive<br>
>VM as <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1535930#c4" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=1535930#c4</a> .<br>
><br>
>I am not sure it will be something wrong when update the device lively, but<br>
>we can fix<br>
>this first.<br>
><br>
<br>
So I looked at the code and yes, there is inconsistency in the parsing.  If the<br>
function does not parse anything it just returns NULL without an error set and<br>
the caller treats that as an error.<br>
<br>
What we should do is pass the dev into the function, make the function return<br>
int (0 for OK, -1 for error) and update the coalesce in the passed parameter.<br>
That way empty (incomplete) coalesce will not error out, but will just set<br>
nothing in the device.<br>
<br>
This is not the whole fix, though.  What is missing is the fact that if such<br>
device is being updated, then we need to see if everything was reset to zero and<br>
reset the pointer and free the coalesce struct from memory (ideally).  Although<br>
there shouldn't be a code that will fail if the struct is allocated but<br>
everything is zero.<br>
<br>
Would you mind having a look at that in v2?<br>
<br></blockquote><div>OK. I will try to make a whole fix in v2. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
>> If you look at the BZ the problem is not the incomplete XML, but the fact<br>
>> that<br>
>> the code that should update the device fails somewhere without setting an<br>
>> error.<br>
>> Actually, there should not be an error, it should work.  So this just works<br>
>> around the actual issue.<br>
>><br>
>> Having said that maybe the problem is somewhere in the parsing part, but<br>
>> this is<br>
>> not the solution.  We need to "go deeper" to find out why the updating code<br>
>> fails and then figure out what to fix from there, not put a sheet over the<br>
>> problem.<br>
>><br>
>> >> Signed-off-by: Han Han <<a href="mailto:hhan@redhat.com" target="_blank">hhan@redhat.com</a>><br>
>> >> ---<br>
>> >>  src/conf/domain_conf.c | 6 +++++-<br>
>> >>  1 file changed, 5 insertions(+), 1 deletion(-)<br>
>> >><br>
>> >> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c<br>
>> >> index 9911d56130..e755f45d3d 100644<br>
>> >> --- a/src/conf/domain_conf.c<br>
>> >> +++ b/src/conf/domain_conf.c<br>
>> >> @@ -7804,8 +7804,12 @@ virDomainNetDefCoalesceParseXML(xmlNodePtr node,<br>
>> >>      ctxt->node = node;<br>
>> >><br>
>> >>      str = virXPathString("string(./rx/frames/@max)", ctxt);<br>
>> >> -    if (!str)<br>
>> >> +    if (!str) {<br>
>> >> +        virReportError(VIR_ERR_XML_DETAIL,<br>
>> >> +                       "%s",<br>
>> ><br>
>> >This can be put on the previous line<br>
>> ><br>
>> >> +                       _("incomplete coalesce settings in interface<br>
>> xml"));<br>
>> ><br>
>> >and specifically this could be is missing rx frames max attributes<br>
>> ><br>
>> >However, according to the RNG from commit 523c9960, it seems the 'rx' is<br>
>> >optional as is the '@max' value.  Maybe Martin should provide a comment<br>
>> >on this series since he added it.<br>
>> ><br>
>> >Of course that would cause the whole <coalesce> to disappear on Format.<br>
>> >It would also cause problems because def->coalesce would have something<br>
>> >that's empty.<br>
>> ><br>
>> >So perhaps the best thing to do is pass the @def into here, then only if<br>
>> >we get beyond the initial !str comparison do we allocate and fill it in;<br>
>> >otherwise, we return 0 if rx/frames/@max is not there.  Prepares us for<br>
>> >the future.<br>
>> ><br>
>> >I guess I'm not 100% clear if max frames == 0 what would happen. Maybe<br>
>> >Martin knows (I've CC'd him).<br>
>> ><br>
>><br>
>> `rx-frames=0` turns that option off.  It's like not having the parameter<br>
>> there<br>
>> at all (it also works like this with ethtool).<br>
>><br>
>Set  `rx-frames=0` is a better solution compared with report a error to<br>
>incomplete<br>
>the incomplete coalesce setting.<br>
><br>
>><br>
>> >John<br>
>> ><br>
>> >>          goto cleanup;<br>
>> >> +    }<br>
>> >><br>
>> >>      if (VIR_ALLOC(ret) < 0)<br>
>> >>          goto cleanup;<br>
>> >><br>
>><br>
><br>
><br>
>-- <br>
>Best regards,<br>
>-----------------------------------<br>
>Han Han<br>
>Quality Engineer<br>
>Redhat.<br>
><br>
>Email: <a href="mailto:hhan@redhat.com" target="_blank">hhan@redhat.com</a><br>
>Phone: +861065339333<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Best regards,</div><div dir="ltr">-----------------------------------<br></div><div dir="ltr">Han Han<br>Quality Engineer<br>Redhat.<br><br>Email: <a href="mailto:hhan@redhat.com" target="_blank">hhan@redhat.com</a><br>Phone: +861065339333<br></div></div></div></div></div></div></div>