Re: [PATCHv2 08/15] blockjob: expose qemu commands for mirrored storage migration

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

 



----- Original Message -----
> From: "Eric Blake" <eblake@xxxxxxxxxx>
> To: libvir-list@xxxxxxxxxx
> Cc: pbonzini@xxxxxxxxxx, fsimonce@xxxxxxxxxx
> Sent: Friday, April 6, 2012 6:36:54 AM
> Subject: [PATCHv2 08/15] blockjob: expose qemu commands for mirrored storage migration
> 
> The new block copy storage migration sequence requires both the
> 'drive-mirror' action in 'transaction' (present if the 'drive-mirror'
> standalone monitor command also exists) and the 'drive-reopen'
> monitor
> command (it would be nice if that were also part of a 'transaction',
> but the initial qemu implementation has it standalone only).
> 
> As of this[1] qemu email, both commands have been proposed but not
> yet
> incorporated into the tree, so there is a risk that qemu 1.1 will
> not have these commands, or will have something subtly different.
> [1]https://lists.gnu.org/archive/html/qemu-devel/2012-03/msg01524.html
> 
> * src/qemu/qemu_capabilities.h (QEMU_CAPS_DRIVE_MIRROR)
> (QEMU_CAPS_DRIVE_REOPEN): New bits.
> * src/qemu/qemu_capabilities.c (qemuCaps): Name them.
> * src/qemu/qemu_monitor_json.c (qemuMonitorJSONCheckCommands): Set
> them.
> (qemuMonitorJSONDriveMirror, qemuMonitorDriveReopen): New functions.
> * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDriveMirror)
> (qemuMonitorDriveReopen): Declare them.
> * src/qemu/qemu_monitor.c (qemuMonitorDriveMirror)
> (qemuMonitorDriveReopen): New passthroughs.
> * src/qemu/qemu_monitor.h (qemuMonitorDriveMirror)
> (qemuMonitorDriveReopen): Declare them.
> ---
>  src/qemu/qemu_capabilities.c |    3 ++
>  src/qemu/qemu_capabilities.h |    2 +
>  src/qemu/qemu_monitor.c      |   50 ++++++++++++++++++++++++++++
>  src/qemu/qemu_monitor.h      |   23 +++++++++++++
>  src/qemu/qemu_monitor_json.c |   74
>  +++++++++++++++++++++++++++++++++++++++--
>  src/qemu/qemu_monitor_json.h |   21 +++++++++++-
>  6 files changed, 167 insertions(+), 6 deletions(-)
> 
[...]
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index e1a8d4c..f33bed8 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -2685,6 +2685,32 @@ qemuMonitorDiskSnapshot(qemuMonitorPtr mon,
> virJSONValuePtr actions,
>      return ret;
>  }
> 
> +/* Add the drive-mirror action to a transaction.  */
> +int
> +qemuMonitorDriveMirror(qemuMonitorPtr mon, virJSONValuePtr actions,
> +                       const char *device, const char *file,
> +                       const char *format, int mode)
> +{
> +    int ret;
> +
> +    VIR_DEBUG("mon=%p, actions=%p, device=%s, file=%s, format=%s,
> mode=%o",
> +              mon, actions, device, file, format, mode);
> +
> +    if (!mon) {
> +        qemuReportError(VIR_ERR_INVALID_ARG, "%s",
> +                        _("monitor must not be NULL"));
> +        return -1;
> +    }
> +
> +    if (mon->json)
> +        ret = qemuMonitorJSONDriveMirror(mon, actions, device, file,
> format,
> +                                         mode);
> +    else
> +        qemuReportError(VIR_ERR_INVALID_ARG, "%s",
> +                        _("drive-mirror requires JSON monitor"));

You should set ret to -1 here (or return -1).

> +    return ret;
> +}
> +
>  /* Use the transaction QMP command to run atomic snapshot commands.
>   */
>  int
>  qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
> @@ -2701,6 +2727,30 @@ qemuMonitorTransaction(qemuMonitorPtr mon,
> virJSONValuePtr actions)
>      return ret;
>  }
> 
> +/* Use the drive-reopen monitor command.  */
> +int
> +qemuMonitorDriveReopen(qemuMonitorPtr mon, const char *device,
> +                       const char *file, const char *format)
> +{
> +    int ret;
> +
> +    VIR_DEBUG("mon=%p, device=%s, file=%s, format=%s",
> +              mon, device, file, format);
> +
> +    if (!mon) {
> +        qemuReportError(VIR_ERR_INVALID_ARG, "%s",
> +                        _("monitor must not be NULL"));
> +        return -1;
> +    }
> +
> +    if (mon->json)
> +        ret = qemuMonitorJSONDriveReopen(mon, device, file, format);
> +    else
> +        qemuReportError(VIR_ERR_INVALID_ARG, "%s",
> +                        _("drive-reopen requires JSON monitor"));

You should set ret to -1 here (or return -1).

> +    return ret;
> +}
> +
>  int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
>                                  const char *cmd,
>                                  char **reply,

-- 
Federico

--
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]