WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] libxl: introduce libxl_need_xenpv_qemu

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] libxl: introduce libxl_need_xenpv_qemu
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Mon, 29 Nov 2010 17:22:59 +0000
Delivery-date: Mon, 29 Nov 2010 09:23:58 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
Introduce libxl_need_xenpv_qemu to detect if the caller needs to create
a pv qemu instance (using libxl_create_xenpv_qemu).
A positive reply depends on the number of pv console and vfbs, and the
type of disk backends.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

---

diff -r 79b71c77907b tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Nov 24 10:20:03 2010 +0000
+++ b/tools/libxl/libxl.c       Mon Nov 29 16:17:36 2010 +0000
@@ -2632,6 +2632,39 @@ static int libxl_build_xenpv_qemu_args(l
     return 0;
 }
 
+int libxl_need_xenpv_qemu(libxl_ctx *ctx,
+        int nr_consoles, libxl_device_console *consoles,
+        int nr_vfbs, libxl_device_vfb *vfbs,
+        int nr_disks, libxl_device_disk *disks)
+{
+    int i, ret = 0;
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+
+    if (nr_consoles > 1) {
+        ret = 1;
+        goto out;
+    }
+
+    for (i = 0; i < nr_consoles; i++) {
+        if (consoles[i].consback == LIBXL_CONSBACK_IOEMU) {
+            ret = 1;
+            goto out;
+        }
+    }
+
+    if (nr_vfbs > 0) {
+        ret = 1;
+        goto out;
+    }
+
+    if (nr_disks > 0 && !libxl__blktap_enabled(&gc))
+        ret = 1;
+
+out:
+    libxl__free_all(&gc);
+    return ret;
+}
+
 int libxl_create_xenpv_qemu(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb 
*vfb,
                             libxl_device_model_starting **starting_r)
 {
diff -r 79b71c77907b tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Wed Nov 24 10:20:03 2010 +0000
+++ b/tools/libxl/libxl.h       Mon Nov 29 16:17:36 2010 +0000
@@ -376,6 +376,10 @@ int libxl_create_device_model(libxl_ctx 
                               libxl_device_model_starting **starting_r);
 int libxl_create_xenpv_qemu(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb 
*vfb,
                             libxl_device_model_starting **starting_r);
+int libxl_need_xenpv_qemu(libxl_ctx *ctx,
+        int nr_consoles, libxl_device_console *consoles,
+        int nr_vfbs, libxl_device_vfb *vfbs,
+        int nr_disks, libxl_device_disk *disks);
   /* Caller must either: pass starting_r==0, or on successful
    * return pass *starting_r (which will be non-0) to
    * libxl_confirm_device_model or libxl_detach_device_model. */
diff -r 79b71c77907b tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed Nov 24 10:20:03 2010 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Mon Nov 29 16:17:36 2010 +0000
@@ -1675,6 +1675,7 @@ start:
                                         d_config.vifs, d_config.num_vifs,
                                         &dm_starting) );
     } else {
+        int need_qemu = 0;
         libxl_device_console console;
 
         for (i = 0; i < d_config.num_vfbs; i++) {
@@ -1686,12 +1687,18 @@ start:
 
         init_console_info(&console, 0, &state);
         console.domid = domid;
-        if (d_config.num_vfbs)
+
+        need_qemu = libxl_need_xenpv_qemu(&ctx, 1, &console,
+                d_config.num_vfbs, d_config.vfbs,
+                d_config.num_disks, &d_config.disks[0]);
+
+        if (need_qemu)
              console.consback = LIBXL_CONSBACK_IOEMU;
+
         libxl_device_console_add(&ctx, domid, &console);
         libxl_device_console_destroy(&console);
 
-        if (d_config.num_vfbs)
+        if (need_qemu)
             libxl_create_xenpv_qemu(&ctx, domid, d_config.vfbs, &dm_starting);
     }
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] libxl: introduce libxl_need_xenpv_qemu, Stefano Stabellini <=