[libvirt] [PATCH v2.1 05/11] qemu: Introduce nbd-server-stop command

Jiri Denemark jdenemar at redhat.com
Thu Jan 17 23:13:37 UTC 2013


On Fri, Jan 11, 2013 at 17:52:17 +0100, Michal Privoznik wrote:
> This will be used after all migration work is done
> to stop NBD server running on destination.  It
> doesn't take any arguments, just issues a command.
> ---
>  src/qemu/qemu_monitor.c      | 19 +++++++++++++++++++
>  src/qemu/qemu_monitor.h      |  1 +
>  src/qemu/qemu_monitor_json.c | 21 +++++++++++++++++++++
>  src/qemu/qemu_monitor_json.h |  1 +
>  4 files changed, 42 insertions(+)
> 
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index 1bc6434..04cb6a1 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -3374,3 +3374,22 @@ int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
>  
>      return qemuMonitorJSONNBDServerAdd(mon, deviceID, writable);
>  }
> +
> +int qemuMonitorNBDServerStop(qemuMonitorPtr mon)
> +{
> +    VIR_DEBUG("mon=%p", mon);
> +
> +    if (!mon) {
> +        virReportError(VIR_ERR_INVALID_ARG, "%s",
> +                       _("monitor must not be NULL"));
> +        return -1;
> +    }
> +
> +    if (!mon->json) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",

VIR_ERR_OPERATION_UNSUPPORTED

> +                       _("JSON monitor is required"));
> +        return -1;
> +    }
> +
> +    return qemuMonitorJSONNBDServerStop(mon);
> +}
...

ACK with the right error code.

Jirka




More information about the libvir-list mailing list