[libvirt] [PATCH 3/8] nodeinfo: Cleanup improper VIR_ERR_NO_SUPPORT use
Osier Yang
jyang at redhat.com
Thu Sep 1 06:42:51 UTC 2011
于 2011年08月25日 05:48, Daniel P. Berrange 写道:
> On Tue, Aug 23, 2011 at 05:39:40PM +0800, Osier Yang wrote:
>> ---
>> src/nodeinfo.c | 16 ++++++++--------
>> 1 files changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/nodeinfo.c b/src/nodeinfo.c
>> index cae2564..b21e555 100644
>> --- a/src/nodeinfo.c
>> +++ b/src/nodeinfo.c
>> @@ -629,7 +629,7 @@ int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo) {
>> }
>> #else
>> /* XXX Solaris will need an impl later if they port QEMU driver */
>> - nodeReportError(VIR_ERR_NO_SUPPORT, "%s",
>> + nodeReportError(VIR_ERR_OPERATION_INVALID, "%s",
>> _("node info not implemented on this platform"));
>> return -1;
>> #endif
>> @@ -658,7 +658,7 @@ int nodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
>> return ret;
>> }
>> #else
>> - nodeReportError(VIR_ERR_NO_SUPPORT, "%s",
>> + nodeReportError(VIR_ERR_OPERATION_INVALID, "%s",
>> _("node CPU stats not implemented on this platform"));
>> return -1;
>> #endif
>> @@ -688,7 +688,7 @@ int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
>> # if HAVE_NUMACTL
>> if (numa_available()< 0) {
>> # endif
>> - nodeReportError(VIR_ERR_NO_SUPPORT,
>> + nodeReportError(VIR_ERR_OPERATION_INVALID,
Hi, Daniel
I think VIR_ERR_NO_SUPPORT is not correct, as the function is neither a
no-op stub
and not implemented. But per your explaination on [patch 0/8],
OPERATION_INVALID
is not proper here too. Change it into INTERNAL_ERROR.
>> "%s", _("NUMA not supported on this host"));
>> return -1;
>> # if HAVE_NUMACTL
>> @@ -724,7 +724,7 @@ int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
>> return ret;
>> }
>> #else
>> - nodeReportError(VIR_ERR_NO_SUPPORT, "%s",
>> + nodeReportError(VIR_ERR_OPERATION_INVALID, "%s",
>> _("node memory stats not implemented on this platform"));
>> return -1;
>> #endif
>> @@ -818,7 +818,7 @@ nodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED,
>> int maxCell;
>>
>> if (numa_available()< 0) {
>> - nodeReportError(VIR_ERR_NO_SUPPORT,
>> + nodeReportError(VIR_ERR_OPERATION_INVALID,
likewise
>> "%s", _("NUMA not supported on this host"));
>> goto cleanup;
>> }
>> @@ -856,7 +856,7 @@ nodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED)
>> int n;
>>
>> if (numa_available()< 0) {
>> - nodeReportError(VIR_ERR_NO_SUPPORT,
likewise
>> + nodeReportError(VIR_ERR_OPERATION_INVALID,
>> "%s", _("NUMA not supported on this host"));
>> goto cleanup;
>> }
>> @@ -885,14 +885,14 @@ int nodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED,
>> int startCell ATTRIBUTE_UNUSED,
>> int maxCells ATTRIBUTE_UNUSED)
>> {
>> - nodeReportError(VIR_ERR_NO_SUPPORT, "%s",
>> + nodeReportError(VIR_ERR_OPERATION_INVALID, "%s",
>> _("NUMA memory information not available on this platform"));
>> return -1;
>> }
>>
>> unsigned long long nodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED)
>> {
>> - nodeReportError(VIR_ERR_NO_SUPPORT, "%s",
>> + nodeReportError(VIR_ERR_OPERATION_INVALID, "%s",
>> _("NUMA memory information not available on this platform"));
>> return 0;
>> }
> All these changes are wrong. NO_SUPPORT is correct for cases where the
> driver method is simply stubbed out on an architecture.
All other VIR_ERR_NO_SUPPORT are changed back. Patch following.
Osier
More information about the libvir-list
mailing list