[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Frame v6 28/31] COLO NIC: Implement NIC checkpo
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH COLO-Frame v6 28/31] COLO NIC: Implement NIC checkpoint and failover |
Date: |
Thu, 18 Jun 2015 16:58:52 +0800 |
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Li Zhijian <address@hidden>
---
include/net/colo-nic.h | 2 ++
migration/colo.c | 21 ++++++++++++++++++---
net/colo-nic.c | 23 +++++++++++++++++++++++
3 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/include/net/colo-nic.h b/include/net/colo-nic.h
index 17f8800..252b3ae 100644
--- a/include/net/colo-nic.h
+++ b/include/net/colo-nic.h
@@ -28,5 +28,7 @@ int colo_proxy_init(enum COLOMode mode);
void colo_proxy_destroy(enum COLOMode mode);
int colo_proxy_compare(void);
+int colo_proxy_failover(void);
+int colo_proxy_checkpoint(enum COLOMode mode);
#endif
diff --git a/migration/colo.c b/migration/colo.c
index f446827..0fcadcd 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -120,6 +120,11 @@ static void secondary_vm_do_failover(void)
;
}
+ if (colo_proxy_failover() != 0) {
+ error_report("colo proxy failed to do failover");
+ }
+ colo_proxy_destroy(COLO_MODE_SECONDARY);
+
colo = NULL;
if (!autostart) {
@@ -142,6 +147,8 @@ static void primary_vm_do_failover(void)
vm_stop_force_state(RUN_STATE_COLO);
}
+ colo_proxy_destroy(COLO_MODE_PRIMARY);
+
if (s->state != MIGRATION_STATUS_FAILED) {
migrate_set_state(s, MIGRATION_STATUS_COLO,
MIGRATION_STATUS_COMPLETED);
}
@@ -265,6 +272,11 @@ static int colo_do_checkpoint_transaction(MigrationState
*s, QEMUFile *control)
qemu_fflush(trans);
+ ret = colo_proxy_checkpoint(COLO_MODE_PRIMARY);
+ if (ret < 0) {
+ goto out;
+ }
+
ret = colo_ctl_put(s->file, COLO_CHECKPOINT_SEND);
if (ret < 0) {
goto out;
@@ -424,8 +436,6 @@ out:
qemu_bh_schedule(s->cleanup_bh);
qemu_mutex_unlock_iothread();
- colo_proxy_destroy(COLO_MODE_PRIMARY);
-
return NULL;
}
@@ -551,6 +561,11 @@ void *colo_process_incoming_checkpoints(void *opaque)
goto out;
}
+ ret = colo_proxy_checkpoint(COLO_MODE_SECONDARY);
+ if (ret < 0) {
+ goto out;
+ }
+
ret = colo_ctl_get(f, COLO_CHECKPOINT_SEND);
if (ret < 0) {
goto out;
@@ -634,6 +649,7 @@ out:
* just kill Secondary VM
*/
error_report("SVM is going to exit in default!");
+ colo_proxy_destroy(COLO_MODE_SECONDARY);
exit(1);
} else {
/* if we went here, means Primary VM may dead, we are doing failover */
@@ -658,6 +674,5 @@ out:
loadvm_exit_colo();
- colo_proxy_destroy(COLO_MODE_SECONDARY);
return NULL;
}
diff --git a/net/colo-nic.c b/net/colo-nic.c
index e395c13..4ddc9dc 100644
--- a/net/colo-nic.c
+++ b/net/colo-nic.c
@@ -373,6 +373,29 @@ void colo_proxy_destroy(enum COLOMode mode)
teardown_nic(mode, getpid());
}
+/*
+* Note: Weird, Only the VM in slave side need to do failover work !!!
+*/
+int colo_proxy_failover(void)
+{
+ if (colo_proxy_send(NFCOLO_DO_FAILOVER, COLO_MODE_SECONDARY, 0, NULL) < 0)
{
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+* Note: Only the VM in master side need to do checkpoint
+*/
+int colo_proxy_checkpoint(enum COLOMode mode)
+{
+ if (colo_proxy_send(NFCOLO_DO_CHECKPOINT, mode, 0, NULL) < 0) {
+ return -1;
+ }
+ return 0;
+}
+
int colo_proxy_compare(void)
{
return atomic_xchg(&packet_compare_different, 0);
--
1.7.12.4
- [Qemu-devel] [PATCH COLO-Frame v6 21/31] COLO NIC: Implement colo nic device interface configure(), (continued)
- [Qemu-devel] [PATCH COLO-Frame v6 21/31] COLO NIC: Implement colo nic device interface configure(), zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 24/31] COLO: Handle nfnetlink message from proxy module, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 19/31] COLO NIC: Init/remove colo nic devices when add/cleanup tap devices, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 26/31] COLO: Improve checkpoint efficiency by do additional periodic checkpoint, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 25/31] COLO: Do checkpoint according to the result of packets comparation, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 20/31] tap: Make launch_script() public, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 16/31] qmp event: Add event notification for COLO error, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 22/31] COLO NIC : Implement colo nic init/destroy function, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 29/31] COLO: Disable qdev hotplug when VM is in COLO mode, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 31/31] COLO: Add block replication into colo process, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 28/31] COLO NIC: Implement NIC checkpoint and failover,
zhanghailiang <=
- [Qemu-devel] [PATCH COLO-Frame v6 18/31] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 30/31] COLO: Implement shutdown checkpoint, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 27/31] COLO: Add colo-set-checkpoint-period command, zhanghailiang, 2015/06/18
- [Qemu-devel] [PATCH COLO-Frame v6 23/31] COLO NIC: Some init work related with proxy module, zhanghailiang, 2015/06/18
- Re: [Qemu-devel] [PATCH COLO-Frame v6 00/31] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service, Dr. David Alan Gilbert, 2015/06/30