[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RESEND v2 17/18] filter-rewriter: handle checkpoint
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH RESEND v2 17/18] filter-rewriter: handle checkpoint and failover event |
Date: |
Sat, 22 Apr 2017 16:35:27 +0800 |
After one round of checkpoint, the states between PVM and SVM
become consistent, so it is unnecessary to adjust the sequence
of net packets for old connections, besides, while failover
happens, filter-rewriter needs to check if it still needs to
adjust sequence of net packets.
Cc: Jason Wang <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
---
net/filter-rewriter.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c
index c9a6d43..0a90b11 100644
--- a/net/filter-rewriter.c
+++ b/net/filter-rewriter.c
@@ -22,6 +22,7 @@
#include "qemu/main-loop.h"
#include "qemu/iov.h"
#include "net/checksum.h"
+#include "net/colo.h"
#define FILTER_COLO_REWRITER(obj) \
OBJECT_CHECK(RewriterState, (obj), TYPE_FILTER_REWRITER)
@@ -270,6 +271,43 @@ static ssize_t colo_rewriter_receive_iov(NetFilterState
*nf,
return 0;
}
+static void reset_seq_offset(gpointer key, gpointer value, gpointer user_data)
+{
+ Connection *conn = (Connection *)value;
+
+ conn->offset = 0;
+}
+
+static gboolean offset_is_nonzero(gpointer key,
+ gpointer value,
+ gpointer user_data)
+{
+ Connection *conn = (Connection *)value;
+
+ return conn->offset ? true : false;
+}
+
+static void colo_rewriter_handle_event(NetFilterState *nf, int event,
+ Error **errp)
+{
+ RewriterState *rs = FILTER_COLO_REWRITER(nf);
+
+ switch (event) {
+ case COLO_CHECKPOINT:
+ g_hash_table_foreach(rs->connection_track_table,
+ reset_seq_offset, NULL);
+ break;
+ case COLO_FAILOVER:
+ if (!g_hash_table_find(rs->connection_track_table,
+ offset_is_nonzero, NULL)) {
+ object_property_set_str(OBJECT(nf), "off", "status", errp);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
static void colo_rewriter_cleanup(NetFilterState *nf)
{
RewriterState *s = FILTER_COLO_REWRITER(nf);
@@ -299,6 +337,7 @@ static void colo_rewriter_class_init(ObjectClass *oc, void
*data)
nfc->setup = colo_rewriter_setup;
nfc->cleanup = colo_rewriter_cleanup;
nfc->receive_iov = colo_rewriter_receive_iov;
+ nfc->handle_event = colo_rewriter_handle_event;
}
static const TypeInfo colo_rewriter_info = {
--
1.8.3.1
- [Qemu-devel] [PATCH RESEND v2 04/18] COLO: integrate colo compare with colo frame, (continued)
- [Qemu-devel] [PATCH RESEND v2 04/18] COLO: integrate colo compare with colo frame, zhanghailiang, 2017/04/22
- [Qemu-devel] [PATCH RESEND v2 12/18] savevm: split the process of different stages for loadvm/savevm, zhanghailiang, 2017/04/22
- [Qemu-devel] [PATCH RESEND v2 15/18] COLO: flush host dirty ram from cache, zhanghailiang, 2017/04/22
- [Qemu-devel] [PATCH RESEND v2 09/18] COLO: Flush memory data from ram cache, zhanghailiang, 2017/04/22
- [Qemu-devel] [PATCH RESEND v2 14/18] COLO: Split qemu_savevm_state_begin out of checkpoint process, zhanghailiang, 2017/04/22
- [Qemu-devel] [PATCH RESEND v2 18/18] COLO: notify net filters about checkpoint/failover event, zhanghailiang, 2017/04/22
- [Qemu-devel] [PATCH RESEND v2 03/18] colo-compare: use notifier to notify packets comparing result, zhanghailiang, 2017/04/22
- [Qemu-devel] [PATCH RESEND v2 16/18] filter: Add handle_event method for NetFilterClass, zhanghailiang, 2017/04/22
- [Qemu-devel] [PATCH RESEND v2 08/18] ram/COLO: Record the dirty pages that SVM received, zhanghailiang, 2017/04/22
- [Qemu-devel] [PATCH RESEND v2 10/18] qmp event: Add COLO_EXIT event to notify users while exited COLO, zhanghailiang, 2017/04/22
- [Qemu-devel] [PATCH RESEND v2 17/18] filter-rewriter: handle checkpoint and failover event,
zhanghailiang <=
- [Qemu-devel] [PATCH RESEND v2 06/18] COLO: Add block replication into colo process, zhanghailiang, 2017/04/22