[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC 9/9] libxl: introduce specific error codes in libxl_device_nic_add



Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
---
 tools/libxl/libxl.c          | 8 ++++----
 tools/libxl/libxl_internal.c | 2 +-
 tools/libxl/libxl_types.idl  | 4 ++++
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index f41f291..c0c0f12 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -3278,7 +3278,7 @@ int libxl__device_nic_setdefault(libxl__gc *gc, 
libxl_device_nic *nic,
     }
     if ( !nic->script && asprintf(&nic->script, "%s/vif-bridge",
                                   libxl__xen_script_dir_path()) < 0 )
-        return ERROR_FAIL;
+        return ERROR_NIC_SCRIPT_UNDETERMINED;
 
     run_hotplug_scripts = libxl__hotplug_settings(gc, XBT_NULL);
     if (run_hotplug_scripts < 0) {
@@ -3297,12 +3297,12 @@ int libxl__device_nic_setdefault(libxl__gc *gc, 
libxl_device_nic *nic,
     case LIBXL_DOMAIN_TYPE_PV:
         if (nic->nictype == LIBXL_NIC_TYPE_VIF_IOEMU) {
             LOG(ERROR, "trying to create PV guest with an emulated interface");
-            return ERROR_INVAL;
+            return ERROR_NOHVM;
         }
         nic->nictype = LIBXL_NIC_TYPE_VIF;
         break;
     case LIBXL_DOMAIN_TYPE_INVALID:
-        return ERROR_FAIL;
+        return ERROR_INVAL_DOMAIN_TYPE;
     default:
         abort();
     }
@@ -3349,7 +3349,7 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t 
domid,
 
     if (nic->devid == -1) {
         if ((nic->devid = libxl__device_nextid(gc, domid, "vif")) < 0) {
-            rc = ERROR_FAIL;
+            rc = ERROR_NIC_DEVID_UNDETERMINED;
             goto out;
         }
     }
diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
index 4ac43f8..a130c65 100644
--- a/tools/libxl/libxl_internal.c
+++ b/tools/libxl/libxl_internal.c
@@ -384,7 +384,7 @@ int libxl__hotplug_settings(libxl__gc *gc, xs_transaction_t 
t)
     val = libxl__xs_read(gc, t, DISABLE_UDEV_PATH);
     if (!val && errno != ENOENT) {
         LOGE(ERROR, "cannot read %s from xenstore", DISABLE_UDEV_PATH);
-        rc = ERROR_FAIL;
+        rc = ERROR_XS_READ;
         goto out;
     }
     if (!val) val = "0";
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 88262ca..1975e05 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -146,6 +146,10 @@ libxl_error = Enumeration("error", [
     (ENUM_PREV, "DISK_PDEV_NOT_FOUND"),
     (ENUM_PREV, "DISK_VDEV_NOT_FOUND"),
     
+    # NIC parameters could not be determined
+    (ENUM_PREV, "NIC_SCRIPT_UNDETERMINED"),
+    (ENUM_PREV, "NIC_DEVID_UNDETERMINED"),
+    
     # Operation requires an HVM domain
     (ENUM_PREV, "NOHVM"),
 
-- 
2.4.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.