From 6ac47762bb9c3851b07eaa871bfaf7ccd6017147 Mon Sep 17 00:00:00 2001 From: Osier Yang Date: Tue, 23 Aug 2011 16:17:10 +0800 Subject: [PATCH] lxc: Cleanup improper VIR_ERR_NO_SUPPORT use s/VIR_ERR_NO_SUPPORT/VIR_ERR_OPERATION_INVALID/ Special case is changes on lxcDomainInterfaceStats, if it's not implemented on the platform, prints error like: lxcError(VIR_ERR_OPERATION_INVALID, "%s", _("interface stats not implemented on this platform")); As the function is supported by driver actually, error like VIR_ERR_NO_SUPPORT is confused. --- src/lxc/lxc_driver.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index a596945ef0..5587b06ca8 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -421,7 +421,7 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml) goto cleanup; if ((def->nets != NULL) && !(driver->have_netns)) { - lxcError(VIR_ERR_NO_SUPPORT, + lxcError(VIR_ERR_OPERATION_INVALID, "%s", _("System lacks NETNS support")); goto cleanup; } @@ -728,7 +728,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) { } if (driver->cgroup == NULL) { - lxcError(VIR_ERR_NO_SUPPORT, + lxcError(VIR_ERR_OPERATION_INVALID, "%s", _("cgroups must be configured on the host")); goto cleanup; } @@ -1710,7 +1710,7 @@ static int lxcDomainStartWithFlags(virDomainPtr dom, unsigned int flags) } if ((vm->def->nets != NULL) && !(driver->have_netns)) { - lxcError(VIR_ERR_NO_SUPPORT, + lxcError(VIR_ERR_OPERATION_INVALID, "%s", _("System lacks NETNS support")); goto cleanup; } @@ -1786,7 +1786,7 @@ lxcDomainCreateAndStart(virConnectPtr conn, goto cleanup; if ((def->nets != NULL) && !(driver->have_netns)) { - lxcError(VIR_ERR_NO_SUPPORT, + lxcError(VIR_ERR_OPERATION_INVALID, "%s", _("System lacks NETNS support")); goto cleanup; } @@ -2519,7 +2519,8 @@ static int lxcDomainInterfaceStats(virDomainPtr dom, const char *path ATTRIBUTE_UNUSED, struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED) - lxcError(VIR_ERR_NO_SUPPORT, "%s", __FUNCTION__); + lxcError(VIR_ERR_OPERATION_INVALID, "%s", + _("interface stats not implemented on this platform")); return -1; } #endif -- 2.39.5