qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org, lvivier@redhat.com, peterx@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 08/10] migration: Create include for migration snapshots
Date: Thu, 1 Jun 2017 13:43:37 +0100	[thread overview]
Message-ID: <20170601124337.GP2083@work-vm> (raw)
In-Reply-To: <20170531103509.22021-9-quintela@redhat.com>

* Juan Quintela (quintela@redhat.com) wrote:
> Start removing migration code from sysemu/sysemu.h.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Yes, the names always confused me.


Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  hmp.c                        |  5 +++--
>  include/block/block_int.h    |  4 ++--
>  include/migration/snapshot.h | 21 +++++++++++++++++++++
>  include/sysemu/sysemu.h      |  3 ---
>  migration/savevm.c           |  5 +++--
>  replay/replay-snapshot.c     |  5 +++--
>  vl.c                         |  3 ++-
>  7 files changed, 34 insertions(+), 12 deletions(-)
>  create mode 100644 include/migration/snapshot.h
> 
> diff --git a/hmp.c b/hmp.c
> index 20f5dab..ad72390 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -42,6 +42,7 @@
>  #include "qemu/error-report.h"
>  #include "exec/ramlist.h"
>  #include "hw/intc/intc.h"
> +#include "migration/snapshot.h"
>  
>  #ifdef CONFIG_SPICE
>  #include <spice/enums.h>
> @@ -1284,7 +1285,7 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict)
>  
>      vm_stop(RUN_STATE_RESTORE_VM);
>  
> -    if (load_vmstate(name, &err) == 0 && saved_vm_running) {
> +    if (load_snapshot(name, &err) == 0 && saved_vm_running) {
>          vm_start();
>      }
>      hmp_handle_error(mon, &err);
> @@ -1294,7 +1295,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
>  {
>      Error *err = NULL;
>  
> -    save_vmstate(qdict_get_try_str(qdict, "name"), &err);
> +    save_snapshot(qdict_get_try_str(qdict, "name"), &err);
>      hmp_handle_error(mon, &err);
>  }
>  
> diff --git a/include/block/block_int.h b/include/block/block_int.h
> index e5eb473..cb78c4f 100644
> --- a/include/block/block_int.h
> +++ b/include/block/block_int.h
> @@ -601,8 +601,8 @@ struct BlockDriverState {
>      int copy_on_read;
>  
>      /* If we are reading a disk image, give its size in sectors.
> -     * Generally read-only; it is written to by load_vmstate and save_vmstate,
> -     * but the block layer is quiescent during those.
> +     * Generally read-only; it is written to by load_snapshot and
> +     * save_snaphost, but the block layer is quiescent during those.
>       */
>      int64_t total_sectors;
>  
> diff --git a/include/migration/snapshot.h b/include/migration/snapshot.h
> new file mode 100644
> index 0000000..c85b6ec
> --- /dev/null
> +++ b/include/migration/snapshot.h
> @@ -0,0 +1,21 @@
> +/*
> + * QEMU snapshots
> + *
> + * Copyright (c) 2004-2008 Fabrice Bellard
> + * Copyright (c) 2009-2015 Red Hat Inc
> + *
> + * Authors:
> + *  Juan Quintela <quintela@redhat.com>
> + *
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_MIGRATION_SNAPSHOT_H
> +#define QEMU_MIGRATION_SNAPSHOT_H
> +
> +int save_snapshot(const char *name, Error **errp);
> +int load_snapshot(const char *name, Error **errp);
> +
> +#endif
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 723c8dc..9841a52 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -92,9 +92,6 @@ void qemu_remove_exit_notifier(Notifier *notify);
>  void qemu_add_machine_init_done_notifier(Notifier *notify);
>  void qemu_remove_machine_init_done_notifier(Notifier *notify);
>  
> -int save_vmstate(const char *name, Error **errp);
> -int load_vmstate(const char *name, Error **errp);
> -
>  void qemu_announce_self(void);
>  
>  extern int autostart;
> diff --git a/migration/savevm.c b/migration/savevm.c
> index bb3f9ec..f2664f3 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -35,6 +35,7 @@
>  #include "sysemu/sysemu.h"
>  #include "qemu/timer.h"
>  #include "migration/migration.h"
> +#include "migration/snapshot.h"
>  #include "qemu-file-channel.h"
>  #include "qemu-file.h"
>  #include "savevm.h"
> @@ -2067,7 +2068,7 @@ int qemu_loadvm_state(QEMUFile *f)
>      return ret;
>  }
>  
> -int save_vmstate(const char *name, Error **errp)
> +int save_snapshot(const char *name, Error **errp)
>  {
>      BlockDriverState *bs, *bs1;
>      QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
> @@ -2224,7 +2225,7 @@ void qmp_xen_load_devices_state(const char *filename, Error **errp)
>      migration_incoming_state_destroy();
>  }
>  
> -int load_vmstate(const char *name, Error **errp)
> +int load_snapshot(const char *name, Error **errp)
>  {
>      BlockDriverState *bs, *bs_vm_state;
>      QEMUSnapshotInfo sn;
> diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
> index c75cd38..a4ded29 100644
> --- a/replay/replay-snapshot.c
> +++ b/replay/replay-snapshot.c
> @@ -19,6 +19,7 @@
>  #include "qapi/qmp/qstring.h"
>  #include "qemu/error-report.h"
>  #include "migration/vmstate.h"
> +#include "migration/snapshot.h"
>  
>  static void replay_pre_save(void *opaque)
>  {
> @@ -66,13 +67,13 @@ void replay_vmstate_init(void)
>  
>      if (replay_snapshot) {
>          if (replay_mode == REPLAY_MODE_RECORD) {
> -            if (save_vmstate(replay_snapshot, &err) != 0) {
> +            if (save_snapshot(replay_snapshot, &err) != 0) {
>                  error_report_err(err);
>                  error_report("Could not create snapshot for icount record");
>                  exit(1);
>              }
>          } else if (replay_mode == REPLAY_MODE_PLAY) {
> -            if (load_vmstate(replay_snapshot, &err) != 0) {
> +            if (load_snapshot(replay_snapshot, &err) != 0) {
>                  error_report_err(err);
>                  error_report("Could not load snapshot for icount replay");
>                  exit(1);
> diff --git a/vl.c b/vl.c
> index 993690d..86f6c71 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -87,6 +87,7 @@ int main(int argc, char **argv)
>  #include "sysemu/blockdev.h"
>  #include "hw/block/block.h"
>  #include "migration/block.h"
> +#include "migration/snapshot.h"
>  #include "sysemu/tpm.h"
>  #include "sysemu/dma.h"
>  #include "hw/audio/soundhw.h"
> @@ -4722,7 +4723,7 @@ int main(int argc, char **argv, char **envp)
>          replay_vmstate_init();
>      } else if (loadvm) {
>          Error *local_err = NULL;
> -        if (load_vmstate(loadvm, &local_err) < 0) {
> +        if (load_snapshot(loadvm, &local_err) < 0) {
>              error_report_err(local_err);
>              autostart = 0;
>          }
> -- 
> 2.9.4
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2017-06-01 12:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 10:34 [Qemu-devel] [PATCH v2 00/10] Another cleanup of includes Juan Quintela
2017-05-31 10:35 ` [Qemu-devel] [PATCH v2 01/10] migration: Remove unneeded includes of migration/vmstate.h Juan Quintela
2017-06-01 12:00   ` Dr. David Alan Gilbert
2017-06-01 12:03   ` Dr. David Alan Gilbert
2017-05-31 10:35 ` [Qemu-devel] [PATCH v2 02/10] migration: Split qemu-file.h Juan Quintela
2017-06-01 12:21   ` Dr. David Alan Gilbert
2017-06-01 15:19     ` Juan Quintela
2017-05-31 10:35 ` [Qemu-devel] [PATCH v2 03/10] migration: Export exec.c functions in its own file Juan Quintela
2017-06-01 12:28   ` Dr. David Alan Gilbert
2017-05-31 10:35 ` [Qemu-devel] [PATCH v2 04/10] migration: Export fd.c " Juan Quintela
2017-06-01 12:29   ` Dr. David Alan Gilbert
2017-05-31 10:35 ` [Qemu-devel] [PATCH v2 05/10] migration: Export socket.c " Juan Quintela
2017-06-01 12:37   ` Dr. David Alan Gilbert
2017-05-31 10:35 ` [Qemu-devel] [PATCH v2 06/10] migration: Export tls.c " Juan Quintela
2017-06-01 12:41   ` Dr. David Alan Gilbert
2017-06-01 15:20     ` Juan Quintela
2017-06-01 15:56       ` Dr. David Alan Gilbert
2017-05-31 10:35 ` [Qemu-devel] [PATCH v2 07/10] migration: Export rdma.c " Juan Quintela
2017-06-01 12:46   ` Dr. David Alan Gilbert
2017-06-01 15:22     ` Juan Quintela
2017-06-01 15:51       ` Dr. David Alan Gilbert
2017-05-31 10:35 ` [Qemu-devel] [PATCH v2 08/10] migration: Create include for migration snapshots Juan Quintela
2017-06-01 12:43   ` Dr. David Alan Gilbert [this message]
2017-05-31 10:35 ` [Qemu-devel] [PATCH v2 09/10] migration: Export ram.c functions in its own file Juan Quintela
2017-05-31 10:35 ` [Qemu-devel] [PATCH v2 10/10] migration: Move include/migration/block.h into migration/ Juan Quintela
2017-06-01 12:44   ` Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170601124337.GP2083@work-vm \
    --to=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).