qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: nikita.lapshin@openvz.org
To: qemu-devel@nongnu.org
Cc: den@virtuozzo.com, andrey.drobyshev@virtuozzo.com,
	quintela@redhat.com, dgilbert@redhat.com,
	nikita.lapshin@openvz.org
Subject: [PATCH 1/8] migration: Implemented new parameter stream_content
Date: Thu, 16 Jun 2022 13:19:57 +0300	[thread overview]
Message-ID: <20220616102006.218693-2-nikita.lapshin@openvz.org> (raw)
In-Reply-To: <20220616102006.218693-1-nikita.lapshin@openvz.org>

From: Nikita Lapshin <nikita.lapshin@openvz.org>

This new optional parameter contains inormation about migration
stream parts to be sent (such as RAM, block, bitmap). This looks
better than using capabilities to solve problem of dividing
migration stream.

Signed-off-by: Nikita Lapshin <nikita.lapshin@openvz.org>
---
 migration/migration.c | 47 ++++++++++++++++++++++++++++++++++++++++++-
 migration/migration.h |  2 ++
 qapi/migration.json   | 21 ++++++++++++++++---
 3 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index 695f0f2900..4adcc87d1d 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1334,6 +1334,12 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
     }
 }
 
+static bool check_stream_parts(strList *stream_content_list)
+{
+    /* To be implemented in ext commits */
+    return true;
+}
+
 /*
  * Check whether the parameters are valid. Error will be put into errp
  * (if provided). Return true if valid, otherwise false.
@@ -1482,7 +1488,12 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
         return false;
     }
 
-    return true;
+    if (params->has_stream_content_list &&
+        !check_stream_parts(params->stream_content_list)) {
+        error_setg(errp, "Invalid parts of stream given for stream-content");
+    }
+
+   return true;
 }
 
 static void migrate_params_test_apply(MigrateSetParameters *params,
@@ -1581,6 +1592,11 @@ static void migrate_params_test_apply(MigrateSetParameters *params,
         dest->has_block_bitmap_mapping = true;
         dest->block_bitmap_mapping = params->block_bitmap_mapping;
     }
+
+    if (params->has_stream_content_list) {
+        dest->has_stream_content_list = true;
+        dest->stream_content_list = params->stream_content_list;
+    }
 }
 
 static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
@@ -1703,6 +1719,13 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
             QAPI_CLONE(BitmapMigrationNodeAliasList,
                        params->block_bitmap_mapping);
     }
+
+    if (params->has_stream_content_list) {
+        qapi_free_strList(s->parameters.stream_content_list);
+        s->parameters.has_stream_content_list = true;
+        s->parameters.stream_content_list =
+            QAPI_CLONE(strList, params->stream_content_list);
+    }
 }
 
 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp)
@@ -2620,6 +2643,28 @@ bool migrate_background_snapshot(void)
     return s->enabled_capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT];
 }
 
+/* Checks if stream-content parameter has section_name in list */
+bool migrate_find_stream_content(const char *section_name)
+{
+    MigrationState *s;
+
+    s = migrate_get_current();
+
+    if (!s->parameters.has_stream_content_list) {
+        return false;
+    }
+
+    strList *list = s->parameters.stream_content_list;
+
+    for (; list; list = list->next) {
+        if (!strcmp(list->value, section_name)) {
+            return true;
+        }
+    }
+
+    return false;
+}
+
 /* migration thread support */
 /*
  * Something bad happened to the RP stream, mark an error
diff --git a/migration/migration.h b/migration/migration.h
index 2de861df01..411c58e919 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -396,6 +396,8 @@ bool migrate_use_events(void);
 bool migrate_postcopy_blocktime(void);
 bool migrate_background_snapshot(void);
 
+bool migrate_find_stream_content(const char *section_name);
+
 /* Sending on the return path - generic and then for each message type */
 void migrate_send_rp_shut(MigrationIncomingState *mis,
                           uint32_t value);
