qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: dgilbert@redhat.com, qemu-devel@nongnu.org, jfehlig@suse.com,
	Claudio.Fontana@suse.com, dfaggioli@suse.com
Subject: Re: [PATCH v2 01/11] migration: support file: uri for source migration
Date: Tue, 18 Oct 2022 10:10:40 +0100	[thread overview]
Message-ID: <Y05tkGrthAe0Wy65@redhat.com> (raw)
In-Reply-To: <20221010133408.3214433-2-nborisov@suse.com>

On Mon, Oct 10, 2022 at 04:33:58PM +0300, Nikolay Borisov wrote:
> Implement support for a "file:" uri so that a migration can be initiated
> directly to a file from QEMU.

Can we add a reminder here

  Unlike other migration protocol backends, the 'file' protocol cannot
  honour non-blocking mode. POSIX file/block storage will always report
  ready to read/write, regardless of how slow the underlying storage
  will be at servicing the request.

  For outgoing migration this limitation is not a serious problem as
  the migration data transfer always happens in a dedicated thread.
  It may, however, result in delays in honouring a request to cancel
  the migration operation.

> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  migration/file.c      | 23 +++++++++++++++++++++++
>  migration/file.h      |  9 +++++++++
>  migration/meson.build |  1 +
>  migration/migration.c |  3 +++
>  4 files changed, 36 insertions(+)
>  create mode 100644 migration/file.c
>  create mode 100644 migration/file.h
> 
> diff --git a/migration/file.c b/migration/file.c
> new file mode 100644
> index 000000000000..02896a7cab99
> --- /dev/null
> +++ b/migration/file.c
> @@ -0,0 +1,23 @@
> +#include "qemu/osdep.h"
> +#include "channel.h"
> +#include "io/channel-file.h"
> +#include "file.h"
> +#include "qemu/error-report.h"
> +
> +
> +void file_start_outgoing_migration(MigrationState *s, const char *fname, Error **errp)
> +{
> +	QIOChannelFile *ioc;
> +
> +	ioc = qio_channel_file_new_path(fname, O_CREAT|O_TRUNC|O_WRONLY, 0660, errp);
> +	if (!ioc) {
> +		error_report("Error creating a channel");
> +		return;
> +	}
> +
> +	qio_channel_set_name(QIO_CHANNEL(ioc), "migration-file-outgoing");
> +	migration_channel_connect(s, QIO_CHANNEL(ioc), NULL, NULL);
> +	object_unref(OBJECT(ioc));
> +}
> +
> +
> diff --git a/migration/file.h b/migration/file.h
> new file mode 100644
> index 000000000000..d476eb1157f9
> --- /dev/null
> +++ b/migration/file.h
> @@ -0,0 +1,9 @@
> +#ifndef QEMU_MIGRATION_FILE_H
> +#define QEMU_MIGRATION_FILE_H
> +
> +void file_start_outgoing_migration(MigrationState *s,
> +                                   const char *filename,
> +                                   Error **errp);
> +
> +#endif
> +
> diff --git a/migration/meson.build b/migration/meson.build
> index 690487cf1a81..30a8392701c3 100644
> --- a/migration/meson.build
> +++ b/migration/meson.build
> @@ -17,6 +17,7 @@ softmmu_ss.add(files(
>    'colo.c',
>    'exec.c',
>    'fd.c',
> +  'file.c',
>    'global_state.c',
>    'migration.c',
>    'multifd.c',
> diff --git a/migration/migration.c b/migration/migration.c
> index bb8bbddfe467..8813b78b9a6b 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -20,6 +20,7 @@
>  #include "migration/blocker.h"
>  #include "exec.h"
>  #include "fd.h"
> +#include "file.h"
>  #include "socket.h"
>  #include "sysemu/runstate.h"
>  #include "sysemu/sysemu.h"
> @@ -2414,6 +2415,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
>          exec_start_outgoing_migration(s, p, &local_err);
>      } else if (strstart(uri, "fd:", &p)) {
>          fd_start_outgoing_migration(s, p, &local_err);
> +    } else if (strstart(uri, "file:", &p)) {
> +	file_start_outgoing_migration(s, p, &local_err);
>      } else {
>          if (!(has_resume && resume)) {
>              yank_unregister_instance(MIGRATION_YANK_INSTANCE);
> -- 
> 2.34.1
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  parent reply	other threads:[~2022-10-18  9:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10 13:33 [PATCH v2 00/11] Add support for fixed ram offsets during migration Nikolay Borisov
2022-10-10 13:33 ` [PATCH v2 01/11] migration: support file: uri for source migration Nikolay Borisov
2022-10-18  8:56   ` Daniel P. Berrangé
2022-10-18  9:10   ` Daniel P. Berrangé [this message]
2022-10-18  9:49     ` Nikolay Borisov
2022-10-10 13:33 ` [PATCH v2 02/11] migration: Add support for 'file:' uri for incoming migration Nikolay Borisov
2022-10-18 10:01   ` Daniel P. Berrangé
2022-10-10 13:34 ` [PATCH v2 03/11] migration: Make migration json writer part of MigrationState struct Nikolay Borisov
2022-10-18 10:06   ` Daniel P. Berrangé
2022-10-19 15:43     ` Nikolay Borisov
2022-10-19 16:02       ` Daniel P. Berrangé
2022-10-10 13:34 ` [PATCH v2 04/11] io: add pwritev support to QIOChannelFile Nikolay Borisov
2022-10-18 10:11   ` Daniel P. Berrangé
2022-10-10 13:34 ` [PATCH v2 05/11] io: Add support for seekable channels Nikolay Borisov
2022-10-18 10:14   ` Daniel P. Berrangé
2022-10-18 10:46     ` Nikolay Borisov
2022-10-18 10:53       ` Daniel P. Berrangé
2022-10-10 13:34 ` [PATCH v2 06/11] io: Add preadv support to QIOChannelFile Nikolay Borisov
2022-10-10 13:34 ` [PATCH v2 07/11] migration: add qemu_get_buffer_at Nikolay Borisov
2022-10-10 13:34 ` [PATCH v2 08/11] migration/ram: Introduce 'fixed-ram' migration stream capability Nikolay Borisov
2022-10-10 13:34 ` [PATCH v2 09/11] migration: Refactor precopy ram loading code Nikolay Borisov
2022-10-10 13:34 ` [PATCH v2 10/11] migration: Add support for 'fixed-ram' migration restore Nikolay Borisov
2022-10-10 13:34 ` [PATCH v2 11/11] analyze-migration.py: add initial support for fixed ram streams Nikolay Borisov

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=Y05tkGrthAe0Wy65@redhat.com \
    --to=berrange@redhat.com \
    --cc=Claudio.Fontana@suse.com \
    --cc=dfaggioli@suse.com \
    --cc=dgilbert@redhat.com \
    --cc=jfehlig@suse.com \
    --cc=nborisov@suse.com \
    --cc=qemu-devel@nongnu.org \
    /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).