[libvirt] [PATCH 2/8] lxc: Cleanup improper VIR_ERR_NO_SUPPORT use

Osier Yang jyang at redhat.com
Tue Aug 23 09:39:39 UTC 2011


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 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index a596945..5587b06 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
-- 
1.7.6




More information about the libvir-list mailing list