All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: Tejus GK <tejus.gk@nutanix.com>
Cc: qemu-devel@nongnu.org,  peterx@redhat.com,  leobras@redhat.com,
	farosas@suse.de
Subject: Re: [PATCH v5 2/2] migration: Update error description outside migration.c
Date: Wed, 04 Oct 2023 15:37:28 +0200	[thread overview]
Message-ID: <87h6n633vr.fsf@secure.mitica> (raw)
In-Reply-To: <87leci36db.fsf@secure.mitica> (Juan Quintela's message of "Wed,  04 Oct 2023 14:43:44 +0200")

Juan Quintela <quintela@redhat.com> wrote:
> Tejus GK <tejus.gk@nutanix.com> wrote:
>> On 04/10/23 1:53 pm, Juan Quintela wrote:
>>> Tejus GK <tejus.gk@nutanix.com> wrote:
>>>> On 03/10/23 6:14 pm, Juan Quintela wrote:
> Ouch, that again.
>
> I think that I know how to fix that.
>
> Will take a look.
>
> Later, Juan.

I first only saw that you were missing migrate_set_error().
migrate_get_current() is .... more interesting.

The problem is that migration.c has lots of things that depend of qemu
and we can't use that in qtest.
This is one disection toh help fix it, but I can't see a trivial way to
get current_migration() working as needed.  Really what we should have
is a way to have vmstate store its own error, and only set
migrate_set_error() at callers time, but that don't seem completely
obvious how to do it.

Later, Juan.


From cdbdbca65059ebb9fd6a4d354a94c3be7cf69f92 Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Wed, 4 Oct 2023 15:22:39 +0200
Subject: [PATCH] migration: Create common.c

We can (yet) add migration.c to migration_files because it brings too
many dependencies to the tests.

This file is a place where to move things that are also needed for
tests.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/common.c    | 25 +++++++++++++++++++++++++
 migration/migration.c |  8 --------
 migration/meson.build |  1 +
 3 files changed, 26 insertions(+), 8 deletions(-)
 create mode 100644 migration/common.c

diff --git a/migration/common.c b/migration/common.c
new file mode 100644
index 0000000000..1d02f37c99
--- /dev/null
+++ b/migration/common.c
@@ -0,0 +1,25 @@
+/*
+ * QEMU live migration common code for qemu and qtests
+ *
+ * Copyright (c) 2011 Red Hat Inc
+ *
+ * Authors:
+ *  Juan Quintela <quintela@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/cutils.h"
+#include "qemu/error-report.h"
+#include "qapi/error.h"
+#include "migration.h"
+
+void migrate_set_error(MigrationState *s, const Error *error)
+{
+    QEMU_LOCK_GUARD(&s->error_mutex);
+    if (!s->error) {
+        s->error = error_copy(error);
+    }
+}
diff --git a/migration/migration.c b/migration/migration.c
index 585d3c8f55..f143b3a41e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1221,14 +1221,6 @@ static void migrate_fd_cleanup_bh(void *opaque)
     object_unref(OBJECT(s));
 }
 
-void migrate_set_error(MigrationState *s, const Error *error)
-{
-    QEMU_LOCK_GUARD(&s->error_mutex);
-    if (!s->error) {
-        s->error = error_copy(error);
-    }
-}
-
 static void migrate_error_free(MigrationState *s)
 {
     QEMU_LOCK_GUARD(&s->error_mutex);
diff --git a/migration/meson.build b/migration/meson.build
index 92b1cc4297..57b3098c46 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -1,5 +1,6 @@
 # Files needed by unit tests
 migration_files = files(
+  'common.c',
   'migration-stats.c',
   'page_cache.c',
   'xbzrle.c',

-- 
2.41.0



      reply	other threads:[~2023-10-04 13:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03  6:55 [PATCH v5 0/2] migration: Update error description outside migration.c Tejus GK
2023-10-03  6:55 ` [PATCH v5 1/2] migration/vmstate: Introduce vmstate_save_state_with_err Tejus GK
2023-10-03 12:39   ` Juan Quintela
2023-10-03  6:55 ` [PATCH v5 2/2] migration: Update error description outside migration.c Tejus GK
2023-10-03 12:44   ` Juan Quintela
2023-10-04  4:28     ` Tejus GK
2023-10-04  8:23       ` Juan Quintela
2023-10-04 12:15         ` Tejus GK
2023-10-04 12:43           ` Juan Quintela
2023-10-04 13:37             ` Juan Quintela [this message]

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=87h6n633vr.fsf@secure.mitica \
    --to=quintela@redhat.com \
    --cc=farosas@suse.de \
    --cc=leobras@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tejus.gk@nutanix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.