From patchwork Wed Jul 25 19:47:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 173254 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A9A6A2C0094 for ; Thu, 26 Jul 2012 05:58:59 +1000 (EST) Received: from localhost ([::1]:32938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su7jV-0000yX-UN for incoming@patchwork.ozlabs.org; Wed, 25 Jul 2012 15:58:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:32986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su7jO-0000yP-T1 for qemu-devel@nongnu.org; Wed, 25 Jul 2012 15:58:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Su7jN-0005Gv-0f for qemu-devel@nongnu.org; Wed, 25 Jul 2012 15:58:50 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:55851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su7jM-0005GR-SI for qemu-devel@nongnu.org; Wed, 25 Jul 2012 15:58:48 -0400 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Jul 2012 15:48:03 -0400 Received: from d01dlp01.pok.ibm.com (9.56.224.56) by e8.ny.us.ibm.com (192.168.1.108) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 25 Jul 2012 15:48:00 -0400 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 2FEF538C803B for ; Wed, 25 Jul 2012 15:47:59 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6PJlwg63014976 for ; Wed, 25 Jul 2012 15:47:58 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6Q1Ip9i005771 for ; Wed, 25 Jul 2012 21:18:51 -0400 Received: from titi.austin.rr.com (sig-9-65-116-102.mts.ibm.com [9.65.116.102]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6Q1IopU005622; Wed, 25 Jul 2012 21:18:50 -0400 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Wed, 25 Jul 2012 14:47:57 -0500 Message-Id: <1343245677-20904-1-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.5.4 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12072519-9360-0000-0000-000008C5DC49 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.182.138 Cc: Eric Blake , Anthony Liguori , Markus Armbruster , Peter Maydell Subject: [Qemu-devel] [PATCH] vl: add -libvirt-caps option for libvirt to stop parsing help output X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The help output is going to change dramatically for 0.13. We've spent too long waiting for a perfect solution to capabilities handling and the end loser is the direct consumer of QEMU because the help output is awful. I will not apply any patches that change help output until 0.13 development opens up. This should give libvirt adequate time to implement support for dealing with this new option. This capabilities set comes directly from libvirt's source code so it's entirely adequate for libvirt's purposes. We can still explore more sophisticated approaches that are more general purpose but the help output will be changing. Signed-off-by: Anthony Liguori --- Makefile.objs | 2 + libvirt-caps.c | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ libvirt-caps.h | 19 ++++++ qemu-options.hx | 4 + vl.c | 5 ++ 5 files changed, 196 insertions(+), 0 deletions(-) create mode 100644 libvirt-caps.c create mode 100644 libvirt-caps.h diff --git a/Makefile.objs b/Makefile.objs index 5ebbcfa..0495a88 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -95,6 +95,8 @@ common-obj-y += qemu-timer.o qemu-timer-common.o common-obj-$(CONFIG_SLIRP) += slirp/ +common-obj-y += libvirt-caps.o + ###################################################################### # libuser diff --git a/libvirt-caps.c b/libvirt-caps.c new file mode 100644 index 0000000..6d2b74d --- /dev/null +++ b/libvirt-caps.c @@ -0,0 +1,166 @@ +/* + * Libvirt capabilities + * + * Copyright IBM, Corp. 2012 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#include "libvirt-caps.h" +#include "qemu-common.h" + +/* Make sure this stays in sync with libvirt/src/qemu/qemu_capabilities.c */ + +static const char *supported_caps[] = { +// "kqemu", + "vnc-colon", + "no-reboot", + "drive", + "drive-boot", + + "name", + "uuid", + "domid", + "vnet-hdr", +// "migrate-kvm-stdio", + + "migrate-qemu-tcp", + "migrate-qemu-exec", + "drive-cache-v2", + "kvm", + "drive-format", + + "vga", + "0.10", + "pci-device", + "mem-path", + "drive-serial", + +#if defined(CONFIG_XEN) + "xen-domid", +#endif + "migrate-qemu-unix", + "chardev", + "enable-kvm", + "monitor-json", + + "balloon", + "device", + "sdl", + "smp-topology", + "netdev", + + "rtc", + "vhost-net", + "rtc-td-hack", + "no-hpet", +// "no-kvm-pit", + +// "tdf", +// "pci-configfd", + "nodefconfig", + "boot-menu", +// "enable-kqemu", + + "fsdev", + "nesting", + "name-process", + "drive-readonly", + "smbios-type", + + "vga-qxl", + "spice", + "vga-none", + "migrate-qemu-fd", + "boot-index", + + "hda-duplex", + "drive-aio", + "pci-multibus", + "pci-bootindex", + "ccid-emulated", + + "ccid-passthru", +#if defined(CONFIG_SPICE) + "chardev-spicevmc", + "device-spicevmc", +#endif + "virtio-tx-alg", +#if defined(CONFIG_SPICE) + "device-qxl-vga", +#endif + + "pci-multifunction", + "virtio-blk-pci.ioeventfd", + "sga", + "virtio-blk-pci.event_idx", + "virtio-net-pci.event_idx", + + "cache-directsync", + "piix3-usb-uhci", + "piix4-usb-uhci", + "usb-ehci", + "ich9-usb-ehci1", + + "vt82c686b-usb-uhci", + "pci-ohci", + "usb-redir", + "usb-hub", + "no-shutdown", + + "cache-unsafe", + "rombar", + "ich9-ahci", + "no-acpi", + "fsdev-readonly", + + "virtio-blk-pci.scsi", + "blk-sg-io", + "drive-copy-on-read", + "cpu-host", + "fsdev-writeout", + + "drive-iotune", + "system_wakeup", + "scsi-disk.channel", + "scsi-block", + "transaction", + + NULL +}; + +void qemu_print_capabilities(void) +{ + int i; + bool new_line = true; + int width = 0; + + printf("[\n"); + for (i = 0; supported_caps[i]; i++) { + repeat: + if (new_line) { + new_line = false; + printf(" "); + width += 4; + } else { + printf(", "); + width += 2; + } + + width += strlen(supported_caps[i]) + 2; + if (width >= 78) { + printf("\n"); + new_line = true; + width = 0; + goto repeat; + } + + printf("\"%s\"", supported_caps[i]); + } + printf("\n]\n"); +} diff --git a/libvirt-caps.h b/libvirt-caps.h new file mode 100644 index 0000000..ad89d5b --- /dev/null +++ b/libvirt-caps.h @@ -0,0 +1,19 @@ +/* + * Libvirt capabilities + * + * Copyright IBM, Corp. 2012 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#ifndef LIBVIRT_CAPS_H +#define LIBVIRT_CAPS_H + +void qemu_print_capabilities(void); + +#endif diff --git a/qemu-options.hx b/qemu-options.hx index dc68e15..6f74afa 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2783,6 +2783,10 @@ DEF("qtest-log", HAS_ARG, QEMU_OPTION_qtest_log, "-qtest-log LOG specify tracing options\n", QEMU_ARCH_ALL) +DEF("libvirt-caps", 0, QEMU_OPTION_libvirt_caps, + "-libvirt-caps dump out a JSON list of capabilities\n", + QEMU_ARCH_ALL) + HXCOMM This is the last statement. Insert new options before this line! STEXI @end table diff --git a/vl.c b/vl.c index 54e36ed..24c7596 100644 --- a/vl.c +++ b/vl.c @@ -161,6 +161,7 @@ int main(int argc, char **argv) #include "arch_init.h" #include "ui/qemu-spice.h" +#include "libvirt-caps.h" //#define DEBUG_NET //#define DEBUG_SLIRP @@ -3198,6 +3199,10 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_qtest_log: qtest_log = optarg; break; + case QEMU_OPTION_libvirt_caps: + qemu_print_capabilities(); + exit(0); + break; default: os_parse_cmd_args(popt->index, optarg); }