From b9daebfee49380df85f1386b9caf5a6348d4c046 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 22 Dec 2009 17:44:03 +0100 Subject: [PATCH] convert missing server entry points into unsupported errors If using a remote access, sometimes an RPC entry point is not available, and currently we just end up with a raw: error: unknown procedure: xxx error, while this should be more cleanly reported as an unsupported entry point like for local access * src/remote/remote_driver.c: convert missing remote entry points into the unsupported feature error --- src/remote/remote_driver.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index be51366d4b..d6f5fcece2 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8530,6 +8530,27 @@ cleanup: thiscall->err.message && STRPREFIX(*thiscall->err.message, "unknown procedure")) { rv = -2; + } else if (thiscall->err.domain == VIR_FROM_REMOTE && + thiscall->err.code == VIR_ERR_RPC && + thiscall->err.level == VIR_ERR_ERROR && + thiscall->err.message && + STRPREFIX(*thiscall->err.message, "unknown procedure")) { + /* + * convert missing remote entry points into the unsupported + * feature error + */ + virRaiseErrorFull(flags & REMOTE_CALL_IN_OPEN ? NULL : conn, + __FILE__, __FUNCTION__, __LINE__, + thiscall->err.domain, + VIR_ERR_NO_SUPPORT, + thiscall->err.level, + thiscall->err.str1 ? *thiscall->err.str1 : NULL, + thiscall->err.str2 ? *thiscall->err.str2 : NULL, + thiscall->err.str3 ? *thiscall->err.str3 : NULL, + thiscall->err.int1, + thiscall->err.int2, + "%s", *thiscall->err.message); + rv = -1; } else { virRaiseErrorFull(flags & REMOTE_CALL_IN_OPEN ? NULL : conn, __FILE__, __FUNCTION__, __LINE__, @@ -8541,7 +8562,7 @@ cleanup: thiscall->err.str3 ? *thiscall->err.str3 : NULL, thiscall->err.int1, thiscall->err.int2, - "%s", thiscall->err.message ? *thiscall->err.message : NULL); + "%s", thiscall->err.message ? *thiscall->err.message : "unknown"); rv = -1; } xdr_free((xdrproc_t)xdr_remote_error, (char *)&thiscall->err);