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

[PATCH V3 2/3] libxl: Call libxl__virtio_devtype.set_default() early enough



The _setdefault() function for virtio devices is getting called after
libxl__prepare_dtb(), which is late as libxl__prepare_dtb() expects the
defaults to be already set by this time.

Call libxl__virtio_devtype.set_default() from
libxl__domain_config_setdefault(), in a similar way as other devices
like disk, etc.

Suggested-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
---
 tools/libs/light/libxl_create.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index ec8eab02c207..36770af6d4ff 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -1068,7 +1068,7 @@ int libxl__domain_config_setdefault(libxl__gc *gc,
                                     uint32_t domid /* for logging, only */)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    int ret;
+    int ret, i;
     bool pod_enabled = false;
     libxl_domain_create_info *c_info = &d_config->c_info;
 
@@ -1266,6 +1266,15 @@ int libxl__domain_config_setdefault(libxl__gc *gc,
         goto error_out;
     }
 
+    for (i = 0; i < d_config->num_virtios; i++) {
+        ret = libxl__virtio_devtype.set_default(gc, domid,
+                                                &d_config->virtios[i], false);
+        if (ret) {
+            LOGD(ERROR, domid, "Unable to set virtio defaults for device %d", 
i);
+            goto error_out;
+        }
+    }
+
     ret = 0;
  error_out:
     return ret;
-- 
2.31.1.272.g89b43f80a514




 


Rackspace

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