Skip to content

Commit

Permalink
add(stats): add quorum property to zfs stats cmd (#276) (#277)
Browse files Browse the repository at this point in the history
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
  • Loading branch information
sai chaithanya authored and vishnuitta committed Nov 8, 2019
1 parent 55b3edc commit 2d2764e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions module/zfs/zvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ uzfs_ioc_stats(zfs_cmd_t *zc, nvlist_t *nvl)
zv->checkpointed_time);
fnvlist_add_uint64(innvl, "zvol_workers",
zv->main_zv->zvol_workers);
fnvlist_add_uint64(innvl, "quorum",
uzfs_zinfo_get_quorum(zv));

fnvlist_add_uint64(innvl, "rebuildBytes",
zv->main_zv->rebuild_info.rebuild_bytes);
Expand Down
8 changes: 8 additions & 0 deletions tests/cstor/gtest/test_zrepl_prot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,10 @@ TEST_F(ZreplDataTest, RebuildFlag) {
output = execCmd("zfs", std::string("stats ") + m_zvol_name1);
ASSERT_NE(output.find("Degraded"), std::string::npos);

/* volume is created with quorum off */
output = execCmd("zfs", std::string("stats ") + m_zvol_name1);
ASSERT_NE(output.find("\"quorum\":0"), std::string::npos);

/* transition the zvol to online state */
transition_zvol_to_online(m_ioseq1, m_control_fd1, m_zvol_name1);

Expand All @@ -1057,6 +1061,10 @@ TEST_F(ZreplDataTest, RebuildFlag) {
output = execCmd("zfs", std::string("stats ") + m_zvol_name1);
ASSERT_NE(output.find("Healthy"), std::string::npos);

/* Volume became healthy so quorum is expected to be 1 from stats*/
output = execCmd("zfs", std::string("stats ") + m_zvol_name1);
ASSERT_NE(output.find("\"quorum\":1"), std::string::npos);

/* read the block without rebuild flag */
read_data_start(m_datasock1.fd(), m_ioseq1, 0, sizeof (buf), &hdr_in, &read_hdr);
ASSERT_EQ(hdr_in.status, ZVOL_OP_STATUS_OK);
Expand Down

0 comments on commit 2d2764e

Please sign in to comment.