[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Frame v14 39/40] COLO: flush buffered packets i
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH COLO-Frame v14 39/40] COLO: flush buffered packets in checkpoint process or exit COLO |
Date: |
Sat, 6 Feb 2016 17:28:51 +0800 |
In COLO periodic mode, the packets from VM should not be sent
during the time interval of two checkpoints, we will release
all these buffered packets after the checkpoint process, before
VM is resumed.
In this way, we can ensure not to break the network services if
COLO goes into failover process.
Signed-off-by: zhanghailiang <address@hidden>
Cc: Jason Wang <address@hidden>
Cc: Yang Hongyang <address@hidden>
---
v14:
- New patch
---
migration/colo.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/migration/colo.c b/migration/colo.c
index 86a7638..afbb0e1 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -118,6 +118,19 @@ static void colo_set_filter_status(NetFilterState *nf,
void *opaque,
object_property_set_str(OBJECT(nf), status, "status", errp);
}
+static void colo_flush_filter_packets(NetFilterState *nf, void *opaque,
+ Error **errp)
+{
+ char colo_filter[128];
+ char *name = object_get_canonical_path_component(OBJECT(nf));
+
+ snprintf(colo_filter, sizeof(colo_filter), "%scolo", nf->netdev_id);
+ if (strcmp(colo_filter, name)) {
+ return;
+ }
+ filter_buffer_flush(nf);
+}
+
static void primary_vm_do_failover(void)
{
MigrationState *s = migrate_get_current();
@@ -154,6 +167,7 @@ static void primary_vm_do_failover(void)
if (local_err) {
error_report_err(local_err);
}
+ qemu_foreach_netfilter(colo_flush_filter_packets, NULL, NULL);
/* Notify COLO thread that failover work is finished */
qemu_sem_post(&s->colo_sem);
@@ -361,6 +375,8 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
if (local_err) {
goto out;
}
+ /* FIXME: Remove this after switch to use colo-proxy */
+ qemu_foreach_netfilter(colo_flush_filter_packets, NULL, NULL);
if (colo_shutdown_requested) {
colo_put_cmd(s->to_dst_file, COLO_MESSAGE_GUEST_SHUTDOWN, &local_err);
--
1.8.3.1
- [Qemu-devel] [PATCH COLO-Frame v14 21/40] qmp event: Add COLO_EXIT event to notify users while exited from COLO, (continued)
[Qemu-devel] [PATCH COLO-Frame v14 30/40] COLO: Split qemu_savevm_state_begin out of checkpoint process, zhanghailiang, 2016/02/06
[Qemu-devel] [PATCH COLO-Frame v14 39/40] COLO: flush buffered packets in checkpoint process or exit COLO,
zhanghailiang <=
[Qemu-devel] [PATCH COLO-Frame v14 31/40] net/filter: Add a 'status' property for filter object, zhanghailiang, 2016/02/06
[Qemu-devel] [PATCH COLO-Frame v14 38/40] filter-buffer: make filter_buffer_flush() public, zhanghailiang, 2016/02/06
[Qemu-devel] [PATCH COLO-Frame v14 35/40] COLO/filter: add each netdev a buffer filter, zhanghailiang, 2016/02/06
[Qemu-devel] [PATCH COLO-Frame v14 34/40] net: Add notifier/callback for netdev init, zhanghailiang, 2016/02/06