tools: libxl: read nictype from xenstore
authorWen Congyang <wency@cn.fujitsu.com>
Mon, 22 Sep 2014 05:59:16 +0000 (13:59 +0800)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 22 Sep 2014 14:19:54 +0000 (15:19 +0100)
We need to use nictype to get default vifname.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl.c

index f796da8e61de95a184d1aee305630411b3c465b3..77672d06bac0636c3c9f8d5ab0475ab796246f7c 100644 (file)
@@ -3348,7 +3348,13 @@ static int libxl__device_nic_from_xs_be(libxl__gc *gc,
     nic->script = READ_BACKEND(NOGC, "script");
 
     /* vif_ioemu nics use the same xenstore entries as vif interfaces */
-    nic->nictype = LIBXL_NIC_TYPE_VIF;
+    tmp = READ_BACKEND(gc, "type");
+    if (tmp) {
+        rc = libxl_nic_type_from_string(tmp, &nic->nictype);
+        if (rc) goto out;
+    } else {
+        nic->nictype = LIBXL_NIC_TYPE_VIF;
+    }
     nic->model = NULL; /* XXX Only for TYPE_IOEMU */
     nic->ifname = NULL; /* XXX Only for TYPE_IOEMU */