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

Re: [libvirt] [PATCH] qemu: Only issue the rtc-reset-reinjection QMP command on x86.



On Mon, May 25, 2015 at 16:59:08 +0200, Andrea Bolognani wrote:
> The command is only defined in QEMU for TARGET_I386, so issuing it on
> any other architecture can't possibly work.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211938
> ---
>  src/qemu/qemu_driver.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index aa0acde..743ca6e 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -18945,7 +18945,10 @@ qemuDomainSetTime(virDomainPtr dom,
>          goto endjob;
>      }
>  
> -    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION)) {
> +    /* The rtc-reset-reinjection QMP command is only available on x86 */

Since we properly track support for this command via the capabilities
and qemu does not expose it:

> +    if (ARCH_IS_X86(vm->def->os.arch) &&
> +        !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION))
> +    {
>          virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
>                         _("cannot set time: qemu doesn't support "
>                           "rtc-reset-reinjection command"));

I'd simply remove this error message since it is semantically wrong once
PPC does not require to reset the RTC reinjection.

> @@ -18968,13 +18971,16 @@ qemuDomainSetTime(virDomainPtr dom,
>          goto endjob;
>      }
>  
> -    qemuDomainObjEnterMonitor(driver, vm);
> -    rv = qemuMonitorRTCResetReinjection(priv->mon);
> -    if (qemuDomainObjExitMonitor(driver, vm) < 0)
> -        goto endjob;
> +    /* The rtc-reset-reinjection QMP command is only available on x86 */
> +    if (ARCH_IS_X86(vm->def->os.arch)) {
> +        qemuDomainObjEnterMonitor(driver, vm);
> +        rv = qemuMonitorRTCResetReinjection(priv->mon);

And just conditionally call this when the
QEMU_CAPS_RTC_RESET_REINJECTION is present and not in an architecture
specific way.

By this you get rid of the arch specific hackery.

> +        if (qemuDomainObjExitMonitor(driver, vm) < 0)
> +            goto endjob;
>  
> -    if (rv < 0)
> -        goto endjob;
> +        if (rv < 0)
> +            goto endjob;
> +    }
>  
>      ret = 0;
>  

Peter

Attachment: signature.asc
Description: Digital signature


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