diff --git a/qapi/migration.json b/qapi/migration.json
index 18e2610e88..80acf6dbc3 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -760,6 +760,12 @@
 #                        block device name if there is one, and to their node name
 #                        otherwise. (Since 5.2)
 #
+# @stream-content-list: Parameter control content of migration stream such as RAM,
+#                       vmstate, block and dirty-bitmaps. This is optional parameter
+#                       so migration will work correctly without it.
+#                       This parameter takes string list as description of content
+#                       and include that part of migration stream. (Since 7.0)
+#
 # Features:
 # @unstable: Member @x-checkpoint-delay is experimental.
 #
@@ -780,7 +786,8 @@
            'xbzrle-cache-size', 'max-postcopy-bandwidth',
            'max-cpu-throttle', 'multifd-compression',
            'multifd-zlib-level' ,'multifd-zstd-level',
-           'block-bitmap-mapping' ] }
+           'block-bitmap-mapping',
+           'stream-content-list' ] }
 
 ##
 # @MigrateSetParameters:
@@ -925,6 +932,12 @@
 #                        block device name if there is one, and to their node name
 #                        otherwise. (Since 5.2)
 #
+# @stream-content-list: Parameter control content of migration stream such as RAM,
+#                       vmstate, block and dirty-bitmaps. This is optional parameter
+#                       so migration will work correctly without it.
+#                       This parameter takes string list as description of content
+#                       and include that part of migration stream. (Since 7.0)
+#
 # Features:
 # @unstable: Member @x-checkpoint-delay is experimental.
 #
@@ -960,7 +973,8 @@
             '*multifd-compression': 'MultiFDCompression',
             '*multifd-zlib-level': 'uint8',
             '*multifd-zstd-level': 'uint8',
-            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } }
+            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
+            '*stream-content-list': [ 'str' ] } }
 
 ##
 # @migrate-set-parameters:
@@ -1158,7 +1172,8 @@
             '*multifd-compression': 'MultiFDCompression',
             '*multifd-zlib-level': 'uint8',
             '*multifd-zstd-level': 'uint8',
-            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } }
+            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
+            '*stream-content-list': [ 'str' ] } }
 
 ##
 # @query-migrate-parameters:
-- 
2.31.1



  reply	other threads:[~2022-06-16 10:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16 10:19 [PATCH 0/8] New parameter for migration stream nikita.lapshin
2022-06-16 10:19 ` nikita.lapshin [this message]
2022-06-16 10:32   ` [PATCH 1/8] migration: Implemented new parameter stream_content Daniel P. Berrangé
2022-06-16 12:53     ` Nikita
2022-06-16 13:10       ` Daniel P. Berrangé
2022-06-16 13:22         ` Nikita
2022-06-16 10:19 ` [PATCH 2/8] migration: should_skip() implemented nikita.lapshin
2022-06-16 10:19 ` [PATCH 3/8] migration: Add vmstate part of migration stream nikita.lapshin
2022-06-16 10:20 ` [PATCH 4/8] igration: Add dirty-bitmaps " nikita.lapshin
2022-06-16 10:20 ` [PATCH 4/8] migration: " nikita.lapshin
2022-06-16 10:20 ` [PATCH 5/8] Add block " nikita.lapshin
2022-06-16 10:22   ` Nikita
2022-06-16 10:20 ` [PATCH 5/8] migration: " nikita.lapshin
2022-06-16 10:20 ` [PATCH 6/8] migration: Add RAM " nikita.lapshin
2022-06-16 10:20 ` [PATCH 7/8] migration: analyze-migration script changed nikita.lapshin
2022-06-16 10:20 ` [PATCH 8/8] migration: Test for RAM and vmstate parts nikita.lapshin

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=20220616102006.218693-2-nikita.lapshin@openvz.org \
    --to=nikita.lapshin@openvz.org \
    --cc=andrey.drobyshev@virtuozzo.com \
    --cc=den@virtuozzo.com \
    --cc=dgilbert@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).