[libvirt] [PATCH 0/2] Suppress log message when using unsupported TPM QMP commands

Properly suppress log messages when using unsupported TPM QMP commands. Stefan

Revert the patch checking for the QMP query-tpm-models command. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> --- src/qemu/qemu_capabilities.c | 7 ------- src/qemu/qemu_capabilities.h | 1 - 2 files changed, 8 deletions(-) Index: libvirt/src/qemu/qemu_capabilities.c =================================================================== --- libvirt.orig/src/qemu/qemu_capabilities.c +++ libvirt/src/qemu/qemu_capabilities.c @@ -220,8 +220,6 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAS "machine-usb-opt", "tpm-passthrough", "tpm-tis", - - "query-tpm-models", /* 140 */ ); struct _virQEMUCaps { @@ -1964,8 +1962,6 @@ virQEMUCapsProbeQMPCommands(virQEMUCapsP virQEMUCapsSet(qemuCaps, QEMU_CAPS_ADD_FD); else if (STREQ(name, "nbd-server-start")) virQEMUCapsSet(qemuCaps, QEMU_CAPS_NBD_SERVER); - else if (STREQ(name, "query-tpm-models")) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_TPM_MODELS); VIR_FREE(name); } VIR_FREE(commands); @@ -2149,9 +2145,6 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qe int nentries, i; char **entries = NULL; - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_TPM_MODELS)) - return 0; - if ((nentries = qemuMonitorGetTPMModels(mon, &entries)) < 0) return -1; Index: libvirt/src/qemu/qemu_capabilities.h =================================================================== --- libvirt.orig/src/qemu/qemu_capabilities.h +++ libvirt/src/qemu/qemu_capabilities.h @@ -179,7 +179,6 @@ enum virQEMUCapsFlags { QEMU_CAPS_MACHINE_USB_OPT = 137, /* -machine xxx,usb=on/off */ QEMU_CAPS_DEVICE_TPM_PASSTHROUGH = 138, /* -tpmdev passthrough */ QEMU_CAPS_DEVICE_TPM_TIS = 139, /* -device tpm_tis */ - QEMU_CAPS_TPM_MODELS = 140, /* query-tpm-models QMP command */ QEMU_CAPS_LAST, /* this must always be the last item */ };

Check for an unsupported QMP command when using the query-tpm-models and query-tpm-types commands before checking for general errors in order to avoid error messages in the log. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> --- src/qemu/qemu_monitor_json.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) Index: libvirt/src/qemu/qemu_monitor_json.c =================================================================== --- libvirt.orig/src/qemu/qemu_monitor_json.c +++ libvirt/src/qemu/qemu_monitor_json.c @@ -4774,8 +4774,12 @@ qemuMonitorJSONGetStringArray(qemuMonito ret = qemuMonitorJSONCommand(mon, cmd, &reply); - if (ret == 0) + if (ret == 0) { + if (qemuMonitorJSONHasError(reply, "CommandNotFound")) + goto cleanup; + ret = qemuMonitorJSONCheckError(cmd, reply); + } if (ret < 0) goto cleanup;

On Tue, Apr 16, 2013 at 06:37:07AM -0400, Stefan Berger wrote:
Properly suppress log messages when using unsupported TPM QMP commands.
ACK to both. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Stefan Berger