diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-10-24 13:24:16 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-10-31 09:56:50 +0000 |
commit | 0cfa174589c29c3155a03df07c858f2e7a3dcaba (patch) | |
tree | 0ca3618016eac8d940ac5439d35c8e0bdf4f8bd9 /src/launch.c | |
parent | fe6072ecc6f7ea6f7ce50199c0788ac5aa6c76e3 (diff) | |
download | libguestfs-0cfa174589c29c3155a03df07c858f2e7a3dcaba.tar.gz libguestfs-0cfa174589c29c3155a03df07c858f2e7a3dcaba.tar.xz libguestfs-0cfa174589c29c3155a03df07c858f2e7a3dcaba.zip |
Add test for qemu broken -machine option (RHBZ#748266).
Also add this option, if necessary, when testing for virtio-serial
support.
When the workaround is enabled, we specify machine type 'pc'.
(cherry picked from commit 3814680423984b3c46c2f99e944c2a71862bde9f)
Diffstat (limited to 'src/launch.c')
-rw-r--r-- | src/launch.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/src/launch.c b/src/launch.c index 4981d6fe..34d09506 100644 --- a/src/launch.c +++ b/src/launch.c @@ -473,21 +473,38 @@ launch_appliance (guestfs_h *g) if (qemu_supports (g, "-nodefconfig")) add_cmdline (g, "-nodefconfig"); - /* qemu sometimes needs this option to enable hardware - * virtualization, but some versions of 'qemu-kvm' will use KVM - * regardless (even where this option appears in the help text). - * It is rumoured that there are versions of qemu where supplying - * this option when hardware virtualization is not available will - * cause qemu to fail, so we we have to check at least that - * /dev/kvm is openable. That's not reliable, since /dev/kvm - * might be openable by qemu but not by us (think: SELinux) in - * which case the user would not get hardware virtualization, - * although at least shouldn't fail. A giant clusterfuck with the - * qemu command line, again. - */ - if (qemu_supports (g, "-enable-kvm") && - is_openable (g, "/dev/kvm", O_RDWR)) - add_cmdline (g, "-enable-kvm"); + if (qemu_supports (g, "-machine")) { + add_cmdline (g, "-machine"); +#if QEMU_MACHINE_TYPE_IS_BROKEN + /* Workaround for qemu 0.15: We have to add the '[type=]pc' + * since there is no default. This is not a permanent solution + * because this only works on PC-like hardware. Other platforms + * like ppc would need a different machine type. + * + * This bug is fixed in qemu commit 2645c6dcaf6ea2a51a, and was + * not a problem in qemu < 0.15. + */ + add_cmdline (g, "pc,accel=kvm:tcg"); +#else + add_cmdline (g, "accel=kvm:tcg"); +#endif + } else { + /* qemu sometimes needs this option to enable hardware + * virtualization, but some versions of 'qemu-kvm' will use KVM + * regardless (even where this option appears in the help text). + * It is rumoured that there are versions of qemu where supplying + * this option when hardware virtualization is not available will + * cause qemu to fail, so we we have to check at least that + * /dev/kvm is openable. That's not reliable, since /dev/kvm + * might be openable by qemu but not by us (think: SELinux) in + * which case the user would not get hardware virtualization, + * although at least shouldn't fail. A giant clusterfuck with the + * qemu command line, again. + */ + if (qemu_supports (g, "-enable-kvm") && + is_openable (g, "/dev/kvm", O_RDWR)) + add_cmdline (g, "-enable-kvm"); + } /* Newer versions of qemu (from around 2009/12) changed the * behaviour of monitors so that an implicit '-monitor stdio' is |