
On Wed, Nov 04, 2009 at 07:10:41PM +0000, Daniel P. Berrange wrote:
On Wed, Nov 04, 2009 at 04:22:02PM +0000, Matthew Booth wrote:
* src/conf/domain_conf.c: Throw an error if guestfwd address isn't IPv4 --- src/conf/domain_conf.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 94bce1e..ec2a1bc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1482,6 +1482,13 @@ virDomainChrDefParseXML(virConnectPtr conn, goto error; }
+ if(def->target.addr->stor.ss_family != AF_INET) {
^^^^ whitespace issue
Okay, I fixed a number of those in that module too
+ virDomainReportError(conn, VIR_ERR_NO_SUPPORT, "%s", + _("guestfwd channel only supports " + "IPv4 addresses")); + goto error; + } + if(portStr == NULL) { virDomainReportError(conn, VIR_ERR_INVALID_DOMAIN, "%s", _("guestfwd channel does " --
NO_SUPPORT isn't really the best error code to use here - that's intended for public API calls which aren't implemented by a driver.
Our reporting of XML configurations which aren't valid is pretty rubbish as we don't have a standard error code - people have been making it up as we go along.
I think we should add a new error code:
VIR_ERR_CONFIG_UNSUPPORTED
whcih we can then standardize on for this kind of thing
yup, makes sense, we have VIR_ERR_XML_ERROR for pure XML configuration errors where the constructs are just invalid (I fixed a few in that module, it was using VIR_ERR_INVALID_DOMAIN :-) but that one is for valid but unsupported configurations. I ended up with the following patch which I pushed thanks ! 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/