[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 05/11] monitor/hmp: move hmp_drive_mirror and hmp_drive_ba
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [PATCH v5 05/11] monitor/hmp: move hmp_drive_mirror and hmp_drive_backup to block-hmp-cmds.c Moved code was added after 2012-01-13, thus under GPLv2+ |
Date: |
Mon, 9 Mar 2020 16:31:13 +0000 |
User-agent: |
Mutt/1.13.3 (2020-01-12) |
* Maxim Levitsky (address@hidden) wrote:
>
> I see that I have the same issue of long subject line here.
> Its because I forgot the space after first line, when adding this.
> If I need to resend another version of this patchset I'll fix this,
> but otherwise maybe that can be fixed when applying this to one of
> maintainer's
> trees.
>
> Sorry for noise.
I can just fix the commit message.
Dave
> Best regards,
> Maxim Levitsky
>
> On Sun, 2020-03-08 at 11:24 +0200, Maxim Levitsky wrote:
> > Signed-off-by: Maxim Levitsky <address@hidden>
> > Reviewed-by: Dr. David Alan Gilbert <address@hidden>
> > ---
> > block/monitor/block-hmp-cmds.c | 60 ++++++++++++++++++++++++++++++++++
> > include/block/block-hmp-cmds.h | 12 +++++--
> > include/monitor/hmp.h | 2 --
> > monitor/hmp-cmds.c | 58 --------------------------------
> > 4 files changed, 69 insertions(+), 63 deletions(-)
> >
> > diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
> > index ad727a6b08..d6dd5d97f7 100644
> > --- a/block/monitor/block-hmp-cmds.c
> > +++ b/block/monitor/block-hmp-cmds.c
> > @@ -37,10 +37,12 @@
> > #include "qapi/qapi-commands-block.h"
> > #include "qapi/qmp/qdict.h"
> > #include "qapi/error.h"
> > +#include "qapi/qmp/qerror.h"
> > #include "qemu/config-file.h"
> > #include "qemu/option.h"
> > #include "sysemu/sysemu.h"
> > #include "monitor/monitor.h"
> > +#include "monitor/hmp.h"
> > #include "block/block_int.h"
> > #include "block/block-hmp-cmds.h"
> >
> > @@ -187,3 +189,61 @@ void hmp_commit(Monitor *mon, const QDict *qdict)
> > error_report("'commit' error for '%s': %s", device,
> > strerror(-ret));
> > }
> > }
> > +
> > +void hmp_drive_mirror(Monitor *mon, const QDict *qdict)
> > +{
> > + const char *filename = qdict_get_str(qdict, "target");
> > + const char *format = qdict_get_try_str(qdict, "format");
> > + bool reuse = qdict_get_try_bool(qdict, "reuse", false);
> > + bool full = qdict_get_try_bool(qdict, "full", false);
> > + Error *err = NULL;
> > + DriveMirror mirror = {
> > + .device = (char *)qdict_get_str(qdict, "device"),
> > + .target = (char *)filename,
> > + .has_format = !!format,
> > + .format = (char *)format,
> > + .sync = full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,
> > + .has_mode = true,
> > + .mode = reuse ? NEW_IMAGE_MODE_EXISTING :
> > NEW_IMAGE_MODE_ABSOLUTE_PATHS,
> > + .unmap = true,
> > + };
> > +
> > + if (!filename) {
> > + error_setg(&err, QERR_MISSING_PARAMETER, "target");
> > + hmp_handle_error(mon, err);
> > + return;
> > + }
> > + qmp_drive_mirror(&mirror, &err);
> > + hmp_handle_error(mon, err);
> > +}
> > +
> > +void hmp_drive_backup(Monitor *mon, const QDict *qdict)
> > +{
> > + const char *device = qdict_get_str(qdict, "device");
> > + const char *filename = qdict_get_str(qdict, "target");
> > + const char *format = qdict_get_try_str(qdict, "format");
> > + bool reuse = qdict_get_try_bool(qdict, "reuse", false);
> > + bool full = qdict_get_try_bool(qdict, "full", false);
> > + bool compress = qdict_get_try_bool(qdict, "compress", false);
> > + Error *err = NULL;
> > + DriveBackup backup = {
> > + .device = (char *)device,
> > + .target = (char *)filename,
> > + .has_format = !!format,
> > + .format = (char *)format,
> > + .sync = full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,
> > + .has_mode = true,
> > + .mode = reuse ? NEW_IMAGE_MODE_EXISTING :
> > NEW_IMAGE_MODE_ABSOLUTE_PATHS,
> > + .has_compress = !!compress,
> > + .compress = compress,
> > + };
> > +
> > + if (!filename) {
> > + error_setg(&err, QERR_MISSING_PARAMETER, "target");
> > + hmp_handle_error(mon, err);
> > + return;
> > + }
> > +
> > + qmp_drive_backup(&backup, &err);
> > + hmp_handle_error(mon, err);
> > +}
> > diff --git a/include/block/block-hmp-cmds.h b/include/block/block-hmp-cmds.h
> > index 30b0f56415..a64b737b3a 100644
> > --- a/include/block/block-hmp-cmds.h
> > +++ b/include/block/block-hmp-cmds.h
> > @@ -3,10 +3,13 @@
> > *
> > * Copyright (c) 2003-2008 Fabrice Bellard
> > * Copyright (c) 2020 Red Hat, Inc.
> > + * Copyright IBM, Corp. 2011
> > *
> > - * This work is licensed under the terms of the GNU GPL, version 2.
> > - * or (at your option) any later version.
> > - * See the COPYING file in the top-level directory.
> > + * Authors:
> > + * Anthony Liguori <address@hidden>
> > + *
> > + * This work is licensed under the terms of the GNU GPL, version 2. See
> > + * the COPYING file in the top-level directory.
> > */
> >
> > #ifndef BLOCK_HMP_COMMANDS_H
> > @@ -17,4 +20,7 @@ void hmp_drive_add(Monitor *mon, const QDict *qdict);
> > void hmp_commit(Monitor *mon, const QDict *qdict);
> > void hmp_drive_del(Monitor *mon, const QDict *qdict);
> >
> > +void hmp_drive_mirror(Monitor *mon, const QDict *qdict);
> > +void hmp_drive_backup(Monitor *mon, const QDict *qdict);
> > +
> > #endif
> > diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> > index 3d329853b2..c1b363ee57 100644
> > --- a/include/monitor/hmp.h
> > +++ b/include/monitor/hmp.h
> > @@ -64,8 +64,6 @@ void hmp_block_resize(Monitor *mon, const QDict *qdict);
> > void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict);
> > void hmp_snapshot_blkdev_internal(Monitor *mon, const QDict *qdict);
> > void hmp_snapshot_delete_blkdev_internal(Monitor *mon, const QDict *qdict);
> > -void hmp_drive_mirror(Monitor *mon, const QDict *qdict);
> > -void hmp_drive_backup(Monitor *mon, const QDict *qdict);
> > void hmp_loadvm(Monitor *mon, const QDict *qdict);
> > void hmp_savevm(Monitor *mon, const QDict *qdict);
> > void hmp_delvm(Monitor *mon, const QDict *qdict);
> > diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> > index fb4c2fd2a8..06f0cb4bb9 100644
> > --- a/monitor/hmp-cmds.c
> > +++ b/monitor/hmp-cmds.c
> > @@ -1342,64 +1342,6 @@ void hmp_block_resize(Monitor *mon, const QDict
> > *qdict)
> > hmp_handle_error(mon, err);
> > }
> >
> > -void hmp_drive_mirror(Monitor *mon, const QDict *qdict)
> > -{
> > - const char *filename = qdict_get_str(qdict, "target");
> > - const char *format = qdict_get_try_str(qdict, "format");
> > - bool reuse = qdict_get_try_bool(qdict, "reuse", false);
> > - bool full = qdict_get_try_bool(qdict, "full", false);
> > - Error *err = NULL;
> > - DriveMirror mirror = {
> > - .device = (char *)qdict_get_str(qdict, "device"),
> > - .target = (char *)filename,
> > - .has_format = !!format,
> > - .format = (char *)format,
> > - .sync = full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,
> > - .has_mode = true,
> > - .mode = reuse ? NEW_IMAGE_MODE_EXISTING :
> > NEW_IMAGE_MODE_ABSOLUTE_PATHS,
> > - .unmap = true,
> > - };
> > -
> > - if (!filename) {
> > - error_setg(&err, QERR_MISSING_PARAMETER, "target");
> > - hmp_handle_error(mon, err);
> > - return;
> > - }
> > - qmp_drive_mirror(&mirror, &err);
> > - hmp_handle_error(mon, err);
> > -}
> > -
> > -void hmp_drive_backup(Monitor *mon, const QDict *qdict)
> > -{
> > - const char *device = qdict_get_str(qdict, "device");
> > - const char *filename = qdict_get_str(qdict, "target");
> > - const char *format = qdict_get_try_str(qdict, "format");
> > - bool reuse = qdict_get_try_bool(qdict, "reuse", false);
> > - bool full = qdict_get_try_bool(qdict, "full", false);
> > - bool compress = qdict_get_try_bool(qdict, "compress", false);
> > - Error *err = NULL;
> > - DriveBackup backup = {
> > - .device = (char *)device,
> > - .target = (char *)filename,
> > - .has_format = !!format,
> > - .format = (char *)format,
> > - .sync = full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,
> > - .has_mode = true,
> > - .mode = reuse ? NEW_IMAGE_MODE_EXISTING :
> > NEW_IMAGE_MODE_ABSOLUTE_PATHS,
> > - .has_compress = !!compress,
> > - .compress = compress,
> > - };
> > -
> > - if (!filename) {
> > - error_setg(&err, QERR_MISSING_PARAMETER, "target");
> > - hmp_handle_error(mon, err);
> > - return;
> > - }
> > -
> > - qmp_drive_backup(&backup, &err);
> > - hmp_handle_error(mon, err);
> > -}
> > -
> > void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
> > {
> > const char *device = qdict_get_str(qdict, "device");
>
>
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK
- [PATCH v5 00/11] HMP monitor handlers refactoring, Maxim Levitsky, 2020/03/08
- [PATCH v5 01/11] usb/dev-storage: remove unused include, Maxim Levitsky, 2020/03/08
- [PATCH v5 02/11] monitor/hmp: inline add_init_drive, Maxim Levitsky, 2020/03/08
- [PATCH v5 03/11] monitor/hmp: rename device-hotplug.c to block/monitor/block-hmp-cmds.c, Maxim Levitsky, 2020/03/08
- [PATCH v5 04/11] monitor/hmp: move hmp_drive_del and hmp_commit to block-hmp-cmds.c, Maxim Levitsky, 2020/03/08
- [PATCH v5 05/11] monitor/hmp: move hmp_drive_mirror and hmp_drive_backup to block-hmp-cmds.c Moved code was added after 2012-01-13, thus under GPLv2+, Maxim Levitsky, 2020/03/08
- [PATCH v5 06/11] monitor/hmp: move hmp_block_job* to block-hmp-cmds.c, Maxim Levitsky, 2020/03/08
- [PATCH v5 07/11] monitor/hmp: move hmp_snapshot_* to block-hmp-cmds.c, Maxim Levitsky, 2020/03/08
- [PATCH v5 08/11] monitor/hmp: move hmp_nbd_server* to block-hmp-cmds.c, Maxim Levitsky, 2020/03/08
- [PATCH v5 09/11] monitor/hmp: move remaining hmp_block* functions to block-hmp-cmds.c, Maxim Levitsky, 2020/03/08
- [PATCH v5 11/11] monitor/hmp: Move hmp_drive_add_node to block-hmp-cmds.c, Maxim Levitsky, 2020/03/08
- [PATCH v5 10/11] monitor/hmp: move hmp_info_block* to block-hmp-cmds.c, Maxim Levitsky, 2020/03/08
- Re: [PATCH v5 00/11] HMP monitor handlers refactoring, Dr. David Alan Gilbert, 2020/03/09