From: Steve Sistare <steven.sistare@oracle.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>, Peter Xu <peterx@redhat.com>,
Fabiano Rosas <farosas@suse.de>,
Euan Turner <euan.turner@nutanix.com>,
Steve Sistare <steven.sistare@oracle.com>
Subject: [RFC V1 4/6] migration: cpr_get_fd_param helper
Date: Fri, 30 Aug 2024 04:56:35 -0700 [thread overview]
Message-ID: <1725018997-363706-5-git-send-email-steven.sistare@oracle.com> (raw)
In-Reply-To: <1725018997-363706-1-git-send-email-steven.sistare@oracle.com>
Add the helper function cpr_get_fd_param, for use by tap and vdpa.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
include/migration/cpr.h | 2 ++
migration/cpr.c | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/include/migration/cpr.h b/include/migration/cpr.h
index 9a76365..b5fa264 100644
--- a/include/migration/cpr.h
+++ b/include/migration/cpr.h
@@ -27,6 +27,8 @@ void cpr_set_cpr_uri(const char *uri);
int cpr_state_save(Error **errp);
int cpr_state_load(Error **errp);
bool cpr_needed_for_reuse(void *opaque);
+int cpr_get_fd_param(const char *name, const char *fdname,
+ int index, Error **errp);
QEMUFile *cpr_exec_output(Error **errp);
QEMUFile *cpr_exec_input(Error **errp);
diff --git a/migration/cpr.c b/migration/cpr.c
index 096d684..0940ee2 100644
--- a/migration/cpr.c
+++ b/migration/cpr.c
@@ -13,6 +13,7 @@
#include "migration/qemu-file.h"
#include "migration/savevm.h"
#include "migration/vmstate.h"
+#include "monitor/monitor.h"
#include "sysemu/runstate.h"
#include "trace.h"
@@ -268,3 +269,28 @@ bool cpr_needed_for_reuse(void *opaque)
MigMode mode = migrate_mode();
return mode == MIG_MODE_CPR_EXEC || mode == MIG_MODE_CPR_TRANSFER;
}
+
+int cpr_get_fd_param(const char *name, const char *fdname, int index,
+ Error **errp)
+{
+ int fd;
+
+ /*
+ * fd's are passed by name to the monitor when a NIC is hot plugged, but
+ * the name is not known to qemu after cpr. The manager can pass -1 for
+ * the fd "name" in the new qemu args to indicate that qemu should search
+ * for a saved name.
+ */
+ if (!strcmp(fdname, "-1")) {
+ fd = cpr_find_fd(name, index);
+ if (fd < 0) {
+ error_setg(errp, "cannot find saved value for fd %s", fdname);
+ }
+ } else {
+ fd = monitor_fd_param(monitor_cur(), fdname, errp);
+ }
+ if (fd >= 0) {
+ cpr_resave_fd(name, index, fd);
+ }
+ return fd;
+}
--
1.8.3.1
next prev parent reply other threads:[~2024-08-30 11:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 11:56 [RFC V1 0/6] Live Update: tap and vhost Steve Sistare
2024-08-30 11:56 ` [RFC V1 1/6] Revert "vhost-backend: remove vhost_kernel_reset_device()" Steve Sistare
2024-09-03 10:44 ` Euan Turner
2024-09-03 19:55 ` Steven Sistare
2024-08-30 11:56 ` [RFC V1 2/6] tap: common return label Steve Sistare
2024-08-30 11:56 ` [RFC V1 3/6] tap: fix net_init_tap() return code Steve Sistare
2024-08-30 11:56 ` Steve Sistare [this message]
2024-09-03 15:38 ` [RFC V1 4/6] migration: cpr_get_fd_param helper Fabiano Rosas
2024-08-30 11:56 ` [RFC V1 5/6] tap: cpr support Steve Sistare
2024-08-30 11:56 ` [RFC V1 6/6] tap: postload fix for cpr Steve Sistare
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=1725018997-363706-5-git-send-email-steven.sistare@oracle.com \
--to=steven.sistare@oracle.com \
--cc=euan.turner@nutanix.com \
--cc=farosas@suse.de \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).