From patchwork Sat Oct 5 13:05:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Straub X-Patchwork-Id: 11175645 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70C1716B1 for ; Sat, 5 Oct 2019 13:11:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4742F222C8 for ; Sat, 5 Oct 2019 13:11:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=web.de header.i=@web.de header.b="ZmWk2My6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4742F222C8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=web.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGjqA-00050m-6V for patchwork-qemu-devel@patchwork.kernel.org; Sat, 05 Oct 2019 09:11:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56748) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGjkt-0002kj-HZ for qemu-devel@nongnu.org; Sat, 05 Oct 2019 09:05:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGjks-0005Sc-71 for qemu-devel@nongnu.org; Sat, 05 Oct 2019 09:05:51 -0400 Received: from mout.web.de ([212.227.17.12]:48575) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iGjkr-0005R7-UR; Sat, 05 Oct 2019 09:05:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1570280731; bh=OfJkK2vnGkQe8T1r5KQyutlaZ4TJ+K9pB9jGve8qHNk=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=ZmWk2My6W3rN89JKwpuOhr20MQ7JMNh0Z0ck5HnWsSSLMsrnDK2LhXr7W0CWLlnOA CsrrBBecLa49GTYUmfjQtcgNmmnYrfXVESbx7aNAmvfs9ryEd4Myu4TNYMtybgdcD4 x+/91z9JpClebvHcMJpk37+AOWg3HyyCN3zEXhN0= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from luklap ([87.123.206.231]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MMmx9-1iC3BF3Izf-008a6C; Sat, 05 Oct 2019 15:05:30 +0200 Date: Sat, 5 Oct 2019 15:05:30 +0200 From: Lukas Straub To: qemu-devel Subject: [PATCH v6 2/4] tests/test-replication.c: Add test for for secondary node continuing replication Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Provags-ID: V03:K1:wGo+s/4GRs3tXN8+Khn7ib2ssYy9FPq1Y48rkFPRq4SDS0DANe7 QIyxfhe65SWwXDOqmVzrKVAYHF1Zobczc+jarW2KcnCN9Mt94en2u/Ql1wUCcIxCP11L5Ya nWlbjdAFKL5l4RllFkN5vLujmL9R2PLu7R7RS0/NaVinFIapzaL5JD3/CPumnUQ3jpSFgaY 7/IBqjKHkoTsZsLy8tg0w== X-UI-Out-Filterresults: notjunk:1;V03:K0:J9pNGHNLzfU=:1EkZSUnsUhk+yYf7VZfJH8 ZmC73q/QLSSSljflGD9zjj7Ya8Rv7d2Q1H/xzfe6o1cf4SpmAY0A0pO/g/NrOoJ1oPVkTDR+0 TWQd+77DA+Q/BgYlLCOaBe/SCYEMFRDCj7J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W8zBxzI 1cz+knSFJ/UauKI30ylYzx/LZ7R9YIealTfIsoSUNz5Bagw0AuoPsvVYQS7i5ZEct7pIkM75u SaxNJg1MN8ikL1tRXcJkQ2ILrIpWD8Yfi4n9J1n5W8S6v/JmNVv9EJT2ZwWs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.12 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: Kevin Wolf , qemu-block , Wen Congyang , Jason Wang , Max Reitz , Zhang Chen , Xie Changlong Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This simulates the case that happens when we resume COLO after failover. Signed-off-by: Lukas Straub --- tests/test-replication.c | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) -- 2.20.1 diff --git a/tests/test-replication.c b/tests/test-replication.c index f085d1993a..8e18ecd998 100644 --- a/tests/test-replication.c +++ b/tests/test-replication.c @@ -489,6 +489,56 @@ static void test_secondary_stop(void) teardown_secondary(); } +static void test_secondary_continuous_replication(void) +{ + BlockBackend *top_blk, *local_blk; + Error *local_err = NULL; + + top_blk = start_secondary(); + replication_start_all(REPLICATION_MODE_SECONDARY, &local_err); + g_assert(!local_err); + + /* write 0x22 to s_local_disk (IMG_SIZE / 2, IMG_SIZE) */ + local_blk = blk_by_name(S_LOCAL_DISK_ID); + test_blk_write(local_blk, 0x22, IMG_SIZE / 2, IMG_SIZE / 2, false); + + /* replication will backup s_local_disk to s_hidden_disk */ + test_blk_read(top_blk, 0x11, IMG_SIZE / 2, + IMG_SIZE / 2, 0, IMG_SIZE, false); + + /* write 0x33 to s_active_disk (0, IMG_SIZE / 2) */ + test_blk_write(top_blk, 0x33, 0, IMG_SIZE / 2, false); + + /* do failover (active commit) */ + replication_stop_all(true, &local_err); + g_assert(!local_err); + + /* it should ignore all requests from now on */ + + /* start after failover */ + replication_start_all(REPLICATION_MODE_PRIMARY, &local_err); + g_assert(!local_err); + + /* checkpoint */ + replication_do_checkpoint_all(&local_err); + g_assert(!local_err); + + /* stop */ + replication_stop_all(true, &local_err); + g_assert(!local_err); + + /* read from s_local_disk (0, IMG_SIZE / 2) */ + test_blk_read(top_blk, 0x33, 0, IMG_SIZE / 2, + 0, IMG_SIZE / 2, false); + + + /* read from s_local_disk (IMG_SIZE / 2, IMG_SIZE) */ + test_blk_read(top_blk, 0x22, IMG_SIZE / 2, + IMG_SIZE / 2, 0, IMG_SIZE, false); + + teardown_secondary(); +} + static void test_secondary_do_checkpoint(void) { BlockBackend *top_blk, *local_blk; @@ -584,6 +634,8 @@ int main(int argc, char **argv) g_test_add_func("/replication/secondary/write", test_secondary_write); g_test_add_func("/replication/secondary/start", test_secondary_start); g_test_add_func("/replication/secondary/stop", test_secondary_stop); + g_test_add_func("/replication/secondary/continuous_replication", + test_secondary_continuous_replication); g_test_add_func("/replication/secondary/do_checkpoint", test_secondary_do_checkpoint); g_test_add_func("/replication/secondary/get_error_all",