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

Re: [libvirt] [PATCH v2.1 04/11] qemu: Introduce nbd-server-add command



reviewed-by: liguang <lig fnst cn fujitsu com>

在 2012-12-18二的 15:36 +0100,Michal Privoznik写道:
> This will be used with new migration scheme.
> This patch creates basically just monitor stub
> functions. Wiring them into something useful
> is done in later patches.
> ---
>  src/qemu/qemu_monitor.c      | 22 ++++++++++++++++++++++
>  src/qemu/qemu_monitor.h      |  3 +++
>  src/qemu/qemu_monitor_json.c | 25 +++++++++++++++++++++++++
>  src/qemu/qemu_monitor_json.h |  3 +++
>  4 files changed, 53 insertions(+)
> 
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index eab833f..0c848ee 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -3342,3 +3342,25 @@ int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
>  
>      return qemuMonitorJSONNBDServerStart(mon, host, port);
>  }
> +
> +int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
> +                            const char *deviceID,
> +                            bool writable)
> +{
> +    VIR_DEBUG("mon=%p deviceID=%s",
> +              mon, deviceID);
> +
> +    if (!mon) {
> +        virReportError(VIR_ERR_INVALID_ARG, "%s",
> +                       _("monitor must not be NULL"));
> +        return -1;
> +    }
> +
> +    if (!mon->json) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                       _("JSON monitor is required"));
> +        return -1;
> +    }
> +
> +    return qemuMonitorJSONNBDServerAdd(mon, deviceID, writable);
> +}
> diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
> index eb069ed..33c772f 100644
> --- a/src/qemu/qemu_monitor.h
> +++ b/src/qemu/qemu_monitor.h
> @@ -634,6 +634,9 @@ char *qemuMonitorGetTargetArch(qemuMonitorPtr mon);
>  int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
>                                const char *host,
>                                unsigned int port);
> +int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
> +                            const char *deviceID,
> +                            bool writable);
>  /**
>   * When running two dd process and using <> redirection, we need a
>   * shell that will not truncate files.  These two strings serve that
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index 545285d..1f2951f 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -4322,3 +4322,28 @@ cleanup:
>      virJSONValueFree(data);
>      return ret;
>  }
> +
> +int
> +qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon,
> +                            const char *deviceID,
> +                            bool writable)
> +{
> +    int ret = -1;
> +    virJSONValuePtr cmd;
> +    virJSONValuePtr reply = NULL;
> +
> +    if (!(cmd = qemuMonitorJSONMakeCommand("nbd-server-add",
> +                                           "s:device", deviceID,
> +                                           "b:writable", writable,
> +                                           NULL)))
> +        return ret;
> +
> +    ret = qemuMonitorJSONCommand(mon, cmd, &reply);
> +
> +    if (ret == 0)
> +        ret = qemuMonitorJSONCheckError(cmd, reply);
> +
> +    virJSONValueFree(cmd);
> +    virJSONValueFree(reply);
> +    return ret;
> +}
> diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
> index 0e43e39..14bd59f 100644
> --- a/src/qemu/qemu_monitor_json.h
> +++ b/src/qemu/qemu_monitor_json.h
> @@ -327,4 +327,7 @@ char *qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon);
>  int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon,
>                                    const char *host,
>                                    unsigned int port);
> +int qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon,
> +                                const char *deviceID,
> +                                bool writable);
>  #endif /* QEMU_MONITOR_JSON_H */

-- 
regards!
li guang



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