qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 6/8] migration: Add RAM part of migration stream


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH v1 6/8] migration: Add RAM part of migration stream
Date: Wed, 23 Mar 2022 16:52:52 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

23.03.2022 13:53, Nikita Lapshin wrote:
From: Nikita Lapshin <nikita.lapshin@virtuozzo.com>

'ram' parameter enable RAM sections in migration stream. If it
isn't specified it will be skipped.

Signed-off-by: Nikita Lapshin <nikita.lapshin@openvz.org>
---
  migration/migration.c | 17 ++++++++++++++++-
  migration/migration.h |  1 +
  migration/ram.c       |  6 ++++++
  3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/migration/migration.c b/migration/migration.c
index d81f3c6891..6528b3ad41 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1339,7 +1339,8 @@ static bool check_stream_parts(strList *stream_list)
      for (; stream_list; stream_list = stream_list->next) {
          if (!strcmp(stream_list->value, "vmstate") ||
              !strcmp(stream_list->value, "dirty-bitmaps") ||
-            !strcmp(stream_list->value, "block")) {
+            !strcmp(stream_list->value, "block") ||
+            !strcmp(stream_list->value, "ram")) {
              continue;
          }
@@ -2653,6 +2654,20 @@ bool migrate_background_snapshot(void)
      return s->enabled_capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT];
  }
+bool migrate_ram(void)
+{
+    MigrationState *s;
+
+    s = migrate_get_current();
+
+    /*
+     * By default RAM is enabled so if stream-content-list disabled
+     * RAM will be passed.
+     */
+    return !s->parameters.has_stream_content_list ||
+           migrate_find_stream_content("ram");
+}

I think, better is avoid this extra function

+
  /* Checks if stream-content parameter has section_name in list */
  bool migrate_find_stream_content(const char *section_name)
  {
diff --git a/migration/migration.h b/migration/migration.h
index 411c58e919..5c43788a2b 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -395,6 +395,7 @@ int migrate_decompress_threads(void);
  bool migrate_use_events(void);
  bool migrate_postcopy_blocktime(void);
  bool migrate_background_snapshot(void);
+bool migrate_ram(void);
bool migrate_find_stream_content(const char *section_name); diff --git a/migration/ram.c b/migration/ram.c
index 170e522a1f..ddc7abd08a 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -4263,6 +4263,11 @@ static int ram_resume_prepare(MigrationState *s, void 
*opaque)
      return 0;
  }
+static bool is_ram_active(void *opaque)
+{
+    return migrate_ram();

and here just call should_migrate_content("ram");

+}
+
  static SaveVMHandlers savevm_ram_handlers = {
      .save_setup = ram_save_setup,
      .save_live_iterate = ram_save_iterate,
@@ -4275,6 +4280,7 @@ static SaveVMHandlers savevm_ram_handlers = {
      .load_setup = ram_load_setup,
      .load_cleanup = ram_load_cleanup,
      .resume_prepare = ram_resume_prepare,
+    .is_active = is_ram_active,
  };
static void ram_mig_ram_block_resized(RAMBlockNotifier *n, void *host,


--
Best regards,
Vladimir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]