Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5A17E9B36B for ; Mon, 2 Mar 2026 11:47:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vx1jC-00015F-EK; Mon, 02 Mar 2026 06:46:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vx1iq-0000Fx-Mk for qemu-devel@nongnu.org; Mon, 02 Mar 2026 06:46:01 -0500 Received: from mout.web.de ([217.72.192.78]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vx1im-0006GL-JB for qemu-devel@nongnu.org; Mon, 02 Mar 2026 06:46:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1772451940; x=1773056740; i=lukasstraub2@web.de; bh=5ZMxuZledCNhBkww1q32JXmc44pD1RwIeIS5m+4DSPs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=tcQoTbZ7POLaAzVgcCJ17dTCbVCP2vED/mKrx+qyprGGDIBH/hlPmXLUrgeSTpOy VTL+bOrYEfs/YrG3AeI9e5g+59G2M5UzMzCPooz/8vs7Eoi4SR2fDfnXz3B8pCxQb oYBRedJ2D3F8Uzmu3G0gJC1U9j7II6f0ykc0DWhmbc1o2CsGcZDZ69DSwjmOhFnE/ /gj0xcznrgd0njaT5KrVs3ky1mzEnHOk9iTe2ibNqom2PrOtrLGR4VRf5y/npXm09 +owuaLYIkzPAmosgVWGxkRrSO06QSXMBbeA022TH2A1lQtJ5WpFmAaa+iNOGDPokb Cl5qCPbKLBb1idAKIA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from client.hidden.invalid by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1M4KJX-1vwkjd2rLd-004YDv; Mon, 02 Mar 2026 12:45:40 +0100 From: Lukas Straub To: qemu-devel@nongnu.org Cc: Lukas Straub , Peter Xu , Fabiano Rosas , Zhang Chen , Hailiang Zhang , Li Zhijian Subject: [PATCH v11 14/21] Convert colo main documentation to restructuredText Date: Mon, 2 Mar 2026 12:45:29 +0100 Message-Id: <20260302-colo_unit_test_multifd-v11-14-d653fb3b1d80@web.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260302-colo_unit_test_multifd-v11-0-d653fb3b1d80@web.de> References: <20260302-colo_unit_test_multifd-v11-0-d653fb3b1d80@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=41531; i=lukasstraub2@web.de; h=from:subject:message-id; bh=ifBF4hUr+Rs6qxvXE1tWijcBFlkplxnUJNPDi8Qzm/k=; b=owEBbQKS/ZANAwAKATWrCyicXbJYAcsmYgBppW6UlMBjzlDDSLnDstQVR5uxsJpTmD5IuuyXG RdXvPaYWSGJAjMEAAEKAB0WIQSD+rFYoNm4+3Jij6Q1qwsonF2yWAUCaaVulAAKCRA1qwsonF2y WPSNEACgTB2fYyHdI7LChS+5uPCjG9sfYrlOsj5D/1FUCufTNNoTE2hzC70kT05s85FcKCk5WLg uLGa+W3sJsiBEQ91jmOBbHfAn7BC1JfueBteWqP0cK4cRqJNfYE1pXQAsT9yAO/MyiOaveUOuLF NaCNrExooqt8YuYFmsuFpKASVVd/rncX+fgxiV4xcRKYkNkLobsUvSBNm5fARwzPdWU7ulUFzLS Md0Dhp2IToBbx8aJCrrZknBOmjHDeimcpGdrq4SROW0Yx5Hmfm3mQnT3znEMjELzkMgCYZLwpVM gJUGJpcYxx1/ud0GX0oQijVwwk6u2RKl3p5jlI357aldlIJ7SDvKNeFV8GOgXAQcoScHfPf8Rif qciIEItEtGd7I5oQV1zE8EiLxf+z1jPC8uKbby2QbaBjJzLkpunG5xBJX9b+o71ZplIr/GxWYh/ WuPD+n0+S1aji+0G0AvFJTq2a6Uq6VU/hvOmLa/q0uIkXdcS/Lp6IbN8Gl/iprNiy7faNyzQ9EV wxPTwujPYMDTekWIWQdNiAhTfhkNEUDJMa+3StWpj4d+p5VAuO65DKm6Kli6My/jzFqFNk6aUOi D+ByC5zZVrqTKVMspQSh+uQOoV7d2XVH+WPGXf8mEH6QKLoNsYTg5rzRrY5ohBr8YA27i5ZJjQE 2Wqs3SGYU66x2uw== X-Developer-Key: i=lukasstraub2@web.de; a=openpgp; fpr=83FAB158A0D9B8FB72628FA435AB0B289C5DB258 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:hQJ4msaJCsbLF0I3K574W4tcw+zk/owL7QMkKu47s3th1N6mVNs uyniVN5qy//lOvyxkmxlASRddZ1v5M5PNMYdl+pgyxTey9Lv8oCMeKQXogLD4yQq88A7QPl EVjPQxfPKM2OuGmEBGN0HYxLsxBK51bzHVsm/SeNzHWqQ5GrNh+JrF0v4p0wCpIAlsK9fS1 0VjVdc53q59bqyKsPfNLw== UI-OutboundReport: notjunk:1;M01:P0:g+j8C0BaWOI=;MVi2D5c9alJY7k7tKaZpGcRh+7P sWnJPzs+2o69I7rCInIZ4zxj+NFTTcJupdzT7DGXSidTQIzdCdDAV9JAWyfoQmZOQQWXr+Ymr p4N7jgWD/yeV9PUhzB8lhgF/xoh0D+jHEAKdkrmKwPCxWzQ5BR1hpeY4u3zVlVj4mpvPBcIk2 jeMtV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7VDHRH JoVXxH7XZjRVgJ8DoWWlpCgt2vqQllmq/j/AhZjw3LBJcoSPUSxWHZuQxVE0mgSuZU+NzPKT/ qOspYa6XBKysroVXyZWBhUCoqmggrxJBjXStLhVEigmyBr+dTcbaELvq+yRKSPZCCLD03dUvR uCixOKzAo2ZeOy3R2OCcpV4Hv78pCPvmbkM8MhwwfRxDRXGy49QVPguvu+KXKS6yAvRVTxV9b +Ne4wn4+638EF6weryz2kci5T4faNjtgoUkhkGsPfE+D/xSA8v29gwiHqDAkB9FxDKtX1nvQH YfkgKsuH4VhHebbD10oo50sMJ0Fz/Zgmn/ecHtYgKAPcAPEksuLnfSWRZShPVSn6Qd5m6Q89X tsgdhSA7MwPxNcWAkR9IbKZgOMNlNTYhxorwstuebLjXyDuRESuwD/7tPqjHJ8olocEZ14CQZ BB52vE6fPMi8mnuCUXq4RrLHbvr58+ZjNfpeFAQnlHpesPalusbAoWxtuQ9FolYrUOBp4rXIn /3hjnZUSJNm3DCz1KEOqbeu5T2ZFFZ39L2e03cTkcHD2lUuR1zVx264GXi787lDAz6bJXlRAv LfqULTB7nMwOtXX0EatYDBWRBgbYF0Aw7l3F/ZW9qah+m7wGwUS13CuCMkrYwIbw5AuCse1+L Ru2gcy5KYuI6HE2b1EBV9o+IhBPQg7SqJZB+3gE8BuAUAitKSJoCu447DAKBSV/65nr3x6dOf LCFJ69WZlBqlp0DbXOQJiPet6x49UtXthtw7zDNfO6QGFBYyyfYAhwyHRd2wDWng3QKsZikIM fVfO/25h/HiZJIG+97dq4/7RnUOmB1npR4j3GuyIQINZ04rwCMoOxHYFHKbEHzbE7hxM7gFY= Received-SPF: pass client-ip=217.72.192.78; envelope-from=lukasstraub2@web.de; helo=mout.web.de X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.012, RCVD_IN_VALIDITY_RPBL_BLOCKED=1.188, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Reviewed-by: Fabiano Rosas Reviewed-by: Zhang Chen Signed-off-by: Lukas Straub =2D-- MAINTAINERS | 2 +- docs/COLO-FT.txt | 334 -----------------------------------------= - docs/system/index.rst | 1 + docs/system/qemu-colo.rst | 360 +++++++++++++++++++++++++++++++++++++++++= +++++ 4 files changed, 362 insertions(+), 335 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 1b0ae10750036be00571b7104ad8426c071bb54c..32ab4b1faa29499ae9067088ae= 1739e52680cbb4 100644 =2D-- a/MAINTAINERS +++ b/MAINTAINERS @@ -3876,7 +3876,7 @@ F: migration/multifd-colo.* F: include/migration/colo.h F: include/migration/failover.h F: tests/qtest/migration/colo-tests.c -F: docs/COLO-FT.txt +F: docs/system/qemu-colo.rst =20 COLO Proxy M: Zhang Chen diff --git a/docs/COLO-FT.txt b/docs/COLO-FT.txt deleted file mode 100644 index 2283a09c080b8996f9767eeb415e8d4fbdc940af..00000000000000000000000000= 00000000000000 =2D-- a/docs/COLO-FT.txt +++ /dev/null @@ -1,334 +0,0 @@ -COarse-grained LOck-stepping Virtual Machines for Non-stop Service =2D---------------------------------------- -Copyright (c) 2016 Intel Corporation -Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD. -Copyright (c) 2016 Fujitsu, Corp. - -This work is licensed under the terms of the GNU GPL, version 2 or later. -See the COPYING file in the top-level directory. - -This document gives an overview of COLO's design and how to use it. - -=3D=3D Background =3D=3D -Virtual machine (VM) replication is a well known technique for providing -application-agnostic software-implemented hardware fault tolerance, -also known as "non-stop service". - -COLO (COarse-grained LOck-stepping) is a high availability solution. -Both primary VM (PVM) and secondary VM (SVM) run in parallel. They receiv= e the -same request from client, and generate response in parallel too. -If the response packets from PVM and SVM are identical, they are released -immediately. Otherwise, a VM checkpoint (on demand) is conducted. - -=3D=3D Architecture =3D=3D - -The architecture of COLO is shown in the diagram below. -It consists of a pair of networked physical nodes: -The primary node running the PVM, and the secondary node running the SVM -to maintain a valid replica of the PVM. -PVM and SVM execute in parallel and generate output of response packets f= or -client requests according to the application semantics. - -The incoming packets from the client or external network are received by = the -primary node, and then forwarded to the secondary node, so that both the = PVM -and the SVM are stimulated with the same requests. - -COLO receives the outbound packets from both the PVM and SVM and compares= them -before allowing the output to be sent to clients. - -The SVM is qualified as a valid replica of the PVM, as long as it generat= es -identical responses to all client requests. Once the differences in the o= utputs -are detected between the PVM and SVM, COLO withholds transmission of the -outbound packets until it has successfully synchronized the PVM state to = the SVM. - - Primary Node = Secondary Node -+------------+ +-----------------------+ +------------------------= + +------------+ -| | | HeartBeat +<----->+ HeartBeat = | | | -| Primary VM | +-----------+-----------+ +-----------+------------= + |Secondary VM| -| | | | = | | -| | +-----------|-----------+ +-----------|------------= + | | -| | |QEMU +---v----+ | |QEMU +----v---+ = | | | -| | | |Failover| | | |Failover| = | | | -| | | +--------+ | | +--------+ = | | | -| | | +---------------+ | | +---------------+ = | | | -| | | | VM Checkpoint +-------------->+ VM Checkpoint | = | | | -| | | +---------------+ | | +---------------+ = | | | -|Requests<--------------------------\ /-----------------\ /--------------= =2D------>Requests| -| | | ^ ^ | | | | = | | | -|Responses+---------------------\ /-|-|------------\ /-------------------= =2D-----+Responses| -| | | | | | | | | | | | | = | | | -| | | +-----------+ | | | | | | | | | | +----------+ = | | | -| | | | COLO disk | | | | | | | | | | | | COLO disk| = | | | -| | | | Manager +---------------------------->| Manager | = | | | -| | | ++----------+ v v | | | | | v v | +---------++ = | | | -| | | |+-----------+-+-+-++| | ++-+--+-+---------+ | = | | | -| | | || COLO Proxy || | | COLO Proxy | | = | | | -| | | || (compare packet || | |(adjust sequence | | = | | | -| | | ||and mirror packet)|| | | and ACK) | | = | | | -| | | |+------------+---+-+| | +-----------------+ | = | | | -+------------+ +-----------------------+ +------------------------= + +------------+ -+------------+ | | | | = +------------+ -| VM Monitor | | | | | = | VM Monitor | -+------------+ | | | | = +------------+ -+---------------------------------------+ +------------------------= =2D---------------+ -| Kernel | | | | | Kernel | = | -+---------------------------------------+ +------------------------= =2D---------------+ - | | | | - +--------------v+ +---------v---+--+ +------------------+ +v--= =2D----------+ - | Storage | |External Network| | External Network | | = Storage | - +---------------+ +----------------+ +------------------+ +---= =2D----------+ - - -=3D=3D Components introduction =3D=3D - -You can see there are several components in COLO's diagram of architectur= e. -Their functions are described below. - -HeartBeat: -Runs on both the primary and secondary nodes, to periodically check platf= orm -availability. When the primary node suffers a hardware fail-stop failure, -the heartbeat stops responding, the secondary node will trigger a failove= r -as soon as it determines the absence. - -COLO disk Manager: -When primary VM writes data into image, the colo disk manager captures th= is data -and sends it to secondary VM's which makes sure the context of secondary = VM's -image is consistent with the context of primary VM 's image. -For more details, please refer to docs/block-replication.txt. - -Checkpoint/Failover Controller: -Modifications of save/restore flow to realize continuous migration, -to make sure the state of VM in Secondary side is always consistent with = VM in -Primary side. - -COLO Proxy: -Delivers packets to Primary and Secondary, and then compare the responses= from -both side. Then decide whether to start a checkpoint according to some ru= les. -Please refer to docs/colo-proxy.txt for more information. - -Note: -HeartBeat has not been implemented yet, so you need to trigger failover p= rocess -by using 'x-colo-lost-heartbeat' command. - -=3D=3D COLO operation status =3D=3D - -+-----------------+ -| | -| Start COLO | -| | -+--------+--------+ - | - | Main qmp command: - | migrate-set-capabilities with x-colo - | migrate - | - v -+--------+--------+ -| | -| COLO running | -| | -+--------+--------+ - | - | Main qmp command: - | x-colo-lost-heartbeat - | or - | some error happened - v -+--------+--------+ -| | send qmp event: -| COLO failover | COLO_EXIT -| | -+-----------------+ - -COLO use the qmp command to switch and report operation status. -The diagram just shows the main qmp command, you can get the detail -in test procedure. - -=3D=3D Test procedure =3D=3D -Note: Here we are running both instances on the same host for testing, -change the IP Addresses if you want to run it on two hosts. Initially -127.0.0.1 is the Primary Host and 127.0.0.2 is the Secondary Host. - -=3D=3D Startup qemu =3D=3D -1. Primary: -Note: Initially, $imagefolder/primary.qcow2 needs to be copied to all hos= ts. -You don't need to change any IP's here, because 0.0.0.0 listens on any -interface. The chardev's with 127.0.0.1 IP's loopback to the local qemu -instance. - -# imagefolder=3D"/mnt/vms/colo-test-primary" - -# qemu-system-x86_64 -enable-kvm -cpu qemu64,kvmclock=3Don -m 512 -smp 1 = -qmp stdio \ - -device piix3-usb-uhci -device usb-tablet -name primary \ - -netdev tap,id=3Dhn0,vhost=3Doff,helper=3D/usr/lib/qemu/qemu-bridge-he= lper \ - -device rtl8139,id=3De0,netdev=3Dhn0 \ - -chardev socket,id=3Dmirror0,host=3D0.0.0.0,port=3D9003,server=3Don,wa= it=3Doff \ - -chardev socket,id=3Dcompare1,host=3D0.0.0.0,port=3D9004,server=3Don,w= ait=3Don \ - -chardev socket,id=3Dcompare0,host=3D127.0.0.1,port=3D9001,server=3Don= ,wait=3Doff \ - -chardev socket,id=3Dcompare0-0,host=3D127.0.0.1,port=3D9001 \ - -chardev socket,id=3Dcompare_out,host=3D127.0.0.1,port=3D9005,server= =3Don,wait=3Doff \ - -chardev socket,id=3Dcompare_out0,host=3D127.0.0.1,port=3D9005 \ - -object filter-mirror,id=3Dm0,netdev=3Dhn0,queue=3Dtx,outdev=3Dmirror0= \ - -object filter-redirector,netdev=3Dhn0,id=3Dredire0,queue=3Drx,indev= =3Dcompare_out \ - -object filter-redirector,netdev=3Dhn0,id=3Dredire1,queue=3Drx,outdev= =3Dcompare0 \ - -object iothread,id=3Diothread1 \ - -object colo-compare,id=3Dcomp0,primary_in=3Dcompare0-0,secondary_in= =3Dcompare1,\ -outdev=3Dcompare_out0,iothread=3Diothread1 \ - -drive if=3Dide,id=3Dcolo-disk0,driver=3Dquorum,read-pattern=3Dfifo,vo= te-threshold=3D1,\ -children.0.file.filename=3D$imagefolder/primary.qcow2,children.0.driver= =3Dqcow2 -S - -2. Secondary: -Note: Active and hidden images need to be created only once and the -size should be the same as primary.qcow2. Again, you don't need to change -any IP's here, except for the $primary_ip variable. - -# imagefolder=3D"/mnt/vms/colo-test-secondary" -# primary_ip=3D127.0.0.1 - -# qemu-img create -f qcow2 $imagefolder/secondary-active.qcow2 10G - -# qemu-img create -f qcow2 $imagefolder/secondary-hidden.qcow2 10G - -# qemu-system-x86_64 -enable-kvm -cpu qemu64,kvmclock=3Don -m 512 -smp 1 = -qmp stdio \ - -device piix3-usb-uhci -device usb-tablet -name secondary \ - -netdev tap,id=3Dhn0,vhost=3Doff,helper=3D/usr/lib/qemu/qemu-bridge-he= lper \ - -device rtl8139,id=3De0,netdev=3Dhn0 \ - -chardev socket,id=3Dred0,host=3D$primary_ip,port=3D9003,reconnect-ms= =3D1000 \ - -chardev socket,id=3Dred1,host=3D$primary_ip,port=3D9004,reconnect-ms= =3D1000 \ - -object filter-redirector,id=3Df1,netdev=3Dhn0,queue=3Dtx,indev=3Dred0= \ - -object filter-redirector,id=3Df2,netdev=3Dhn0,queue=3Drx,outdev=3Dred= 1 \ - -object filter-rewriter,id=3Drew0,netdev=3Dhn0,queue=3Dall \ - -drive if=3Dnone,id=3Dparent0,file.filename=3D$imagefolder/primary.qco= w2,driver=3Dqcow2 \ - -drive if=3Dnone,id=3Dchilds0,driver=3Dreplication,mode=3Dsecondary,fi= le.driver=3Dqcow2,\ -top-id=3Dcolo-disk0,file.file.filename=3D$imagefolder/secondary-active.qc= ow2,\ -file.backing.driver=3Dqcow2,file.backing.file.filename=3D$imagefolder/sec= ondary-hidden.qcow2,\ -file.backing.backing=3Dparent0 \ - -drive if=3Dide,id=3Dcolo-disk0,driver=3Dquorum,read-pattern=3Dfifo,vo= te-threshold=3D1,\ -children.0=3Dchilds0 \ - -incoming tcp:0.0.0.0:9998 - - -3. On Secondary VM's QEMU monitor, issue command -{"execute":"qmp_capabilities"} -{"execute": "migrate-set-capabilities", "arguments": {"capabilities": [ {= "capability": "x-colo", "state": true } ] } } -{"execute": "nbd-server-start", "arguments": {"addr": {"type": "inet", "d= ata": {"host": "0.0.0.0", "port": "9999"} } } } -{"execute": "nbd-server-add", "arguments": {"device": "parent0", "writabl= e": true } } - -Note: - a. The qmp command nbd-server-start and nbd-server-add must be run - before running the qmp command migrate on primary QEMU - b. Active disk, hidden disk and nbd target's length should be the - same. - c. It is better to put active disk and hidden disk in ramdisk. They - will be merged into the parent disk on failover. - -4. On Primary VM's QEMU monitor, issue command: -{"execute":"qmp_capabilities"} -{"execute": "human-monitor-command", "arguments": {"command-line": "drive= _add -n buddy driver=3Dreplication,mode=3Dprimary,file.driver=3Dnbd,file.h= ost=3D127.0.0.2,file.port=3D9999,file.export=3Dparent0,node-name=3Dreplica= tion0"}} -{"execute": "x-blockdev-change", "arguments":{"parent": "colo-disk0", "no= de": "replication0" } } -{"execute": "migrate-set-capabilities", "arguments": {"capabilities": [ {= "capability": "x-colo", "state": true } ] } } -{"execute": "migrate", "arguments": {"uri": "tcp:127.0.0.2:9998" } } - - Note: - a. There should be only one NBD Client for each primary disk. - b. The qmp command line must be run after running qmp command line in - secondary qemu. - -5. After the above steps, you will see, whenever you make changes to PVM,= SVM will be synced. -You can issue command '{ "execute": "migrate-set-parameters" , "arguments= ":{ "x-checkpoint-delay": 2000 } }' -to change the idle checkpoint period time - -6. Failover test -You can kill one of the VMs and Failover on the surviving VM: - -If you killed the Secondary, then follow "Primary Failover". After that, -if you want to resume the replication, follow "Primary resume replication= " - -If you killed the Primary, then follow "Secondary Failover". After that, -if you want to resume the replication, follow "Secondary resume replicati= on" - -=3D=3D Primary Failover =3D=3D -The Secondary died, resume on the Primary - -{"execute": "x-blockdev-change", "arguments":{ "parent": "colo-disk0", "c= hild": "children.1"} } -{"execute": "human-monitor-command", "arguments":{ "command-line": "drive= _del replication0" } } -{"execute": "object-del", "arguments":{ "id": "comp0" } } -{"execute": "object-del", "arguments":{ "id": "iothread1" } } -{"execute": "object-del", "arguments":{ "id": "m0" } } -{"execute": "object-del", "arguments":{ "id": "redire0" } } -{"execute": "object-del", "arguments":{ "id": "redire1" } } -{"execute": "x-colo-lost-heartbeat" } - -=3D=3D Secondary Failover =3D=3D -The Primary died, resume on the Secondary and prepare to become the new P= rimary - -{"execute": "nbd-server-stop"} -{"execute": "x-colo-lost-heartbeat"} - -{"execute": "object-del", "arguments":{ "id": "f2" } } -{"execute": "object-del", "arguments":{ "id": "f1" } } -{"execute": "chardev-remove", "arguments":{ "id": "red1" } } -{"execute": "chardev-remove", "arguments":{ "id": "red0" } } - -{"execute": "chardev-add", "arguments":{ "id": "mirror0", "backend": {"ty= pe": "socket", "data": {"addr": { "type": "inet", "data": { "host": "0.0.0= .0", "port": "9003" } }, "server": true } } } } -{"execute": "chardev-add", "arguments":{ "id": "compare1", "backend": {"t= ype": "socket", "data": {"addr": { "type": "inet", "data": { "host": "0.0.= 0.0", "port": "9004" } }, "server": true } } } } -{"execute": "chardev-add", "arguments":{ "id": "compare0", "backend": {"t= ype": "socket", "data": {"addr": { "type": "inet", "data": { "host": "127.= 0.0.1", "port": "9001" } }, "server": true } } } } -{"execute": "chardev-add", "arguments":{ "id": "compare0-0", "backend": {= "type": "socket", "data": {"addr": { "type": "inet", "data": { "host": "12= 7.0.0.1", "port": "9001" } }, "server": false } } } } -{"execute": "chardev-add", "arguments":{ "id": "compare_out", "backend": = {"type": "socket", "data": {"addr": { "type": "inet", "data": { "host": "1= 27.0.0.1", "port": "9005" } }, "server": true } } } } -{"execute": "chardev-add", "arguments":{ "id": "compare_out0", "backend":= {"type": "socket", "data": {"addr": { "type": "inet", "data": { "host": "= 127.0.0.1", "port": "9005" } }, "server": false } } } } - -=3D=3D Primary resume replication =3D=3D -Resume replication after new Secondary is up. - -Start the new Secondary (Steps 2 and 3 above), then on the Primary: -{"execute": "drive-mirror", "arguments":{ "device": "colo-disk0", "job-id= ": "resync", "target": "nbd://127.0.0.2:9999/parent0", "mode": "existing",= "format": "raw", "sync": "full"} } - -Wait until disk is synced, then: -{"execute": "stop"} -{"execute": "block-job-cancel", "arguments":{ "device": "resync"} } - -{"execute": "human-monitor-command", "arguments":{ "command-line": "drive= _add -n buddy driver=3Dreplication,mode=3Dprimary,file.driver=3Dnbd,file.h= ost=3D127.0.0.2,file.port=3D9999,file.export=3Dparent0,node-name=3Dreplica= tion0"}} -{"execute": "x-blockdev-change", "arguments":{ "parent": "colo-disk0", "n= ode": "replication0" } } - -{"execute": "object-add", "arguments":{ "qom-type": "filter-mirror", "id"= : "m0", "netdev": "hn0", "queue": "tx", "outdev": "mirror0" } } -{"execute": "object-add", "arguments":{ "qom-type": "filter-redirector", = "id": "redire0", "netdev": "hn0", "queue": "rx", "indev": "compare_out" } = } -{"execute": "object-add", "arguments":{ "qom-type": "filter-redirector", = "id": "redire1", "netdev": "hn0", "queue": "rx", "outdev": "compare0" } } -{"execute": "object-add", "arguments":{ "qom-type": "iothread", "id": "io= thread1" } } -{"execute": "object-add", "arguments":{ "qom-type": "colo-compare", "id":= "comp0", "primary_in": "compare0-0", "secondary_in": "compare1", "outdev"= : "compare_out0", "iothread": "iothread1" } } - -{"execute": "migrate-set-capabilities", "arguments":{ "capabilities": [ {= "capability": "x-colo", "state": true } ] } } -{"execute": "migrate", "arguments":{ "uri": "tcp:127.0.0.2:9998" } } - -Note: -If this Primary previously was a Secondary, then we need to insert the -filters before the filter-rewriter by using the -""insert": "before", "position": "id=3Drew0"" Options. See below. - -=3D=3D Secondary resume replication =3D=3D -Become Primary and resume replication after new Secondary is up. Note -that now 127.0.0.1 is the Secondary and 127.0.0.2 is the Primary. - -Start the new Secondary (Steps 2 and 3 above, but with primary_ip=3D127.0= .0.2), -then on the old Secondary: -{"execute": "drive-mirror", "arguments":{ "device": "colo-disk0", "job-id= ": "resync", "target": "nbd://127.0.0.1:9999/parent0", "mode": "existing",= "format": "raw", "sync": "full"} } - -Wait until disk is synced, then: -{"execute": "stop"} -{"execute": "block-job-cancel", "arguments":{ "device": "resync" } } - -{"execute": "human-monitor-command", "arguments":{ "command-line": "drive= _add -n buddy driver=3Dreplication,mode=3Dprimary,file.driver=3Dnbd,file.h= ost=3D127.0.0.1,file.port=3D9999,file.export=3Dparent0,node-name=3Dreplica= tion0"}} -{"execute": "x-blockdev-change", "arguments":{ "parent": "colo-disk0", "n= ode": "replication0" } } - -{"execute": "object-add", "arguments":{ "qom-type": "filter-mirror", "id"= : "m0", "insert": "before", "position": "id=3Drew0", "netdev": "hn0", "que= ue": "tx", "outdev": "mirror0" } } -{"execute": "object-add", "arguments":{ "qom-type": "filter-redirector", = "id": "redire0", "insert": "before", "position": "id=3Drew0", "netdev": "h= n0", "queue": "rx", "indev": "compare_out" } } -{"execute": "object-add", "arguments":{ "qom-type": "filter-redirector", = "id": "redire1", "insert": "before", "position": "id=3Drew0", "netdev": "h= n0", "queue": "rx", "outdev": "compare0" } } -{"execute": "object-add", "arguments":{ "qom-type": "iothread", "id": "io= thread1" } } -{"execute": "object-add", "arguments":{ "qom-type": "colo-compare", "id":= "comp0", "primary_in": "compare0-0", "secondary_in": "compare1", "outdev"= : "compare_out0", "iothread": "iothread1" } } - -{"execute": "migrate-set-capabilities", "arguments":{ "capabilities": [ {= "capability": "x-colo", "state": true } ] } } -{"execute": "migrate", "arguments":{ "uri": "tcp:127.0.0.1:9998" } } - -=3D=3D TODO =3D=3D -1. Support shared storage. -2. Develop the heartbeat part. -3. Reduce checkpoint VM=E2=80=99s downtime while doing checkpoint. diff --git a/docs/system/index.rst b/docs/system/index.rst index 427b020483104f6589878bbf255a367ae114c61b..6268c41aea9c74dc3e59d896b5= ae082360bfbb1a 100644 =2D-- a/docs/system/index.rst +++ b/docs/system/index.rst @@ -41,3 +41,4 @@ or Hypervisor.Framework. igvm vm-templating sriov + qemu-colo diff --git a/docs/system/qemu-colo.rst b/docs/system/qemu-colo.rst new file mode 100644 index 0000000000000000000000000000000000000000..4b5fbbf398f8a5c4ea6baad615= bde94b2b4678d2 =2D-- /dev/null +++ b/docs/system/qemu-colo.rst @@ -0,0 +1,360 @@ +Qemu COLO Fault Tolerance +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D + +| Copyright (c) 2016 Intel Corporation +| Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD. +| Copyright (c) 2016 Fujitsu, Corp. + +This work is licensed under the terms of the GNU GPL, version 2 or later. +See the COPYING file in the top-level directory. + +This document gives an overview of COLO's design and how to use it. + +Background +---------- +Virtual machine (VM) replication is a well known technique for providing +application-agnostic software-implemented hardware fault tolerance, +also known as "non-stop service". + +COLO (COarse-grained LOck-stepping) is a high availability solution. +Both primary VM (PVM) and secondary VM (SVM) run in parallel. They receiv= e the +same request from client, and generate response in parallel too. +If the response packets from PVM and SVM are identical, they are released +immediately. Otherwise, a VM checkpoint (on demand) is conducted. + +Architecture +------------ +The architecture of COLO is shown in the diagram below. +It consists of a pair of networked physical nodes: +The primary node running the PVM, and the secondary node running the SVM +to maintain a valid replica of the PVM. +PVM and SVM execute in parallel and generate output of response packets f= or +client requests according to the application semantics. + +The incoming packets from the client or external network are received by = the +primary node, and then forwarded to the secondary node, so that both the = PVM +and the SVM are stimulated with the same requests. + +COLO receives the outbound packets from both the PVM and SVM and compares= them +before allowing the output to be sent to clients. + +The SVM is qualified as a valid replica of the PVM, as long as it generat= es +identical responses to all client requests. Once the differences in the o= utputs +are detected between the PVM and SVM, COLO withholds transmission of the +outbound packets until it has successfully synchronized the PVM state to = the SVM. + +Overview:: + + Primary Node = Secondary Node + +------------+ +-----------------------+ +--------------------= =2D---+ +------------+ + | | | HeartBeat +<----->+ HeartBeat = | | | + | Primary VM | +-----------+-----------+ +-----------+--------= =2D---+ |Secondary VM| + | | | | = | | + | | +-----------|-----------+ +-----------|--------= =2D---+ | | + | | |QEMU +---v----+ | |QEMU +----v---+ = | | | + | | | |Failover| | | |Failover| = | | | + | | | +--------+ | | +--------+ = | | | + | | | +---------------+ | | +---------------+= | | | + | | | | VM Checkpoint +-------------->+ VM Checkpoint |= | | | + | | | +---------------+ | | +---------------+= | | | + |Requests<--------------------------\ /-----------------\ /----------= =2D---------->Requests| + | | | ^ ^ | | | | = | | | + |Responses+---------------------\ /-|-|------------\ /---------------= =2D---------+Responses| + | | | | | | | | | | | | | = | | | + | | | +-----------+ | | | | | | | | | | +--------= =2D-+ | | | + | | | | COLO disk | | | | | | | | | | | | COLO di= sk| | | | + | | | | Manager +---------------------------->| Manager= | | | | + | | | ++----------+ v v | | | | | v v | +--------= -++ | | | + | | | |+-----------+-+-+-++| | ++-+--+-+---------+= | | | | + | | | || COLO Proxy || | | COLO Proxy |= | | | | + | | | || (compare packet || | |(adjust sequence |= | | | | + | | | ||and mirror packet)|| | | and ACK) |= | | | | + | | | |+------------+---+-+| | +-----------------+= | | | | + +------------+ +-----------------------+ +--------------------= =2D---+ +------------+ + +------------+ | | | = | +------------+ + | VM Monitor | | | | = | | VM Monitor | + +------------+ | | | = | +------------+ + +---------------------------------------+ +--------------------= =2D-------------------+ + | Kernel | | | | | Kernel = | | + +---------------------------------------+ +--------------------= =2D-------------------+ + | | | = | + +--------------v+ +---------v---+--+ +------------------+ = +v-------------+ + | Storage | |External Network| | External Network | = | Storage | + +---------------+ +----------------+ +------------------+ = +--------------+ + +Components introduction +^^^^^^^^^^^^^^^^^^^^^^^ +You can see there are several components in COLO's diagram of architectur= e. +Their functions are described below. + +HeartBeat +~~~~~~~~~ +Runs on both the primary and secondary nodes, to periodically check platf= orm +availability. When the primary node suffers a hardware fail-stop failure, +the heartbeat stops responding, the secondary node will trigger a failove= r +as soon as it determines the absence. + +COLO disk Manager +~~~~~~~~~~~~~~~~~ +When primary VM writes data into image, the colo disk manager captures th= is data +and sends it to secondary VM's which makes sure the context of secondary = VM's +image is consistent with the context of primary VM 's image. +For more details, please refer to docs/block-replication.txt. + +Checkpoint/Failover Controller +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Modifications of save/restore flow to realize continuous migration, +to make sure the state of VM in Secondary side is always consistent with = VM in +Primary side. + +COLO Proxy +~~~~~~~~~~ +Delivers packets to Primary and Secondary, and then compare the responses= from +both side. Then decide whether to start a checkpoint according to some ru= les. +Please refer to docs/colo-proxy.txt for more information. + +Note: +HeartBeat has not been implemented yet, so you need to trigger failover p= rocess +by using 'x-colo-lost-heartbeat' command. + +COLO operation status +^^^^^^^^^^^^^^^^^^^^^ + +Overview:: + + +-----------------+ + | | + | Start COLO | + | | + +--------+--------+ + | + | Main qmp command: + | migrate-set-capabilities with x-colo + | migrate + | + v + +--------+--------+ + | | + | COLO running | + | | + +--------+--------+ + | + | Main qmp command: + | x-colo-lost-heartbeat + | or + | some error happened + v + +--------+--------+ + | | send qmp event: + | COLO failover | COLO_EXIT + | | + +-----------------+ + + +COLO use the qmp command to switch and report operation status. +The diagram just shows the main qmp command, you can get the detail +in test procedure. + +Test procedure +-------------- +Note: Here we are running both instances on the same host for testing, +change the IP Addresses if you want to run it on two hosts. Initially +``127.0.0.1`` is the Primary Host and ``127.0.0.2`` is the Secondary Host= . + +Startup qemu +^^^^^^^^^^^^ +**1. Primary**: +Note: Initially, ``$imagefolder/primary.qcow2`` needs to be copied to all= hosts. +You don't need to change any IP's here, because ``0.0.0.0`` listens on an= y +interface. The chardev's with ``127.0.0.1`` IP's loopback to the local qe= mu +instance:: + + # imagefolder=3D"/mnt/vms/colo-test-primary" + + # qemu-system-x86_64 -enable-kvm -cpu qemu64,kvmclock=3Don -m 512 -sm= p 1 -qmp stdio \ + -device piix3-usb-uhci -device usb-tablet -name primary \ + -netdev tap,id=3Dhn0,vhost=3Doff,helper=3D/usr/lib/qemu/qemu-bridg= e-helper \ + -device rtl8139,id=3De0,netdev=3Dhn0 \ + -chardev socket,id=3Dmirror0,host=3D0.0.0.0,port=3D9003,server=3Do= n,wait=3Doff \ + -chardev socket,id=3Dcompare1,host=3D0.0.0.0,port=3D9004,server=3D= on,wait=3Don \ + -chardev socket,id=3Dcompare0,host=3D127.0.0.1,port=3D9001,server= =3Don,wait=3Doff \ + -chardev socket,id=3Dcompare0-0,host=3D127.0.0.1,port=3D9001 \ + -chardev socket,id=3Dcompare_out,host=3D127.0.0.1,port=3D9005,serv= er=3Don,wait=3Doff \ + -chardev socket,id=3Dcompare_out0,host=3D127.0.0.1,port=3D9005 \ + -object filter-mirror,id=3Dm0,netdev=3Dhn0,queue=3Dtx,outdev=3Dmir= ror0 \ + -object filter-redirector,netdev=3Dhn0,id=3Dredire0,queue=3Drx,ind= ev=3Dcompare_out \ + -object filter-redirector,netdev=3Dhn0,id=3Dredire1,queue=3Drx,out= dev=3Dcompare0 \ + -object iothread,id=3Diothread1 \ + -object colo-compare,id=3Dcomp0,primary_in=3Dcompare0-0,secondary_= in=3Dcompare1,\ + outdev=3Dcompare_out0,iothread=3Diothread1 \ + -drive if=3Dide,id=3Dcolo-disk0,driver=3Dquorum,read-pattern=3Dfif= o,vote-threshold=3D1,\ + children.0.file.filename=3D$imagefolder/primary.qcow2,children.0.driv= er=3Dqcow2 -S + + +**2. Secondary**: +Note: Active and hidden images need to be created only once and the +size should be the same as ``primary.qcow2``. Again, you don't need to ch= ange +any IP's here, except for the ``$primary_ip`` variable:: + + # imagefolder=3D"/mnt/vms/colo-test-secondary" + # primary_ip=3D127.0.0.1 + + # qemu-img create -f qcow2 $imagefolder/secondary-active.qcow2 10G + + # qemu-img create -f qcow2 $imagefolder/secondary-hidden.qcow2 10G + + # qemu-system-x86_64 -enable-kvm -cpu qemu64,kvmclock=3Don -m 512 -sm= p 1 -qmp stdio \ + -device piix3-usb-uhci -device usb-tablet -name secondary \ + -netdev tap,id=3Dhn0,vhost=3Doff,helper=3D/usr/lib/qemu/qemu-bridg= e-helper \ + -device rtl8139,id=3De0,netdev=3Dhn0 \ + -chardev socket,id=3Dred0,host=3D$primary_ip,port=3D9003,reconnect= -ms=3D1000 \ + -chardev socket,id=3Dred1,host=3D$primary_ip,port=3D9004,reconnect= -ms=3D1000 \ + -object filter-redirector,id=3Df1,netdev=3Dhn0,queue=3Dtx,indev=3D= red0 \ + -object filter-redirector,id=3Df2,netdev=3Dhn0,queue=3Drx,outdev= =3Dred1 \ + -object filter-rewriter,id=3Drew0,netdev=3Dhn0,queue=3Dall \ + -drive if=3Dnone,id=3Dparent0,file.filename=3D$imagefolder/primary= .qcow2,driver=3Dqcow2 \ + -drive if=3Dnone,id=3Dchilds0,driver=3Dreplication,mode=3Dsecondar= y,file.driver=3Dqcow2,\ + top-id=3Dcolo-disk0,file.file.filename=3D$imagefolder/secondary-activ= e.qcow2,\ + file.backing.driver=3Dqcow2,file.backing.file.filename=3D$imagefolder= /secondary-hidden.qcow2,\ + file.backing.backing=3Dparent0 \ + -drive if=3Dide,id=3Dcolo-disk0,driver=3Dquorum,read-pattern=3Dfif= o,vote-threshold=3D1,\ + children.0=3Dchilds0 \ + -incoming tcp:0.0.0.0:9998 + + +**3.** On Secondary VM's QEMU monitor, issue command:: + + {"execute":"qmp_capabilities"} + {"execute": "migrate-set-capabilities", "arguments": {"capabilities":= [ {"capability": "x-colo", "state": true } ] } } + {"execute": "nbd-server-start", "arguments": {"addr": {"type": "inet"= , "data": {"host": "0.0.0.0", "port": "9999"} } } } + {"execute": "nbd-server-add", "arguments": {"device": "parent0", "wri= table": true } } + +Note: + a. The qmp command ``nbd-server-start`` and ``nbd-server-add`` must be = run + before running the qmp command migrate on primary QEMU + b. Active disk, hidden disk and nbd target's length should be the + same. + c. It is better to put active disk and hidden disk in ramdisk. They + will be merged into the parent disk on failover. + +**4.** On Primary VM's QEMU monitor, issue command:: + + {"execute":"qmp_capabilities"} + {"execute": "human-monitor-command", "arguments": {"command-line": "d= rive_add -n buddy driver=3Dreplication,mode=3Dprimary,file.driver=3Dnbd,fi= le.host=3D127.0.0.2,file.port=3D9999,file.export=3Dparent0,node-name=3Drep= lication0"}} + {"execute": "x-blockdev-change", "arguments":{"parent": "colo-disk0",= "node": "replication0" } } + {"execute": "migrate-set-capabilities", "arguments": {"capabilities":= [ {"capability": "x-colo", "state": true } ] } } + {"execute": "migrate", "arguments": {"uri": "tcp:127.0.0.2:9998" } } + +Note: + a. There should be only one NBD Client for each primary disk. + b. The qmp command line must be run after running qmp command line in + secondary qemu. + +**5.** After the above steps, you will see, whenever you make changes to = PVM, SVM will be synced. +You can issue command ``{ "execute": "migrate-set-parameters" , "argument= s":{ "x-checkpoint-delay": 2000 } }`` +to change the idle checkpoint period time + +Failover test +^^^^^^^^^^^^^ +You can kill one of the VMs and Failover on the surviving VM: + +If you killed the Secondary, then follow "Primary Failover". +After that, if you want to resume the replication, follow "Primary resume= replication" + +If you killed the Primary, then follow "Secondary Failover". +After that, if you want to resume the replication, follow "Secondary resu= me replication" + +Primary Failover +~~~~~~~~~~~~~~~~ +The Secondary died, resume on the Primary:: + + {"execute": "x-blockdev-change", "arguments":{ "parent": "colo-disk0"= , "child": "children.1"} } + {"execute": "human-monitor-command", "arguments":{ "command-line": "d= rive_del replication0" } } + {"execute": "object-del", "arguments":{ "id": "comp0" } } + {"execute": "object-del", "arguments":{ "id": "iothread1" } } + {"execute": "object-del", "arguments":{ "id": "m0" } } + {"execute": "object-del", "arguments":{ "id": "redire0" } } + {"execute": "object-del", "arguments":{ "id": "redire1" } } + {"execute": "x-colo-lost-heartbeat" } + +Secondary Failover +~~~~~~~~~~~~~~~~~~ +The Primary died, resume on the Secondary and prepare to become the new P= rimary:: + + {"execute": "nbd-server-stop"} + {"execute": "x-colo-lost-heartbeat"} + + {"execute": "object-del", "arguments":{ "id": "f2" } } + {"execute": "object-del", "arguments":{ "id": "f1" } } + {"execute": "chardev-remove", "arguments":{ "id": "red1" } } + {"execute": "chardev-remove", "arguments":{ "id": "red0" } } + + {"execute": "chardev-add", "arguments":{ "id": "mirror0", "backend": = {"type": "socket", "data": {"addr": { "type": "inet", "data": { "host": "0= .0.0.0", "port": "9003" } }, "server": true } } } } + {"execute": "chardev-add", "arguments":{ "id": "compare1", "backend":= {"type": "socket", "data": {"addr": { "type": "inet", "data": { "host": "= 0.0.0.0", "port": "9004" } }, "server": true } } } } + {"execute": "chardev-add", "arguments":{ "id": "compare0", "backend":= {"type": "socket", "data": {"addr": { "type": "inet", "data": { "host": "= 127.0.0.1", "port": "9001" } }, "server": true } } } } + {"execute": "chardev-add", "arguments":{ "id": "compare0-0", "backend= ": {"type": "socket", "data": {"addr": { "type": "inet", "data": { "host":= "127.0.0.1", "port": "9001" } }, "server": false } } } } + {"execute": "chardev-add", "arguments":{ "id": "compare_out", "backen= d": {"type": "socket", "data": {"addr": { "type": "inet", "data": { "host"= : "127.0.0.1", "port": "9005" } }, "server": true } } } } + {"execute": "chardev-add", "arguments":{ "id": "compare_out0", "backe= nd": {"type": "socket", "data": {"addr": { "type": "inet", "data": { "host= ": "127.0.0.1", "port": "9005" } }, "server": false } } } } + +Primary resume replication +~~~~~~~~~~~~~~~~~~~~~~~~~~ +Resume replication after new Secondary is up. + +Start the new Secondary (Steps 2 and 3 above), then on the Primary:: + + {"execute": "drive-mirror", "arguments":{ "device": "colo-disk0", "jo= b-id": "resync", "target": "nbd://127.0.0.2:9999/parent0", "mode": "existi= ng", "format": "raw", "sync": "full"} } + +Wait until disk is synced, then:: + + {"execute": "stop"} + {"execute": "block-job-cancel", "arguments":{ "device": "resync"} } + + {"execute": "human-monitor-command", "arguments":{ "command-line": "d= rive_add -n buddy driver=3Dreplication,mode=3Dprimary,file.driver=3Dnbd,fi= le.host=3D127.0.0.2,file.port=3D9999,file.export=3Dparent0,node-name=3Drep= lication0"}} + {"execute": "x-blockdev-change", "arguments":{ "parent": "colo-disk0"= , "node": "replication0" } } + + {"execute": "object-add", "arguments":{ "qom-type": "filter-mirror", = "id": "m0", "netdev": "hn0", "queue": "tx", "outdev": "mirror0" } } + {"execute": "object-add", "arguments":{ "qom-type": "filter-redirecto= r", "id": "redire0", "netdev": "hn0", "queue": "rx", "indev": "compare_out= " } } + {"execute": "object-add", "arguments":{ "qom-type": "filter-redirecto= r", "id": "redire1", "netdev": "hn0", "queue": "rx", "outdev": "compare0" = } } + {"execute": "object-add", "arguments":{ "qom-type": "iothread", "id":= "iothread1" } } + {"execute": "object-add", "arguments":{ "qom-type": "colo-compare", "= id": "comp0", "primary_in": "compare0-0", "secondary_in": "compare1", "out= dev": "compare_out0", "iothread": "iothread1" } } + + {"execute": "migrate-set-capabilities", "arguments":{ "capabilities":= [ {"capability": "x-colo", "state": true } ] } } + {"execute": "migrate", "arguments":{ "uri": "tcp:127.0.0.2:9998" } } + +Note: +If this Primary previously was a Secondary, then we need to insert the +filters before the filter-rewriter by using the +""insert": "before", "position": "id=3Drew0"" Options. See below. + +Secondary resume replication +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Become Primary and resume replication after new Secondary is up. Note +that now 127.0.0.1 is the Secondary and 127.0.0.2 is the Primary. + +Start the new Secondary (Steps 2 and 3 above, but with primary_ip=3D127.0= .0.2), +then on the old Secondary:: + + {"execute": "drive-mirror", "arguments":{ "device": "colo-disk0", "jo= b-id": "resync", "target": "nbd://127.0.0.1:9999/parent0", "mode": "existi= ng", "format": "raw", "sync": "full"} } + +Wait until disk is synced, then:: + + {"execute": "stop"} + {"execute": "block-job-cancel", "arguments":{ "device": "resync" } } + + {"execute": "human-monitor-command", "arguments":{ "command-line": "d= rive_add -n buddy driver=3Dreplication,mode=3Dprimary,file.driver=3Dnbd,fi= le.host=3D127.0.0.1,file.port=3D9999,file.export=3Dparent0,node-name=3Drep= lication0"}} + {"execute": "x-blockdev-change", "arguments":{ "parent": "colo-disk0"= , "node": "replication0" } } + + {"execute": "object-add", "arguments":{ "qom-type": "filter-mirror", = "id": "m0", "insert": "before", "position": "id=3Drew0", "netdev": "hn0", = "queue": "tx", "outdev": "mirror0" } } + {"execute": "object-add", "arguments":{ "qom-type": "filter-redirecto= r", "id": "redire0", "insert": "before", "position": "id=3Drew0", "netdev"= : "hn0", "queue": "rx", "indev": "compare_out" } } + {"execute": "object-add", "arguments":{ "qom-type": "filter-redirecto= r", "id": "redire1", "insert": "before", "position": "id=3Drew0", "netdev"= : "hn0", "queue": "rx", "outdev": "compare0" } } + {"execute": "object-add", "arguments":{ "qom-type": "iothread", "id":= "iothread1" } } + {"execute": "object-add", "arguments":{ "qom-type": "colo-compare", "= id": "comp0", "primary_in": "compare0-0", "secondary_in": "compare1", "out= dev": "compare_out0", "iothread": "iothread1" } } + + {"execute": "migrate-set-capabilities", "arguments":{ "capabilities":= [ {"capability": "x-colo", "state": true } ] } } + {"execute": "migrate", "arguments":{ "uri": "tcp:127.0.0.1:9998" } } + +TODO +---- +1. Support shared storage. +2. Develop the heartbeat part. +3. Reduce checkpoint VM=E2=80=99s downtime while doing checkpoint. =2D-=20 2.39.5