[libvirt] [PATCH 1/2] qemu: Introduce qemuMonitorGetRTCTime

Peter Krempa pkrempa at redhat.com
Mon May 2 14:41:18 UTC 2016


On Fri, Apr 29, 2016 at 18:43:09 +0200, Michal Privoznik wrote:
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_monitor.c      | 11 +++++++++++
>  src/qemu/qemu_monitor.h      |  3 +++
>  src/qemu/qemu_monitor_json.c | 45 ++++++++++++++++++++++++++++++++++++++++++++
>  src/qemu/qemu_monitor_json.h |  3 +++
>  4 files changed, 62 insertions(+)

[...]

> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index 7bb9976..6f12ee1 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -6984,3 +6984,48 @@ qemuMonitorJSONMigrateStartPostCopy(qemuMonitorPtr mon)
>      virJSONValueFree(reply);
>      return ret;
>  }
> +
> +int
> +qemuMonitorJSONGetRTCTime(qemuMonitorPtr mon,
> +                          struct tm *tm)
> +{
> +    int ret = -1;
> +    virJSONValuePtr cmd;
> +    virJSONValuePtr reply = NULL;
> +    virJSONValuePtr data;
> +
> +    if (!(cmd = qemuMonitorJSONMakeCommand("qom-get",
> +                                           "s:path", "/machine",
> +                                           "s:property", "rtc-time",
> +                                           NULL)))
> +        return -1;
> +
> +    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
> +        goto cleanup;
> +
> +    if (qemuMonitorJSONCheckError(cmd, reply) < 0)
> +        goto cleanup;
> +
> +    if (!(data = virJSONValueObjectGet(reply, "return"))) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                       _("qom-get reply was missing return data"));

Presence of the "return" object is guaranteed by
qemuMonitorJSONCheckError at this point so this is dead code.

> +        goto cleanup;
> +    }
> +

ACK without the check.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160502/df7c79d5/attachment-0001.sig>


More information about the libvir-list mailing list