Re: [PATCH] qemu: simplify use of HAVE_YAJL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 10/21/2011 04:39 AM, Eric Blake Write:
> Rather than making all clients of monitor commands that are JSON-only
> check whether yajl support was compiled in, it is simpler to just
> avoid setting the capability bit up front if we can't use the capability.
> 
> * src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags): Only set
> capability bit if we also have yajl library to use it.
> * src/qemu/qemu_driver.c (qemuDomainReboot): Drop #ifdefs.
> * src/qemu/qemu_process.c (qemuProcessStart): Likewise.
> ---
> 
> As mentioned here:
> https://www.redhat.com/archives/libvir-list/2011-October/msg01004.html
> 
>  src/qemu/qemu_capabilities.c |    2 ++
>  src/qemu/qemu_driver.c       |    6 ------
>  src/qemu/qemu_process.c      |    2 --
>  3 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 5f0356c..b4ab55b 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -1060,8 +1060,10 @@ qemuCapsComputeCmdFlags(const char *help,
>       * two features. The benefits of JSON mode now outweigh
>       * the downside.
>       */
> +#if HAVE_YAJL
>       if (version >= 13000)
>          qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
> +#endif
> 
>      if (version >= 13000)
>          qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIFUNCTION);
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 0a0a34a..55a9652 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -1538,9 +1538,7 @@ static int qemuDomainReboot(virDomainPtr dom, unsigned int flags) {
>      struct qemud_driver *driver = dom->conn->privateData;
>      virDomainObjPtr vm;
>      int ret = -1;
> -#if HAVE_YAJL
>      qemuDomainObjPrivatePtr priv;
> -#endif
> 
>      virCheckFlags(0, -1);
> 
> @@ -1556,7 +1554,6 @@ static int qemuDomainReboot(virDomainPtr dom, unsigned int flags) {
>          goto cleanup;
>      }
> 
> -#if HAVE_YAJL
>      priv = vm->privateData;
> 
>      if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
> @@ -1586,12 +1583,9 @@ static int qemuDomainReboot(virDomainPtr dom, unsigned int flags) {
>          if (qemuDomainObjEndJob(driver, vm) == 0)
>              vm = NULL;
>      } else {
> -#endif
>          qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
>                          _("Reboot is not supported without the JSON monitor"));
> -#if HAVE_YAJL
>      }
> -#endif
> 
>  cleanup:
>      if (vm)
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index a7fe86c..cc2395f 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -2962,11 +2962,9 @@ int qemuProcessStart(virConnectPtr conn,
>      if (qemuProcessPrepareMonitorChr(driver, priv->monConfig, vm->def->name) < 0)
>          goto cleanup;
> 
> -#if HAVE_YAJL
>      if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON))
>          priv->monJSON = 1;
>      else
> -#endif
>          priv->monJSON = 0;
> 
>      priv->monError = false;

ACK

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]