
14 Jan
2011
14 Jan
'11
8:47 p.m.
On 01/14/2011 02:21 PM, Eric Blake wrote: > On 01/14/2011 10:35 AM, Laine Stump wrote: >> The sndbuf value is put inside a<tune> element of each<interface> in >> the domain. The intent is that further tunable settings will also be >> placed inside this element. >> >> <interface type='network'> >> ... >> <tune> >> <sndbuf>0</sndbuf> >> ... >> </tune> >> </interface> >> --- >> >> Changes from V1: >> >> sndbuf_specified is now a bool rather than an int bitfield. >> >> sndbuf is now unsigned long. Made possible by eblake's patch adding new >> virXPath* and virStrToLong_* functions. > Glad to hear it :) > >> + if (virXPathULong("string(./tune/sndbuf)", ctxt,&def->tune.sndbuf)>= 0) { >> + def->tune.sndbuf_specified = true; >> + } > This silently ignores invalid values, such as<sndbuf>-1</sndbuf>, > rather than flagging them as errors. Is that intentional? > > ACK, with that nit addressed. I squashed in the following diff and pushed (I'm sure this diff will be mangled by Thunderbird, but it's for informational purposes anyway): diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5b1516d..4a7f879 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2305,6 +2305,7 @@ virDomainNetDefParseXML(virCapsPtr caps, virVirtualPortProfileParams virtPort; bool virtPortParsed = false; xmlNodePtr oldnode = ctxt->node; + int ret; if (VIR_ALLOC(def) < 0) { virReportOOMError(); @@ -2600,8 +2601,13 @@ virDomainNetDefParseXML(virCapsPtr caps, } } - if (virXPathULong("string(./tune/sndbuf)", ctxt, &def->tune.sndbuf) >= 0) { + ret = virXPathULong("string(./tune/sndbuf)", ctxt, &def->tune.sndbuf); + if (ret >= 0) { def->tune.sndbuf_specified = true; + } else if (ret == -2) { + virDomainReportError(VIR_ERR_XML_ERROR, "%s", + _("sndbuf must be a positive integer")); + goto error; } cleanup: