[Pkg-libvirt-commits] [libguestfs] 72/233: launch: direct: Add force_tcg backend setting.

Hilko Bengen bengen at moszumanska.debian.org
Wed Feb 19 21:10:56 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 11ac9f702440fff5c8dad1f9756f24ca6867712c
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Sat Jan 18 16:28:58 2014 +0000

    launch: direct: Add force_tcg backend setting.
    
    By using:
    
      export LIBGUESTFS_BACKEND=direct
      export LIBGUESTFS_BACKEND_SETTINGS=force_tcg
    
    you can force the direct backend to use TCG (software emulation)
    instead of KVM (hardware accelerated virtualization).
    
    This is sometimes useful, especially if you are trying to use
    nested KVM on Intel.
---
 src/guestfs.pod     |  7 +++++++
 src/launch-direct.c | 13 ++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/guestfs.pod b/src/guestfs.pod
index 2011faa..1c6d6ab 100644
--- a/src/guestfs.pod
+++ b/src/guestfs.pod
@@ -1490,6 +1490,13 @@ either call L</guestfs_set_backend_settings> with a list of strings,
 or set the C<LIBGUESTFS_BACKEND_SETTINGS> environment variable to a
 colon-separated list of strings (before creating the handle).
 
+Currently the only backend setting is:
+
+ export LIBGUESTFS_BACKEND_SETTINGS=force_tcg
+
+which will force the direct backend to use TCG (software emulation)
+instead of KVM (hardware accelerated virtualization).
+
 =head2 ATTACHING TO RUNNING DAEMONS
 
 I<Note (1):> This is B<highly experimental> and has a tendency to eat
diff --git a/src/launch-direct.c b/src/launch-direct.c
index a90956b..809b460 100644
--- a/src/launch-direct.c
+++ b/src/launch-direct.c
@@ -290,6 +290,7 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
   int virtio_scsi;
   struct hv_param *hp;
   bool has_kvm;
+  bool force_tcg;
 
   /* At present you must add drives before starting the appliance.  In
    * future when we enable hotplugging you won't need to do this.
@@ -299,7 +300,10 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
     return -1;
   }
 
-  debian_kvm_warning (g);
+  force_tcg = guestfs___get_backend_setting_bool (g, "force_tcg");
+
+  if (!force_tcg)
+    debian_kvm_warning (g);
 
   guestfs___launch_send_progress (g, 0);
 
@@ -446,7 +450,10 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
    */
   if (qemu_supports (g, data, "-machine")) {
     ADD_CMDLINE ("-machine");
-    ADD_CMDLINE ("accel=kvm:tcg");
+    if (!force_tcg)
+      ADD_CMDLINE ("accel=kvm:tcg");
+    else
+      ADD_CMDLINE ("accel=tcg");
   } else {
     /* qemu sometimes needs this option to enable hardware
      * virtualization, but some versions of 'qemu-kvm' will use KVM
@@ -456,7 +463,7 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
      * available will cause qemu to fail.  A giant clusterfuck with
      * the qemu command line, again.
      */
-    if (qemu_supports (g, data, "-enable-kvm") && has_kvm)
+    if (has_kvm && !force_tcg && qemu_supports (g, data, "-enable-kvm"))
       ADD_CMDLINE ("-enable-kvm");
   }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list