[libvirt] [PATCH 1/8] virQEMUCapsParseHelpStr: remove unused check_yajl parameter

Ján Tomko jtomko at redhat.com
Thu Mar 29 00:50:18 UTC 2018


Commit 6e769eba in Jan 2012 added an error message when using qemu 0.15
and newer with libvirt without JSON support.

However commit 3399875 (July 2012) added the 'check_yajl' parameter
to perform this check only on domain startup and commit 15ee6614
in Sep 2012 removed this last caller passing 'true' to this function.

Remove the dead code.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/qemu/qemu_capabilities.c | 24 ++++--------------------
 src/qemu/qemu_capspriv.h     |  1 -
 tests/qemuhelptest.c         |  2 +-
 3 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e54dde69a..73527820a 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1257,8 +1257,7 @@ virQEMUCapsInit(virFileCachePtr cache)
 static int
 virQEMUCapsComputeCmdFlags(const char *help,
                            unsigned int version,
-                           virQEMUCapsPtr qemuCaps,
-                           bool check_yajl ATTRIBUTE_UNUSED)
+                           virQEMUCapsPtr qemuCaps)
 {
     const char *p;
     const char *fsdev, *netdev;
@@ -1391,21 +1390,9 @@ virQEMUCapsComputeCmdFlags(const char *help,
 #else
     /* Starting with qemu 0.15 and newer, upstream qemu no longer
      * promises to keep the human interface stable, but requests that
-     * we use QMP (the JSON interface) for everything.  If the user
-     * forgot to include YAJL libraries when building their own
-     * libvirt but is targeting a newer qemu, we are better off
-     * telling them to recompile (the spec file includes the
-     * dependency, so distros won't hit this).  This check is
-     * also in m4/virt-yajl.m4 (see $with_yajl).  */
-    if (version >= 15000) {
-        if (check_yajl) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("this qemu binary requires libvirt to be "
-                             "compiled with yajl"));
-            return -1;
-        }
+     * we use QMP (the JSON interface) for everything. */
+    if (version >= 15000)
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV);
-    }
 #endif
 
     if (version >= 13000)
@@ -1449,7 +1436,6 @@ int virQEMUCapsParseHelpStr(const char *qemu,
                             unsigned int *version,
                             bool *is_kvm,
                             unsigned int *kvm_version,
-                            bool check_yajl,
                             const char *qmperr)
 {
     unsigned major, minor, micro;
@@ -1530,8 +1516,7 @@ int virQEMUCapsParseHelpStr(const char *qemu,
         goto cleanup;
     }
 
-    if (virQEMUCapsComputeCmdFlags(help, *version,
-                                   qemuCaps, check_yajl) < 0)
+    if (virQEMUCapsComputeCmdFlags(help, *version, qemuCaps) < 0)
         goto cleanup;
 
     strflags = virBitmapToString(qemuCaps->flags, true, false);
@@ -4432,7 +4417,6 @@ virQEMUCapsInitHelp(virQEMUCapsPtr qemuCaps, uid_t runUid, gid_t runGid, const c
                                 &qemuCaps->version,
                                 &is_kvm,
                                 &qemuCaps->kvmVersion,
-                                false,
                                 qmperr) < 0)
         goto cleanup;
 
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
index 222f3368e..979816240 100644
--- a/src/qemu/qemu_capspriv.h
+++ b/src/qemu/qemu_capspriv.h
@@ -93,7 +93,6 @@ virQEMUCapsParseHelpStr(const char *qemu,
                         unsigned int *version,
                         bool *is_kvm,
                         unsigned int *kvm_version,
-                        bool check_yajl,
                         const char *qmperr);
 
 int
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 1336eeef5..84f18c039 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -59,7 +59,7 @@ static int testHelpStrParsing(const void *data)
         goto cleanup;
 
     if (virQEMUCapsParseHelpStr("QEMU", help, flags,
-                                &version, &is_kvm, &kvm_version, false, NULL) == -1) {
+                                &version, &is_kvm, &kvm_version, NULL) == -1) {
         virErrorPtr err = virGetLastError();
 
         if (info->error && err && err->code == info->error)
-- 
2.16.1




More information about the libvir-list mailing list