From nobody Sun May 5 00:47:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1565815957; cv=none; d=zoho.com; s=zohoarc; b=bLaTfcofd7ZNHHoW5FE9qTbOQUd4+3Ac+t69ZFWe7ev9bceRluaUSKhGD+Spk4njHpkP8s6z+dxolJsllGMMkqcNxebsQpXZXaAp7EtOCAlGWLn2JW5iixgg9XzhKaba3IUTTvGvOM1/XjrwA5NopmF7Lgj8xrycXE9PRENfGcw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565815957; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=jS5doMNihDBgaxpKbpNBT7nULM/+BY2qZMF5euARK+A=; b=N6YKZH6XYVlGayrh/xeKr8xhgpmtWRoySzprVem6D2EAijFxIlwssKM0uI0/h+3ARp1aCSvvS2FjZhxUFe5y0UHLFKgPtbXT4KbVv2L3+SZZ2RnHVE1TqiyyEksr5oKnOaiwacSh/H+7AVlKu+71yvQq+SfG6Rba3JU+THILn+0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565815957868931.9382078371558; Wed, 14 Aug 2019 13:52:37 -0700 (PDT) Received: from localhost ([::1]:36004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hy0Fy-0002fE-2c for importer@patchew.org; Wed, 14 Aug 2019 16:52:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37991) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hy0CZ-00016a-NU for qemu-devel@nongnu.org; Wed, 14 Aug 2019 16:49:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hy0CY-0001Av-Jb for qemu-devel@nongnu.org; Wed, 14 Aug 2019 16:48:59 -0400 Received: from mout.web.de ([212.227.17.11]:33221) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hy0CY-00017U-An for qemu-devel@nongnu.org; Wed, 14 Aug 2019 16:48:58 -0400 Received: from luklap ([87.123.206.175]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MT8o6-1hoYHc3K0k-00S41t; Wed, 14 Aug 2019 22:48:42 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1565815723; bh=NYGEs+J8dG1k1ZGIA2w7kyoxLQCzkxirRfKD/rQess0=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=JwLaA09NWVkUmUrEaGVVaPSF13A82g1POwUGyC8f+VTAcjd27IxpGTtzaDlKeobJj NkGx1viQ7e6p3SZ9jOFE29eV3yr9PTj1//adUKfhvOJkb8EQVjqPugwXvophzVPR9r ILM/CMGzUnnjPUI/ffrRJr+Rh8SdGN69Axtg0nGQ= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Date: Wed, 14 Aug 2019 22:47:17 +0200 From: Lukas Straub To: "Zhang, Chen" Message-ID: <1e29ed41743ddf581636ccee0e899c0f3f4680b7.1565814686.git.lukasstraub2@web.de> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:pqV6qcrevMy+2gvPNMCF/JfEBY+yHtBWer17I1UXxJ10p1tsXrq CqD/GJ+ufVnihK8XgtdUcUVBi9ZWfn1YStGVnG5ScIibvJ9cETNkOp4ShM4K/q1Id0Wiw7N lrUAZ9kQRHNk+CLFrLoNom8T7P1/drpUPlSXxu2Z4fsMCukWoxdc5lamb2b8nJiTJFpQwKl qBDvk/OcXLQryV041+V9w== X-UI-Out-Filterresults: notjunk:1;V03:K0:mM1a7lEkimw=:csnNyDNmmXEQgA2s3Ij+1s 5Cw8/cZdRVe6BJ+6STa07bSyT8BWenT8I3IhfWrP3hDbbIqE40+17NPyv8g01w5eN4KbgOqJx 3jJnDuZooi4R8edT7GABbZ6e4GuTqB22qaFDDhwUn/+tFZGtC1eHP7CjHKv4ncbw0fVu0pdjB g965im6WnbfF48QFyjtnpYeNQ1fDM5qFbeJ/A2E6YdT1yJMCUqszw/zeb2lnsE2buwy/A6UiT ly0eML7ngWzwP/A7GY8IjJ1n+uk41ZXzFZGGBBV66lT2G+zY9bH+Ud7T5+SYRGhAUSRc8+bxA WkOoSbjVUapxzk/Di0zP9H5A58BpwVOiyo3rIoIdFViMKD9gfHQTc7YkEmrTR6x7tVuWIMDDM 2m4D5SsECXhYpDodPJmSlQ+t0AeH24gMGG+aHGoCECY35lhUN4zN6CewJ/rd8SAIZUwZwtxm/ v6cMpFHXQpjqHdy2nfmLSYu8Tja9vsZQYwCgnSl52O2Uz4il4LLPqWPkRH1CQ4wg4+yBRLNMq 7R7f49INqjW/CHPaxGhZATCsbht24AbbDty6GKc6eWOkKGbnubNv5UO7G8+Vgx8M4q+bp4iUW Hdx/ND02TKsv7bN/0sYz8P0oT3I0TM96HDY4TBpFeah2UClKNwIvRlBvN3KxH4OP+EpmdX/KW HIBv/+yh6EGBqD+35d/QgDwrWz/hx4rx4HusmczxY2kBuIiz+3Nt/jT2XFSVEDvhQfalSnvvQ dBECAiA4jtPto2AyoEYBLqqTu+o+Qei/9f6mqEjvJTd56KbsnriMlurgdgl35HeisOMLRhO5R e6MX+aPGeH0LoSAOkRnHI6TA9Q/F1xS8H10KYrOqIsJ98O194cUXoNvac5jIU2+qgSt43YLQo Nmfq7vJIqmrHziPlAfADI3SXCEse4MgjnWgYB0hvr9OLsFsLrOwq55WyjQW+e6x7cO0xBrOaW TP5qa6zMmH6x3ejCZmPXXShT2KEoMByJlmj3TIybm9+Fu6PlS+MAISfj6XTW5dY0MwXb9bWhu s+QovgOM9mBa4y9JUB1xdWBC5hjf0vc4HZ0K2IxCPCxFOUYPDgyrHeWNGMCOlz5QPwF9wVBIk WX/ABqiYNxHWCOZk9QR+oeT8m48qPqT5gehQIhjb31Jf2UXT76MM1vcJuD9Lq7lO0T8oheuKU p3qN7Chd0ERtldw21s8eNk7AT9v0W1gG9kriE69Xt1NX34fg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.11 Subject: [Qemu-devel] [PATCH 1/3] Replication: Ignore requests after failover X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" After failover, the Secondary side of replication shouldn't change state. Add the necessary checks to ignore requests after failover. Signed-off-by: Lukas Straub --- block/replication.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/block/replication.c b/block/replication.c index 3d4dedddfc..466d463963 100644 --- a/block/replication.c +++ b/block/replication.c @@ -454,6 +454,14 @@ static void replication_start(ReplicationState *rs, Re= plicationMode mode, aio_context_acquire(aio_context); s =3D bs->opaque; + if (s->stage =3D=3D BLOCK_REPLICATION_DONE || s->stage =3D=3D BLOCK_RE= PLICATION_FAILOVER) { + /* This case happens when a secondary is promoted to primary. + * Ignore the request because the secondary side of replication + * doesn't have to do anything anymore. */ + aio_context_release(aio_context); + return; + } + if (s->stage !=3D BLOCK_REPLICATION_NONE) { error_setg(errp, "Block replication is running or done"); aio_context_release(aio_context); @@ -529,8 +537,7 @@ static void replication_start(ReplicationState *rs, Rep= licationMode mode, "Block device is in use by internal backup job"); top_bs =3D bdrv_lookup_bs(s->top_id, s->top_id, NULL); - if (!top_bs || !bdrv_is_root_node(top_bs) || - !check_top_bs(top_bs, bs)) { + if (!top_bs || !check_top_bs(top_bs, bs)) { error_setg(errp, "No top_bs or it is invalid"); reopen_backing_file(bs, false, NULL); aio_context_release(aio_context); @@ -577,6 +584,14 @@ static void replication_do_checkpoint(ReplicationState= *rs, Error **errp) aio_context_acquire(aio_context); s =3D bs->opaque; + if (s->stage =3D=3D BLOCK_REPLICATION_DONE || s->stage =3D=3D BLOCK_RE= PLICATION_FAILOVER) { + /* This case happens when a secondary was promoted to primary. + * Ignore the request because the secondary side of replication + * doesn't have to do anything anymore. */ + aio_context_release(aio_context); + return; + } + if (s->mode =3D=3D REPLICATION_MODE_SECONDARY) { secondary_do_checkpoint(s, errp); } @@ -592,8 +607,8 @@ static void replication_get_error(ReplicationState *rs,= Error **errp) aio_context =3D bdrv_get_aio_context(bs); aio_context_acquire(aio_context); s =3D bs->opaque; - - if (s->stage !=3D BLOCK_REPLICATION_RUNNING) { + + if (s->stage =3D=3D BLOCK_REPLICATION_NONE) { error_setg(errp, "Block replication is not running"); aio_context_release(aio_context); return; @@ -635,6 +650,14 @@ static void replication_stop(ReplicationState *rs, boo= l failover, Error **errp) aio_context_acquire(aio_context); s =3D bs->opaque; + if (s->stage =3D=3D BLOCK_REPLICATION_DONE || s->stage =3D=3D BLOCK_RE= PLICATION_FAILOVER) { + /* This case happens when a secondary was promoted to primary. + * Ignore the request because the secondary side of replication + * doesn't have to do anything anymore. */ + aio_context_release(aio_context); + return; + } + if (s->stage !=3D BLOCK_REPLICATION_RUNNING) { error_setg(errp, "Block replication is not running"); aio_context_release(aio_context); -- 2.20.1 From nobody Sun May 5 00:47:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1565815954; cv=none; d=zoho.com; s=zohoarc; b=D2G7CC7yXqMEAGmSARLlWdpZwPv0CdV+o5YOD2al6/6PursoPgM0+rMUFBGLcU0KeuD+xKiZszTlujIqMqkuDcPkBPuneaGl6Xwm5GzF1n97sRAKiCa2EgQl9PYXqz9FY01C+yw96p5WXFFmLAfvVMvutGiTIJjfBqx0zXl9Mvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565815954; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=GtzWbJrcAcpDO4o01lJ9p3EGisJUY4jm5AWry6w+FxM=; b=m5scc10pqa2DkaMuqHhPzzOYqfzywovsNHXrQOiSsBrnky2nDUmA6ZpMbXkXitUfaIdF3uW6LVs+4LNrRzChKa+6UP7Tj0YBU20mZ6GtItyyCba7ZzH7KGu4PVE2iW5EeHQHyTe0Zgdra4MQPZSodZUnEqFyFP9RPQSOSABDBak= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565815954187720.563351132006; Wed, 14 Aug 2019 13:52:34 -0700 (PDT) Received: from localhost ([::1]:36002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hy0Fw-0002fC-5M for importer@patchew.org; Wed, 14 Aug 2019 16:52:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37985) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hy0CZ-00016Y-EL for qemu-devel@nongnu.org; Wed, 14 Aug 2019 16:49:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hy0CX-00019q-LQ for qemu-devel@nongnu.org; Wed, 14 Aug 2019 16:48:59 -0400 Received: from mout.web.de ([217.72.192.78]:42157) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hy0CX-00017D-8j for qemu-devel@nongnu.org; Wed, 14 Aug 2019 16:48:57 -0400 Received: from luklap ([87.123.206.175]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M8R26-1iBnh80BVa-00vwjB; Wed, 14 Aug 2019 22:48:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1565815724; bh=V0jdTgZU0cNH7q4hoVZw9POPgAa3Lct0vBllFQblJL4=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=VzxttoTI73BoPcuQiPiY/sszESy5PBST6+d4eX2RdWEY9Ly8u3B6sQGU0eCqJ7aBT yoGoMVM8ncpwkRCr7zWKAOttCCH+E6lyC54cfVbxaMcoFBjbNzDerYCL/hSCQEPauZ slmKD8f4dv41B4oSwaBN5ijALwbO/NUqcjHyeDNk= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Date: Wed, 14 Aug 2019 22:47:32 +0200 From: Lukas Straub To: "Zhang, Chen" Message-ID: <390c048392b2db51cde1aaca8c5acdd8f3836336.1565814686.git.lukasstraub2@web.de> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:5SG06vCY+BIvDW2D/283vewMoK0ViJgDJjvH5KR3BmcEfoZil3v +bJTT3idKr2VeizE5jaIVmHb83UGM7bb0/RHHQdsJMgA5sc9CDcPl7RNnekBxYeceF33P/Y YpcpgAZ5e8EmNKbN3b8tcdeP7VqTISQ47qPChewNmdZrLE/8A4ljfF4kSeZaUa5iDwbU1Yy wn6wZsYHaouDmZgsdpt8g== X-UI-Out-Filterresults: notjunk:1;V03:K0:k2baprNzNFU=:n+s0jMv1YhitfKEQzeL6h0 q9SLFOdsN5byyjPMVFmUHMGldIMwnC3E9TXt6IO1lQBHojPuMmtMHgVMnALRefU+P8RJT0tIL ujkBUfVitH3jfkrO+YPdzMtIB/KO51bAxXdTp9F6RT/oOGuckHXU5uoFWBjGXokC97utq5oz1 Yi9ZeZScBIyb8JNWKpOrOF6ak4J/1j3D+KnmE6T6qE9XcUULAO7CnqPF2DtyaGLa+LwhF5Xue dJpKgZ3iDF6SFTHOBTiQXOdnqiStUO+K7twiEeUSgsCbwQT9hx92ue2Kjr39jJoFNbQLwIroz 7TvYmPfht94B/sWk6AZ0ag1IlIEVm2o2Tnm2xeqFTNRShq1KUzN1wPVNo/XJAHsOlz5JE4OeM 02IlHGMtw7NhObp/Zo9vFlrQtw2+KCbbcKwhPwNrWNA4ief136rzVolPzhKUB+IhY6EmN0/wc +yfpKi8FMclthkF5o8jS7xv+zzF8oRUTMdA0Rl/kabaKb30p5koqZTErSxgS0IWdMHP1covY1 HvLlAi1VW35luzSKqjl8b8pIHdgxJlRRyk3qfKbp1CZ5mwUXI5e3Yakaa6Zu3NMRJN+AH+sbt zniabJfazgTKaBN68i/23R/htyNWdJMIwi9B59iA1gxd+pqbGBQvT4aJf7EGpLEH01VjP9ubD OHy0qm5QnccEtkCJ4wD808uR+zLBa8Qjg83K8AY+RCSflBdtsDptYOSTkDng0J8GqT0kj5hkL GnfZ6H+0KAUwG0SwXP1ubE/CaBH/DjmlRA40pAM+8kSIijG7sy5Ih8qMX4azqHs9VmyCLjL2h CCAw3KmfENhfKTMorL2KbQAcOVlCURK7PiG/+A5RIa7UKrh8YNUYL/owiAdDlWjZw63Dvc0MQ nl/nI8WWWjCrrQzYK3xKI9s6PzmZREAM6zftzniJVxDo2pqBEbDuQf6hLkwUZugZdPvh7GJon 4cKA3jAijBx5Wb50FKgPjZWhMoSN25Z5HuQVrfFsFp/d9oLZt90YhCTRBNo75N6MQOhyZAOM0 s3PNWKjpg5lXE80SjtpN9m1AiD05XiQzSnrB22kBIL+hk4+zxzWZZNNeoJ1t4/znbqhEmA+gm yS47xHIUBboAFdl2cwuJDrexuxjIdqApfiEW8oNWI2LmKMbr8RpZJbDiRcxvvvDJYzRWWTlDk 9zDqQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.78 Subject: [Qemu-devel] [PATCH 2/3] net/filter.c: Add Options to insert filters anywhere in the filter list X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" To switch the Secondary to Primary, we need to insert new filters before the filter-rewriter. Add the necessary options to insert filters anywhere in the filter list. Signed-off-by: Lukas Straub --- include/net/filter.h | 2 ++ net/filter.c | 73 ++++++++++++++++++++++++++++++++++++++++++-- qemu-options.hx | 10 +++--- 3 files changed, 78 insertions(+), 7 deletions(-) diff --git a/include/net/filter.h b/include/net/filter.h index 49da666ac0..355c178f75 100644 --- a/include/net/filter.h +++ b/include/net/filter.h @@ -62,6 +62,8 @@ struct NetFilterState { NetClientState *netdev; NetFilterDirection direction; bool on; + char *position; + bool insert_before; QTAILQ_ENTRY(NetFilterState) next; }; diff --git a/net/filter.c b/net/filter.c index 28d1930db7..1058100b83 100644 --- a/net/filter.c +++ b/net/filter.c @@ -171,11 +171,47 @@ static void netfilter_set_status(Object *obj, const c= har *str, Error **errp) } } +static char *netfilter_get_position(Object *obj, Error **errp) +{ + NetFilterState *nf =3D NETFILTER(obj); + + return g_strdup(nf->position); +} + +static void netfilter_set_position(Object *obj, const char *str, Error **e= rrp) +{ + NetFilterState *nf =3D NETFILTER(obj); + + nf->position =3D g_strdup(str); +} + +static char *netfilter_get_insert(Object *obj, Error **errp) +{ + NetFilterState *nf =3D NETFILTER(obj); + + return nf->insert_before ? g_strdup("before") : g_strdup("after"); +} + +static void netfilter_set_insert(Object *obj, const char *str, Error **err= p) +{ + NetFilterState *nf =3D NETFILTER(obj); + + if (strcmp(str, "before") && strcmp(str, "after")) { + error_setg(errp, "Invalid value for netfilter insert, " + "should be 'head' or 'tail'"); + return; + } + + nf->insert_before =3D !strcmp(str, "before"); +} + static void netfilter_init(Object *obj) { NetFilterState *nf =3D NETFILTER(obj); nf->on =3D true; + nf->insert_before =3D false; + nf->position =3D g_strdup("tail"); object_property_add_str(obj, "netdev", netfilter_get_netdev_id, netfilter_set_netdev_= id, @@ -187,16 +223,23 @@ static void netfilter_init(Object *obj) object_property_add_str(obj, "status", netfilter_get_status, netfilter_set_status, NULL); + object_property_add_str(obj, "position", + netfilter_get_position, netfilter_set_position, + NULL); + object_property_add_str(obj, "insert", + netfilter_get_insert, netfilter_set_insert, + NULL); } static void netfilter_complete(UserCreatable *uc, Error **errp) { NetFilterState *nf =3D NETFILTER(uc); + NetFilterState *position; NetClientState *ncs[MAX_QUEUE_NUM]; NetFilterClass *nfc =3D NETFILTER_GET_CLASS(uc); int queues; Error *local_err =3D NULL; - + if (!nf->netdev_id) { error_setg(errp, "Parameter 'netdev' is required"); return; @@ -219,6 +262,20 @@ static void netfilter_complete(UserCreatable *uc, Erro= r **errp) return; } + if (strcmp(nf->position, "head") && strcmp(nf->position, "tail")) { + /* Search for the position to insert before/after */ + Object *container; + Object *obj; + + container =3D object_get_objects_root(); + obj =3D object_resolve_path_component(container, nf->position); + if (!obj) { + error_setg(errp, "filter '%s' not found", nf->position); + return; + } + position =3D NETFILTER(obj); + } + nf->netdev =3D ncs[0]; if (nfc->setup) { @@ -228,7 +285,18 @@ static void netfilter_complete(UserCreatable *uc, Erro= r **errp) return; } } - QTAILQ_INSERT_TAIL(&nf->netdev->filters, nf, next); + + if (!strcmp(nf->position, "head")) { + QTAILQ_INSERT_HEAD(&nf->netdev->filters, nf, next); + } else if (!strcmp(nf->position, "tail")) { + QTAILQ_INSERT_TAIL(&nf->netdev->filters, nf, next); + } else { + if (nf->insert_before) { + QTAILQ_INSERT_BEFORE(position, nf, next); + } else { + QTAILQ_INSERT_AFTER(&nf->netdev->filters, position, nf, next); + } + } } static void netfilter_finalize(Object *obj) @@ -245,6 +313,7 @@ static void netfilter_finalize(Object *obj) QTAILQ_REMOVE(&nf->netdev->filters, nf, next); } g_free(nf->netdev_id); + g_free(nf->position); } static void default_handle_event(NetFilterState *nf, int event, Error **er= rp) diff --git a/qemu-options.hx b/qemu-options.hx index 08749a3391..f0a47a0746 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4368,7 +4368,7 @@ applications, they can do this through this parameter= . Its format is a gnutls priority string as described at @url{https://gnutls.org/manual/html_node/Priority-Strings.html}. -@item -object filter-buffer,id=3D@var{id},netdev=3D@var{netdevid},interval= =3D@var{t}[,queue=3D@var{all|rx|tx}][,status=3D@var{on|off}] +@item -object filter-buffer,id=3D@var{id},netdev=3D@var{netdevid},interval= =3D@var{t}[,queue=3D@var{all|rx|tx}][,status=3D@var{on|off}][,position=3D@v= ar{head|tail|id}][,insert=3D@var{after|before}] Interval @var{t} can't be 0, this filter batches the packet delivery: all packets arriving in a given interval on netdev @var{netdevid} are delayed @@ -4387,11 +4387,11 @@ queue @var{all|rx|tx} is an option that can be appl= ied to any netfilter. @option{tx}: the filter is attached to the transmit queue of the netdev, where it will receive packets sent by the netdev. -@item -object filter-mirror,id=3D@var{id},netdev=3D@var{netdevid},outdev= =3D@var{chardevid},queue=3D@var{all|rx|tx}[,vnet_hdr_support] +@item -object filter-mirror,id=3D@var{id},netdev=3D@var{netdevid},outdev= =3D@var{chardevid},queue=3D@var{all|rx|tx}[,vnet_hdr_support][,position=3D@= var{head|tail|id}][,insert=3D@var{after|before}] filter-mirror on netdev @var{netdevid},mirror net packet to chardev@var{ch= ardevid}, if it has the vnet_hdr_support flag, filter-mirror will mirror pa= cket with vnet_hdr_len. -@item -object filter-redirector,id=3D@var{id},netdev=3D@var{netdevid},inde= v=3D@var{chardevid},outdev=3D@var{chardevid},queue=3D@var{all|rx|tx}[,vnet_= hdr_support] +@item -object filter-redirector,id=3D@var{id},netdev=3D@var{netdevid},inde= v=3D@var{chardevid},outdev=3D@var{chardevid},queue=3D@var{all|rx|tx}[,vnet_= hdr_support][,position=3D@var{head|tail|id}][,insert=3D@var{after|before}] filter-redirector on netdev @var{netdevid},redirect filter's net packet to= chardev @var{chardevid},and redirect indev's packet to filter.if it has the vnet_h= dr_support flag, @@ -4400,7 +4400,7 @@ Create a filter-redirector we need to differ outdev i= d from indev id, id can not be the same. we can just use indev or outdev, but at least one of indev or= outdev need to be specified. -@item -object filter-rewriter,id=3D@var{id},netdev=3D@var{netdevid},queue= =3D@var{all|rx|tx},[vnet_hdr_support] +@item -object filter-rewriter,id=3D@var{id},netdev=3D@var{netdevid},queue= =3D@var{all|rx|tx},[vnet_hdr_support][,position=3D@var{head|tail|id}][,inse= rt=3D@var{after|before}] Filter-rewriter is a part of COLO project.It will rewrite tcp packet to secondary from primary to keep secondary tcp connection,and rewrite @@ -4413,7 +4413,7 @@ colo secondary: -object filter-redirector,id=3Df2,netdev=3Dhn0,queue=3Drx,outdev=3Dred1 -object filter-rewriter,id=3Drew0,netdev=3Dhn0,queue=3Dall -@item -object filter-dump,id=3D@var{id},netdev=3D@var{dev}[,file=3D@var{fi= lename}][,maxlen=3D@var{len}] +@item -object filter-dump,id=3D@var{id},netdev=3D@var{dev}[,file=3D@var{fi= lename}][,maxlen=3D@var{len}][,position=3D@var{head|tail|id}][,insert=3D@va= r{after|before}] Dump the network traffic on netdev @var{dev} to the file specified by @var{filename}. At most @var{len} bytes (64k by default) per packet are st= ored. -- 2.20.1 From nobody Sun May 5 00:47:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1565816248; cv=none; d=zoho.com; s=zohoarc; b=ZK2xAPeOrGTWHfOsemdZql4E8OkhZIYOUBUdlZqhFjWv2+S4Blzt4N9PLl0xzv7ROkxFoGy+RoduT0oeKRbc0a4kqYlp5T/qJtA21rzc+lVGhfHnMIJJ1+/6a3FlhPDe/HY96Z1c1TlE5X4vOoHzG5gVio2xokbUMWfEeclFb1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565816248; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=99Ksqh6XHKEjufzLc0NejnS7EZ3fpzjOw9eglAo3i5o=; b=eOKU1PIKyvKXEyfEZV9BlXFq4/E6+6qYWKuOYsSr1Y9qrgj4zJ42aO0fvk/FhlAfWlTiVsoLMk3E2EYdYsmOBWx2H2cEmpI2NyBXTicsaaN5ey3pXJZWUHxOstAmX7LlwgqbzDbSy7u2Zgdn+52m9aTDo88ZDZIhHIwJ8OWPQJ8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565816248370315.6971904619171; Wed, 14 Aug 2019 13:57:28 -0700 (PDT) Received: from localhost ([::1]:36022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hy0Kl-0005H2-23 for importer@patchew.org; Wed, 14 Aug 2019 16:57:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38011) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hy0Ce-00018C-26 for qemu-devel@nongnu.org; Wed, 14 Aug 2019 16:49:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hy0Cb-0001Eg-S0 for qemu-devel@nongnu.org; Wed, 14 Aug 2019 16:49:04 -0400 Received: from mout.web.de ([217.72.192.78]:58691) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hy0Cb-00017L-IW for qemu-devel@nongnu.org; Wed, 14 Aug 2019 16:49:01 -0400 Received: from luklap ([87.123.206.175]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MKa6N-1hxjDQ19nD-0022ia; Wed, 14 Aug 2019 22:48:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1565815723; bh=Vj5Yz1T195ZbwoJV7LroEOscuPi8lsWZT11FMFdJAYA=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=TkqdvULyqlk+3SaUJLQ1+rTHmztOGl4WhDoR90diWhgQT6eyqa25e6tIuEKPyM8eH hIVqJVukzEqjlpPMTvDaAfqGdPFxS4vP3R+qb5K6iMFWiPqj7m6OoZADB6orxKEtu1 2d4m134qHEsaswM9pBSuOE7y4VVZopZgkAoysIFo= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Date: Wed, 14 Aug 2019 22:47:42 +0200 From: Lukas Straub To: "Zhang, Chen" Message-ID: <73c88a10b6bd19c14bd732126e3bf07527cd7e60.1565814686.git.lukasstraub2@web.de> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:2QOXj+nFHHGS/NWHMFYijpgOz8XBJPWvvIau42aZ154xWCT9ANS ZUeDI2fYeh0hFrGdy9DHwcKqE8a+ey4PfX5/EKpbQZSLh4rC78Fotfrhs2JmlX2oErW+j47 MwNcjxJXQ96n1qWS6ao4u8b9DaVejKkHi4Qbm3pkPqplpD8QtDrpEgdHqlZFS6mG7rY1N2/ d1WykebHfSx5hGOI4q40A== X-UI-Out-Filterresults: notjunk:1;V03:K0:u4+dCo7JoAE=:OPedg4aQjtGiL7lSEmsV1L afVZ3uvE4Uv5vQIxQc9TF8g44DMowG0vkZv8ooTpgxkIg4CnNLIblZdgbafv4K/GUrud/vZgQ 0fnDmhmkP1TeTIeAkhKpXV6sgA5P5KNIzRkWTxobyX13MTX8K7QAsmxoTs4BtnaoQFvOVuwbj Vb9PtM6EErUCGoKxvRhQ0ksEsBVT7vBrXQLcqpI/MDUb/+3bighZK2Rl1UVfaoNa5zH160EZS 0uBDoe/sR6naRg5Cc1Nfe48/Cvuz6vW0Dwl52dvi8AUKZScvmgqhJT3rIFaxPJhBgeSe+XHgh Qw28VMp+BQsOnT0PJzo7O9SJn81krTUj6PlwtHgoj3Mc2jHdVrBwMApsTcIL2AtCWul7lej1X tHX++va3+HL48/uve5jgWDBFBZWvtHY6xX5FRxkj+m8qMB2bNkOmt5at+Qw6vzS0Ne3uGX1ej eyFnwhrQ8o6L4YNABROTMflmEgpzstU19HqnFsG2G/63lwBn5s9NnJ8u/Lz2neeTz6w/WK86Q wl4DepAu7lIT4xIoGXyojYAam4xn/tY+bcM+OpVxWVJ/adiK9aVElABjhvqTGUjQII/r1IYjD PBnRW6/O0Pxpt+p/JVFZU9fPn3huvIRLyMUJg46cipxr7vIUe/XsMqlmyjBB+BagJLMTUQuPZ gjzvLNc11XfoKOyKXBDXeoyZq2u3rgd44M3XBdWDHQrKqPmRag84BfQcN6DsYhG8VGO63VDsu wLs9nXG9yVR406EeZv+ww0iXbqv9/mX4klHSwu44nYH1ORR9GHRII7FDK9WbA2gr+Wf8t1Ofu 77TtXsUgyM+yvRnkDlVii2QRs8DRvFZSWS3wUOSZXLhzGYW1MrdWd08tcmJaoLGvt87/A3v+t yz3ex3uKNWORrjCUF/2ZX40qzzqmVksoc0EnEsbm74DFV4xQ/InR7hX3YMb/w3yjMp1UuRYLV YniUes+AlzweUbu44GvA44nHh0lNJd2vfTxtAssyop3bIvszEsBi5NwQPhfgt1+dUJkP5+x4j NpVZmla7rXMHikSR9nUU/jdAA9DUzs1Jfo4YrHc5CCr2ifP2bmNErKeM81bcKHw3tkt9qxP6N mXZ6MkShmFAuiK8gtDvI7DoHfQNrB9CNQnzrl/sSZp0tnGNK3kG0xvXV6PkvocKJBvAblzzDf x67M4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.78 Subject: [Qemu-devel] [PATCH 3/3] Document the qmp commands for continious replication X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Lukas Straub --- docs/COLO-FT.txt | 185 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 138 insertions(+), 47 deletions(-) diff --git a/docs/COLO-FT.txt b/docs/COLO-FT.txt index ad24680d13..c08bfbd3a8 100644 --- a/docs/COLO-FT.txt +++ b/docs/COLO-FT.txt @@ -145,35 +145,64 @@ The diagram just shows the main qmp command, you can = get the detail in test procedure. =20 =3D=3D Test procedure =3D=3D +Note: Here we are running both instances on the same Machine for testing,=20 +change the IP Addresses if you want to run it on two Hosts + 1. Startup qemu Primary: -# qemu-system-x86_64 -accel kvm -m 2048 -smp 2 -qmp stdio -name primary \ - -device piix3-usb-uhci -vnc :7 \ - -device usb-tablet -netdev tap,id=3Dhn0,vhost=3Doff \ - -device virtio-net-pci,id=3Dnet-pci0,netdev=3Dhn0 \ - -drive if=3Dvirtio,id=3Dprimary-disk0,driver=3Dquorum,read-pattern=3Dfif= o,vote-threshold=3D1,\ - children.0.file.filename=3D1.raw,\ - children.0.driver=3Draw -S +# imagefolder=3D"/mnt/vms/colo-test" + +# cp --reflink=3Dauto $imagefolder/primary.qcow2 $imagefolder/primary-copy= .qcow2 + +# qemu-system-x86_64 -enable-kvm -cpu qemu64,+kvmclock -m 512 -smp 1 -qmp = stdio \ + -vnc :0 -k de -device piix3-usb-uhci -device usb-tablet -name primary \ + -netdev tap,id=3Dhn0,vhost=3Doff,helper=3D/usr/lib/qemu/qemu-bridge-hel= per \ + -device rtl8139,id=3De0,netdev=3Dhn0 \ + -chardev socket,id=3Dmirror0,host=3D127.0.0.1,port=3D9003,server,nowait= \ + -chardev socket,id=3Dcompare1,host=3D127.0.0.1,port=3D9004,server,wait \ + -chardev socket,id=3Dcompare0,host=3D127.0.0.1,port=3D9001,server,nowai= t \ + -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,no= wait \ + -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=3D= compare_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=3D= compare1,\ +outdev=3Dcompare_out0,iothread=3Diothread1 \ + -drive if=3Dide,id=3Dcolo-disk0,driver=3Dquorum,read-pattern=3Dfifo,vot= e-threshold=3D1,\ +children.0.file.filename=3D$imagefolder/primary.qcow2,children.0.driver=3D= qcow2 -S + Secondary: -# qemu-system-x86_64 -accel kvm -m 2048 -smp 2 -qmp stdio -name secondary \ - -device piix3-usb-uhci -vnc :7 \ - -device usb-tablet -netdev tap,id=3Dhn0,vhost=3Doff \ - -device virtio-net-pci,id=3Dnet-pci0,netdev=3Dhn0 \ - -drive if=3Dnone,id=3Dsecondary-disk0,file.filename=3D1.raw,driver=3Draw= ,node-name=3Dnode0 \ - -drive if=3Dvirtio,id=3Dactive-disk0,driver=3Dreplication,mode=3Dseconda= ry,\ - file.driver=3Dqcow2,top-id=3Dactive-disk0,\ - file.file.filename=3D/mnt/ramfs/active_disk.img,\ - file.backing.driver=3Dqcow2,\ - file.backing.file.filename=3D/mnt/ramfs/hidden_disk.img,\ - file.backing.backing=3Dsecondary-disk0 \ - -incoming tcp:0:8888 +# imagefolder=3D"/mnt/vms/colo-test" + +# 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 -m 512 -smp 1 -qmp = stdio \ + -vnc :1 -k de -device piix3-usb-uhci -device usb-tablet -name secondary= \ + -netdev tap,id=3Dhn0,vhost=3Doff,helper=3D/usr/lib/qemu/qemu-bridge-hel= per \ + -device rtl8139,id=3De0,netdev=3Dhn0 \ + -chardev socket,id=3Dred0,host=3D127.0.0.1,port=3D9003,reconnect=3D1 \ + -chardev socket,id=3Dred1,host=3D127.0.0.1,port=3D9004,reconnect=3D1 \ + -object filter-redirector,id=3Df1,netdev=3Dhn0,queue=3Dtx,indev=3Dred0 \ + -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-copy= .qcow2,driver=3Dqcow2 \ + -drive if=3Dnone,id=3Dchilds0,driver=3Dreplication,mode=3Dsecondary,fil= e.driver=3Dqcow2,\ +top-id=3Dchilds0,file.file.filename=3D$imagefolder/secondary-active.qcow2,\ +file.backing.driver=3Dqcow2,file.backing.file.filename=3D$imagefolder/seco= ndary-hidden.qcow2,\ +file.backing.backing=3Dparent0 \ + -drive if=3Dide,id=3Dcolo-disk0,driver=3Dquorum,read-pattern=3Dfifo,vot= e-threshold=3D1,\ +children.0.file=3Dchilds0,children.0.driver=3Draw \ + -incoming tcp:0:9998 + =20 2. On Secondary VM's QEMU monitor, issue command {'execute':'qmp_capabilities'} -{ 'execute': 'nbd-server-start', - 'arguments': {'addr': {'type': 'inet', 'data': {'host': 'xx.xx.xx.xx', '= port': '8889'} } } -} -{'execute': 'nbd-server-add', 'arguments': {'device': 'secondary-disk0', '= writable': true } } +{'execute': 'nbd-server-start', 'arguments': {'addr': {'type': 'inet', 'da= ta': {'host': '127.0.0.1', 'port': '9999'} } } } +{'execute': 'nbd-server-add', 'arguments': {'device': 'parent0', 'writable= ': true } } =20 Note: a. The qmp command nbd-server-start and nbd-server-add must be run @@ -184,12 +213,10 @@ Note: =20 3. On Primary VM's QEMU monitor, issue command: {'execute':'qmp_capabilities'} -{ 'execute': 'human-monitor-command', - 'arguments': {'command-line': 'drive_add -n buddy driver=3Dreplication,m= ode=3Dprimary,file.driver=3Dnbd,file.host=3Dxx.xx.xx.xx,file.port=3D8889,fi= le.export=3Dsecondary-disk0,node-name=3Dnbd_client0'}} -{ 'execute':'x-blockdev-change', 'arguments':{'parent': 'primary-disk0', '= node': 'nbd_client0' } } -{ 'execute': 'migrate-set-capabilities', - 'arguments': {'capabilities': [ {'capability': 'x-colo', 'state': tr= ue } ] } } -{ 'execute': 'migrate', 'arguments': {'uri': 'tcp:xx.xx.xx.xx:8888' } } +{'execute': 'human-monitor-command', 'arguments': {'command-line': 'drive_= add -n buddy driver=3Dreplication,mode=3Dprimary,file.driver=3Dnbd,file.hos= t=3D127.0.0.1,file.port=3D9999,file.export=3Dparent0,node-name=3Dreplicatio= n0'}} +{'execute': 'x-blockdev-change', 'arguments':{'parent': 'colo-disk0', 'nod= e': 'replication0' } } +{'execute': 'migrate-set-capabilities', 'arguments': {'capabilities': [ {'= capability': 'x-colo', 'state': true } ] } } +{'execute': 'migrate', 'arguments': {'uri': 'tcp:127.0.0.1:9998' } } =20 Note: a. There should be only one NBD Client for each primary disk. @@ -199,27 +226,91 @@ Note: =20 4. 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 checkpoint period time +to change the idle checkpoint period time =20 5. Failover test -You can kill Primary VM and run 'x_colo_lost_heartbeat' in Secondary VM's -monitor at the same time, then SVM will failover and client will not detec= t this -change. +You can kill one of the VMs and Failover on the surviving VM:=20 =20 -Before issuing '{ "execute": "x-colo-lost-heartbeat" }' command, we have to -issue block related command to stop block replication. -Primary: - Remove the nbd child from the quorum: - { 'execute': 'x-blockdev-change', 'arguments': {'parent': 'colo-disk0', = 'child': 'children.1'}} - { 'execute': 'human-monitor-command','arguments': {'command-line': 'driv= e_del blk-buddy0'}} - Note: there is no qmp command to remove the blockdev now +=3D=3D Primary Failover =3D=3D +The Secondary died, resume on the Primary =20 -Secondary: - The primary host is down, so we should do the following thing: - { 'execute': 'nbd-server-stop' } +{'execute': 'x-blockdev-change', 'arguments':{ 'parent': 'colo-disk0', 'ch= ild': '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 Pr= imary + +{'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': {'typ= e': 'socket', 'data': {'addr': { 'type': 'inet', 'data': { 'host': '127.0.0= .1', 'port': '9003' } }, 'server': true } } } } +{'execute': 'chardev-add', 'arguments':{ 'id': 'compare1', 'backend': {'ty= pe': 'socket', 'data': {'addr': { 'type': 'inet', 'data': { 'host': '127.0.= 0.1', 'port': '9004' } }, 'server': true } } } } +{'execute': 'chardev-add', 'arguments':{ 'id': 'compare0', 'backend': {'ty= pe': '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', 'backend': {= 'type': 'socket', 'data': {'addr': { 'type': 'inet', 'data': { 'host': '127= .0.0.1', 'port': '9005' } }, 'server': true } } } } +{'execute': 'chardev-add', 'arguments':{ 'id': 'compare_out0', 'backend': = {'type': 'socket', 'data': {'addr': { 'type': 'inet', 'data': { 'host': '12= 7.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, then: +{'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.hos= t=3D127.0.0.1,file.port=3D9999,file.export=3Dparent0,node-name=3Dreplicatio= n0'}} +{'execute': 'x-blockdev-change', 'arguments':{ 'parent': 'colo-disk0', 'no= de': 'replication0' } } + +{'execute': 'object-add', 'arguments':{ 'qom-type': 'filter-mirror', 'id':= 'm0', 'props': { 'netdev': 'hn0', 'queue': 'tx', 'outdev': 'mirror0' } } } +{'execute': 'object-add', 'arguments':{ 'qom-type': 'filter-redirector', '= id': 'redire0', 'props': { 'netdev': 'hn0', 'queue': 'rx', 'indev': 'compar= e_out' } } } +{'execute': 'object-add', 'arguments':{ 'qom-type': 'filter-redirector', '= id': 'redire1', 'props': { 'netdev': 'hn0', 'queue': 'rx', 'outdev': 'compa= re0' } } } +{'execute': 'object-add', 'arguments':{ 'qom-type': 'iothread', 'id': 'iot= hread1' } } +{'execute': 'object-add', 'arguments':{ 'qom-type': 'colo-compare', 'id': = 'comp0', 'props': { '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' } } + +Note: +If this Primary previously was a Secondary, then we need to insert the=20 +filters before the filter-rewriter by using the=20 +"'insert': 'before', 'position': 'rew0'" Options. See below. + +=3D=3D Secondary resume replication =3D=3D +Become Primary and resume replication after new Secondary is up. + +Start the new Secondary, then: +{'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.hos= t=3D127.0.0.1,file.port=3D9999,file.export=3Dparent0,node-name=3Dreplicatio= n0'}} +{'execute': 'x-blockdev-change', 'arguments':{ 'parent': 'colo-disk0', 'no= de': 'replication0' } } + +{'execute': 'object-add', 'arguments':{ 'qom-type': 'filter-mirror', 'id':= 'm0', 'props': { 'insert': 'before', 'position': 'rew0', 'netdev': 'hn0', = 'queue': 'tx', 'outdev': 'mirror0' } } } +{'execute': 'object-add', 'arguments':{ 'qom-type': 'filter-redirector', '= id': 'redire0', 'props': { 'insert': 'before', 'position': 'rew0', 'netdev'= : 'hn0', 'queue': 'rx', 'indev': 'compare_out' } } } +{'execute': 'object-add', 'arguments':{ 'qom-type': 'filter-redirector', '= id': 'redire1', 'props': { 'insert': 'before', 'position': 'rew0', 'netdev'= : 'hn0', 'queue': 'rx', 'outdev': 'compare0' } } } +{'execute': 'object-add', 'arguments':{ 'qom-type': 'iothread', 'id': 'iot= hread1' } } +{'execute': 'object-add', 'arguments':{ 'qom-type': 'colo-compare', 'id': = 'comp0', 'props': { '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' } } =20 =3D=3D TODO =3D=3D -1. Support continuous VM replication. -2. Support shared storage. -3. Develop the heartbeat part. -4. Reduce checkpoint VM=E2=80=99s downtime while doing checkpoint. +1. Support shared storage. +2. Develop the heartbeat part. +3. Reduce checkpoint VM=E2=80=99s downtime while doing checkpoint. --=20 2.20.1