All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Straub <lukasstraub2@web.de>
To: "Zhang, Chen" <chen.zhang@intel.com>
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-block <qemu-block@nongnu.org>,
	Wen Congyang <wencongyang2@huawei.com>,
	Jason Wang <jasowang@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>, Max Reitz <mreitz@redhat.com>,
	Xie Changlong <xiechanglong.d@gmail.com>
Subject: Re: [PATCH v6 2/4] tests/test-replication.c: Add test for for secondary node continuing replication
Date: Wed, 9 Oct 2019 17:19:19 +0200	[thread overview]
Message-ID: <20191009171919.6b90d779@luklap> (raw)
In-Reply-To: <9CFF81C0F6B98A43A459C9EDAD400D78062A756A@shsmsx102.ccr.corp.intel.com>

On Wed, 9 Oct 2019 06:03:03 +0000
"Zhang, Chen" <chen.zhang@intel.com> wrote:

> > -----Original Message-----
> > From: Lukas Straub <lukasstraub2@web.de>
> > Sent: Saturday, October 5, 2019 9:06 PM
> > To: qemu-devel <qemu-devel@nongnu.org>
> > Cc: Zhang, Chen <chen.zhang@intel.com>; Jason Wang
> > <jasowang@redhat.com>; Wen Congyang <wencongyang2@huawei.com>;
> > Xie Changlong <xiechanglong.d@gmail.com>; Kevin Wolf
> > <kwolf@redhat.com>; Max Reitz <mreitz@redhat.com>; qemu-block
> > <qemu-block@nongnu.org>
> > Subject: [PATCH v6 2/4] tests/test-replication.c: Add test for for secondary
> > node continuing replication
> >
> > This simulates the case that happens when we resume COLO after failover.
> >
> > Signed-off-by: Lukas Straub <lukasstraub2@web.de>
> > ---
> >  tests/test-replication.c | 52
> > ++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 52 insertions(+)
> >
> > 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 */
>
> Should we need add teardown_secondary() here?

I don't think so. It is used to remove the block node after each test and I'm doing that below.

Regards,
Lukas Straub

> Thanks
> Zhang Chen
>
> > +
> > +    /* 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",
> > --
> > 2.20.1
>



  reply	other threads:[~2019-10-09 19:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-05 13:05 [PATCH v6 0/4] colo: Add support for continuous replication Lukas Straub
2019-10-05 13:05 ` [PATCH v6 1/4] block/replication.c: Ignore requests after failover Lukas Straub
2019-10-18 18:46   ` Lukas Straub
2019-10-23  8:13     ` Zhang, Chen
2019-10-23 12:49   ` Max Reitz
2019-10-23 18:07     ` Lukas Straub
2019-10-05 13:05 ` [PATCH v6 2/4] tests/test-replication.c: Add test for for secondary node continuing replication Lukas Straub
2019-10-09  6:03   ` Zhang, Chen
2019-10-09 15:19     ` Lukas Straub [this message]
2019-10-05 13:05 ` [PATCH v6 3/4] net/filter.c: Add Options to insert filters anywhere in the filter list Lukas Straub
2019-10-05 13:05 ` [PATCH v6 4/4] colo: Update Documentation for continuous replication Lukas Straub
2019-10-09  8:36   ` Zhang, Chen
2019-10-09 15:16     ` Lukas Straub
2019-10-10 10:34       ` Zhang, Chen
2019-10-11 16:00         ` Lukas Straub
2019-10-11 17:39           ` Zhang, Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191009171919.6b90d779@luklap \
    --to=lukasstraub2@web.de \
    --cc=chen.zhang@intel.com \
    --cc=jasowang@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wencongyang2@huawei.com \
    --cc=xiechanglong.d@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.