[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 13/29] migration: fixed-ram: Add URI compatibility check
|
From: |
Peter Xu |
|
Subject: |
Re: [PATCH v2 13/29] migration: fixed-ram: Add URI compatibility check |
|
Date: |
Tue, 31 Oct 2023 12:06:33 -0400 |
On Mon, Oct 23, 2023 at 05:35:52PM -0300, Fabiano Rosas wrote:
> The fixed-ram migration format needs a channel that supports seeking
> to be able to write each page to an arbitrary offset in the migration
> stream.
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
> migration/migration.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 692fbc5ad6..cabb3ad3a5 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -106,22 +106,40 @@ static bool migration_needs_multiple_sockets(void)
> return migrate_multifd() || migrate_postcopy_preempt();
> }
>
> +static bool migration_needs_seekable_channel(void)
> +{
> + return migrate_fixed_ram();
> +}
> +
> static bool uri_supports_multi_channels(const char *uri)
> {
> return strstart(uri, "tcp:", NULL) || strstart(uri, "unix:", NULL) ||
> strstart(uri, "vsock:", NULL);
> }
>
> +static bool uri_supports_seeking(const char *uri)
> +{
> + return strstart(uri, "file:", NULL);
> +}
> +
> static bool
> migration_channels_and_uri_compatible(const char *uri, Error **errp)
> {
> + bool compatible = true;
> +
> + if (migration_needs_seekable_channel() &&
> + !uri_supports_seeking(uri)) {
> + error_setg(errp, "Migration requires seekable transport (e.g.
> file)");
> + compatible = false;
We may want to return directly after setting errp once, as error_setg() can
trigger assertion over "*errp==NULL" if below check will fail too.
> + }
> +
> if (migration_needs_multiple_sockets() &&
> !uri_supports_multi_channels(uri)) {
> error_setg(errp, "Migration requires multi-channel URIs (e.g. tcp)");
> - return false;
> + compatible = false;
> }
>
> - return true;
> + return compatible;
> }
>
> static bool migration_should_pause(const char *uri)
> --
> 2.35.3
>
--
Peter Xu
- [PATCH v2 08/29] tests/qtest: File migration auto-pause tests, (continued)
- [PATCH v2 08/29] tests/qtest: File migration auto-pause tests, Fabiano Rosas, 2023/10/23
- [PATCH v2 09/29] io: add and implement QIO_CHANNEL_FEATURE_SEEKABLE for channel file, Fabiano Rosas, 2023/10/23
- [PATCH v2 10/29] io: Add generic pwritev/preadv interface, Fabiano Rosas, 2023/10/23
- [PATCH v2 11/29] io: implement io_pwritev/preadv for QIOChannelFile, Fabiano Rosas, 2023/10/23
- [PATCH v2 12/29] migration/qemu-file: add utility methods for working with seekable channels, Fabiano Rosas, 2023/10/23
- [PATCH v2 13/29] migration: fixed-ram: Add URI compatibility check, Fabiano Rosas, 2023/10/23
- [PATCH v2 14/29] migration/ram: Introduce 'fixed-ram' migration capability, Fabiano Rosas, 2023/10/23
- [PATCH v2 15/29] migration/ram: Add support for 'fixed-ram' outgoing migration, Fabiano Rosas, 2023/10/23