qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Dr. David Alan Gilbert" <dave@treblig.org>,
	Leonardo Bras <leobras@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Hailiang Zhang <zhanghailiang@xfusion.com>,
	Eric Blake <eblake@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	qemu-block@nongnu.org, Peter Xu <peterx@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Subject: [PULL 09/10] migration: disallow change capabilities in COLO state
Date: Tue,  9 May 2023 21:17:23 +0200	[thread overview]
Message-ID: <20230509191724.86159-10-quintela@redhat.com> (raw)
In-Reply-To: <20230509191724.86159-1-quintela@redhat.com>

From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

COLO is not listed as running state in migrate_is_running(), so, it's
theoretically possible to disable colo capability in COLO state and the
unexpected error in migration_iteration_finish() is reachable.

Let's disallow that in qmp_migrate_set_capabilities. Than the error
becomes absolutely unreachable: we can get into COLO state only with
enabled capability and can't disable it while we are in COLO state. So
substitute the error by simple assertion.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20230428194928.1426370-10-vsementsov@yandex-team.ru>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/migration.c | 5 +----
 migration/options.c   | 2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index 230f91f5a7..4959f7ee44 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2781,10 +2781,7 @@ static void migration_iteration_finish(MigrationState *s)
         runstate_set(RUN_STATE_POSTMIGRATE);
         break;
     case MIGRATION_STATUS_COLO:
-        if (!migrate_colo()) {
-            error_report("%s: critical error: calling COLO code without "
-                         "COLO enabled", __func__);
-        }
+        assert(migrate_colo());
         migrate_start_colo_process(s);
         s->vm_was_running = true;
         /* Fallthrough */
diff --git a/migration/options.c b/migration/options.c
index 9d92b15b76..7ed88b7b32 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -598,7 +598,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
     MigrationCapabilityStatusList *cap;
     bool new_caps[MIGRATION_CAPABILITY__MAX];
 
-    if (migration_is_running(s->state)) {
+    if (migration_is_running(s->state) || migration_in_colo_state()) {
         error_setg(errp, QERR_MIGRATION_ACTIVE);
         return;
     }
-- 
2.40.0



  parent reply	other threads:[~2023-05-09 19:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09 19:17 [PULL 00/10] Migration 20230509 patches Juan Quintela
2023-05-09 19:17 ` [PULL 01/10] ram: Add public helper to set colo bitmap Juan Quintela
2023-05-09 19:17 ` [PULL 02/10] ram: Let colo_flush_ram_cache take the bitmap_mutex Juan Quintela
2023-05-09 19:17 ` [PULL 03/10] multifd: Add the ramblock to MultiFDRecvParams Juan Quintela
2023-05-09 19:17 ` [PULL 04/10] block/meson.build: prefer positive condition for replication Juan Quintela
2023-05-09 19:17 ` [PULL 05/10] colo: make colo_checkpoint_notify static and provide simpler API Juan Quintela
2023-05-09 19:17 ` [PULL 06/10] build: move COLO under CONFIG_REPLICATION Juan Quintela
2023-05-09 19:17 ` [PULL 07/10] migration: drop colo_incoming_thread from MigrationIncomingState Juan Quintela
2023-05-09 19:17 ` [PULL 08/10] migration: process_incoming_migration_co: simplify code flow around ret Juan Quintela
2023-05-09 19:17 ` Juan Quintela [this message]
2023-05-09 19:17 ` [PULL 10/10] migration: block incoming colo when capability is disabled Juan Quintela
2023-05-10 10:17 ` [PULL 00/10] Migration 20230509 patches Richard Henderson
2023-05-10 12:20   ` Juan Quintela
2023-05-10 12:35     ` Richard Henderson
2023-05-10 14:08       ` Juan Quintela
2023-05-10 14:46         ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2023-05-10 18:09 Juan Quintela
2023-05-10 18:09 ` [PULL 09/10] migration: disallow change capabilities in COLO state Juan Quintela

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=20230509191724.86159-10-quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dave@treblig.org \
    --cc=eblake@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=leobras@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    --cc=zhanghailiang@xfusion.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).