diff --git a/Makefile.am b/Makefile.am index d3c7e2031467..bcc42ba7eafb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,8 +50,11 @@ commitcheck: fi cstyle: - @find ${top_srcdir} -name '*.[hc]' ! -name 'zfs_config.*' \ - ! -name '*.mod.c' ! -name 'rte_*.[hc]' -type f -exec scripts/cstyle.pl -cpP {} \+ + @if [ ! -z ${CSTORDIR} ]; then \ + find ${top_srcdir} -name '*.[hc]' ! -name 'zfs_config.*' ! -name 'config.*' ! -name '*.mod.c' ! -name 'rte_*.[hc]' -type f -exec ${CSTORDIR}/scripts/cstyle.pl -cpP {} \+; \ + else \ + find ${top_srcdir} -name '*.[hc]' ! -name 'zfs_config.*' ! -name '*.mod.c' ! -name 'rte_*.[hc]' -type f -exec scripts/cstyle.pl -cpP {} \+; \ + fi shellcheck: @if type shellcheck > /dev/null 2>&1; then \ diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index 1d069e3d597c..e52e92cceff1 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -173,6 +173,8 @@ typedef enum { ZFS_PROP_RECEIVE_RESUME_TOKEN, ZFS_PROP_QUORUM, ZFS_PROP_TARGETIP, + ZFS_PROP_REPLICA_ID, + ZFS_PROP_WORKERS, ZFS_NUM_PROPS } zfs_prop_t; diff --git a/module/zcommon/zfs_prop.c b/module/zcommon/zfs_prop.c index 4dda2a6ce5bd..ad44e53b9ec0 100644 --- a/module/zcommon/zfs_prop.c +++ b/module/zcommon/zfs_prop.c @@ -355,6 +355,10 @@ zfs_prop_init(void) boolean_table); zprop_register_string(ZFS_PROP_TARGETIP, "io.openebs:targetip", "", PROP_DEFAULT, ZFS_TYPE_VOLUME, "", "TARGETIP"); + zprop_register_string(ZFS_PROP_WORKERS, "io.openebs:zvol_workers", "", + PROP_DEFAULT, ZFS_TYPE_VOLUME, "", "NWORKER"); + zprop_register_string(ZFS_PROP_REPLICA_ID, "io.openebs:zvol_replica_id", + "", PROP_DEFAULT, ZFS_TYPE_VOLUME, "", "REPLICA_ID"); /* readonly index (boolean) properties */ zprop_register_index(ZFS_PROP_MOUNTED, "mounted", 0, PROP_READONLY, diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 6e23dcef98ab..5f09b28ce5fe 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -3483,6 +3483,18 @@ zfs_ioc_create(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl) (error = zvol_check_volsize(volsize, volblocksize)) != 0) return (error); + +#ifdef _UZFS + char *replicaid = NULL; + if (nvlist_lookup_string(nvprops, + zfs_prop_to_name(ZFS_PROP_REPLICA_ID), + &replicaid) != 0) { + return (SET_ERROR(EINVAL)); + } else { + if (!replicaid || strlen(replicaid) == 0) + return (SET_ERROR(EINVAL)); + } +#endif } #ifdef _KERNEL else if (type == DMU_OST_ZFS) { diff --git a/tests/cstor/gtest/test_uzfs.cc b/tests/cstor/gtest/test_uzfs.cc index 28d15bd76475..072fcb1d8c11 100644 --- a/tests/cstor/gtest/test_uzfs.cc +++ b/tests/cstor/gtest/test_uzfs.cc @@ -1336,10 +1336,10 @@ TEST(SnapCreate, SnapRetrieve) { /* Create snapshot */ EXPECT_EQ(0, uzfs_zvol_get_snap_dataset_with_io(zinfo, snapname, &io, &snap_zv)); - + EXPECT_EQ(snapshot_io_num -1, io); EXPECT_EQ(NULL, !snap_zv); - + /* Release dataset and close it */ uzfs_close_dataset(snap_zv); char *longsnap = kmem_asprintf("%s@%s", zinfo->name, snapname); @@ -1348,12 +1348,12 @@ TEST(SnapCreate, SnapRetrieve) { } void -set_start_rebuild_mgmt_ack(mgmt_ack_t *mack, const char *dw_name, const char *volname, uint64_t ioseq=0) +set_start_rebuild_mgmt_ack(rebuild_req_t *req, const char *dw_name, const char *volname, uint64_t ioseq=0) { - GtestUtils::strlcpy(mack->dw_volname, dw_name, MAXNAMELEN); + GtestUtils::strlcpy(req->dw_volname, dw_name, MAXNAMELEN); if (volname != NULL) - GtestUtils::strlcpy(mack->volname, volname, MAXNAMELEN); - mack->checkpointed_io_seq = ioseq; + GtestUtils::strlcpy(req->volname, volname, MAXNAMELEN); + req->checkpointed_io_seq = ioseq; } void @@ -1365,9 +1365,9 @@ set_mgmt_ack_ip_port(mgmt_ack_t *mack, const char *ip, uint16_t port) void set_zvol_io_hdr(zvol_io_hdr_t *hdrp, zvol_op_status_t status, - zvol_op_code_t opcode, int len) + zvol_op_code_t opcode, int len, uint16_t version) { - hdrp->version = REPLICA_VERSION; + hdrp->version = version; hdrp->status = status; hdrp->opcode = opcode; hdrp->len = len; @@ -1376,7 +1376,7 @@ set_zvol_io_hdr(zvol_io_hdr_t *hdrp, zvol_op_status_t status, TEST(uZFSRebuildStart, TestStartRebuild) { int i; uzfs_mgmt_conn_t *conn; - mgmt_ack_t *mack; + rebuild_req_t *req; zvol_rebuild_status_t rebuild_status[5]; rebuild_status[0] = ZVOL_REBUILDING_INIT; @@ -1390,9 +1390,9 @@ TEST(uZFSRebuildStart, TestStartRebuild) { conn = SLIST_FIRST(&uzfs_mgmt_conns); zvol_io_hdr_t *hdrp = (zvol_io_hdr_t *)kmem_zalloc(sizeof (*hdrp), KM_SLEEP); - void *payload = kmem_zalloc(sizeof (mgmt_ack_t) * 5, KM_SLEEP); - mack = (mgmt_ack_t *)payload; - set_zvol_io_hdr(hdrp, ZVOL_OP_STATUS_OK, ZVOL_OPCODE_PREPARE_FOR_REBUILD, 0); + void *payload = kmem_zalloc(sizeof (rebuild_req_t) * 5, KM_SLEEP); + req = (rebuild_req_t *)payload; + set_zvol_io_hdr(hdrp, ZVOL_OP_STATUS_OK, ZVOL_OPCODE_PREPARE_FOR_REBUILD, 0, REPLICA_VERSION); /* payload is 0 */ conn->conn_buf = NULL; @@ -1402,14 +1402,14 @@ TEST(uZFSRebuildStart, TestStartRebuild) { /* NULL name in payload */ conn->conn_buf = NULL; - handle_start_rebuild_req(conn, hdrp, payload, sizeof (mgmt_ack_t)); + handle_start_rebuild_req(conn, hdrp, payload, sizeof (rebuild_req_t)); EXPECT_EQ(ZVOL_OP_STATUS_FAILED, ((zvol_io_hdr_t *)conn->conn_buf)->status); EXPECT_EQ(2, zinfo->refcnt); /* invalid name in payload */ conn->conn_buf = NULL; - set_start_rebuild_mgmt_ack(mack, "vol2", NULL); - handle_start_rebuild_req(conn, hdrp, payload, sizeof (mgmt_ack_t)); + set_start_rebuild_mgmt_ack(req, "vol2", NULL); + handle_start_rebuild_req(conn, hdrp, payload, sizeof (rebuild_req_t)); EXPECT_EQ(ZVOL_OP_STATUS_FAILED, ((zvol_io_hdr_t *)conn->conn_buf)->status); EXPECT_EQ(2, zinfo->refcnt); @@ -1418,8 +1418,8 @@ TEST(uZFSRebuildStart, TestStartRebuild) { conn->conn_buf = NULL; uzfs_zvol_set_rebuild_status(zinfo->main_zv, rebuild_status[i]); - set_start_rebuild_mgmt_ack(mack, "vol1", NULL); - handle_start_rebuild_req(conn, hdrp, payload, sizeof (mgmt_ack_t)); + set_start_rebuild_mgmt_ack(req, "vol1", NULL); + handle_start_rebuild_req(conn, hdrp, payload, sizeof (rebuild_req_t)); EXPECT_EQ(ZVOL_OP_STATUS_FAILED, ((zvol_io_hdr_t *)conn->conn_buf)->status); EXPECT_EQ(2, zinfo->refcnt); } @@ -1441,8 +1441,8 @@ TEST(uZFSRebuildStart, TestStartRebuild) { uzfs_zinfo_set_status(zinfo, ZVOL_STATUS_DEGRADED); uzfs_zvol_set_rebuild_status(zinfo->main_zv, ZVOL_REBUILDING_INIT); - set_start_rebuild_mgmt_ack(mack, "pool1/vol1", "vol2"); - handle_start_rebuild_req(conn, hdrp, payload, sizeof (mgmt_ack_t)); + set_start_rebuild_mgmt_ack(req, "pool1/vol1", "vol2"); + handle_start_rebuild_req(conn, hdrp, payload, sizeof (rebuild_req_t)); EXPECT_EQ(ZVOL_OP_STATUS_OK, ((zvol_io_hdr_t *)conn->conn_buf)->status); while (1) { /* wait to get FAILD status, and threads to return with refcnt to 2 */ @@ -1459,9 +1459,9 @@ TEST(uZFSRebuildStart, TestStartRebuild) { uzfs_zinfo_set_status(zinfo, ZVOL_STATUS_DEGRADED); uzfs_zvol_set_rebuild_status(zinfo->main_zv, ZVOL_REBUILDING_INIT); - set_start_rebuild_mgmt_ack(mack, "pool1/vol1", "vol3"); - set_start_rebuild_mgmt_ack(mack + 1, "vol2", "vol3"); - handle_start_rebuild_req(conn, hdrp, payload, sizeof (mgmt_ack_t)*2); + set_start_rebuild_mgmt_ack(req, "pool1/vol1", "vol3"); + set_start_rebuild_mgmt_ack(req + 1, "vol2", "vol3"); + handle_start_rebuild_req(conn, hdrp, payload, sizeof (rebuild_req_t)*2); EXPECT_EQ(ZVOL_OP_STATUS_FAILED, ((zvol_io_hdr_t *)conn->conn_buf)->status); while (1) { /* wait to get FAILD status, and threads to return with refcnt to 2 */ @@ -1478,10 +1478,10 @@ TEST(uZFSRebuildStart, TestStartRebuild) { uzfs_zinfo_set_status(zinfo, ZVOL_STATUS_DEGRADED); uzfs_zvol_set_rebuild_status(zinfo->main_zv, ZVOL_REBUILDING_INIT); - set_start_rebuild_mgmt_ack(mack, "pool1/vol1", "vol3", 1000); - set_start_rebuild_mgmt_ack(mack + 1, "pool1/vol1", "vol3", 2000); + set_start_rebuild_mgmt_ack(req, "pool1/vol1", "vol3", 1000); + set_start_rebuild_mgmt_ack(req + 1, "pool1/vol1", "vol3", 2000); zinfo->checkpointed_ionum = 3000; - handle_start_rebuild_req(conn, hdrp, payload, sizeof (mgmt_ack_t)*2); + handle_start_rebuild_req(conn, hdrp, payload, sizeof (rebuild_req_t)*2); EXPECT_EQ(ZVOL_OP_STATUS_OK, ((zvol_io_hdr_t *)conn->conn_buf)->status); while (1) { /* wait to get FAILD status, and threads to return with refcnt to 2 */ @@ -1498,10 +1498,10 @@ TEST(uZFSRebuildStart, TestStartRebuild) { uzfs_zinfo_set_status(zinfo, ZVOL_STATUS_DEGRADED); uzfs_zvol_set_rebuild_status(zinfo->main_zv, ZVOL_REBUILDING_INIT); - set_start_rebuild_mgmt_ack(mack, "pool1/vol1", "vol3", 1000); - set_start_rebuild_mgmt_ack(mack + 1, "pool1/vol1", "vol3", 2000); + set_start_rebuild_mgmt_ack(req, "pool1/vol1", "vol3", 1000); + set_start_rebuild_mgmt_ack(req + 1, "pool1/vol1", "vol3", 2000); zinfo->checkpointed_ionum = 300; - handle_start_rebuild_req(conn, hdrp, payload, sizeof (mgmt_ack_t)*2); + handle_start_rebuild_req(conn, hdrp, payload, sizeof (rebuild_req_t)*2); EXPECT_EQ(ZVOL_OP_STATUS_FAILED, ((zvol_io_hdr_t *)conn->conn_buf)->status); while (1) { /* Wait for refcnt to 2 */ @@ -1534,7 +1534,7 @@ create_rebuild_args(rebuild_thread_arg_t **r, std::string helping_vol = "vol2") rebuild_args->port = REBUILD_IO_SERVER_PORT; rc = uzfs_zvol_get_ip(rebuild_args->ip, MAX_IP_LEN); EXPECT_NE(rc, -1); - + GtestUtils::strlcpy(rebuild_args->zvol_name, helping_vol.c_str(), MAXNAMELEN); *r = rebuild_args; } @@ -2811,7 +2811,7 @@ void mock_tgt_thread(void *arg) zvol_state_t *zv; socklen_t in_len; zvol_io_hdr_t hdr, phdr; - mgmt_ack_t mgmt_ack; + rebuild_req_t req; struct sockaddr in_addr; zvol_op_resize_data_t resize; char buf[512]; @@ -2964,23 +2964,23 @@ void mock_tgt_thread(void *arg) /* Rebuild payload mismatch */ if (mgmt_test_case == 20) { hdr.opcode = ZVOL_OPCODE_START_REBUILD; - hdr.len = sizeof (mgmt_ack_t) + 1; + hdr.len = sizeof (rebuild_req_t) + 1; } /* Rebuild wrong volume name */ if (mgmt_test_case == 21) { hdr.opcode = ZVOL_OPCODE_START_REBUILD; - hdr.len = sizeof (mgmt_ack_t); - strcpy(mgmt_ack.dw_volname, "XXXXXXX"); - p = (char *)&mgmt_ack; + hdr.len = sizeof (rebuild_req_t); + strcpy(req.dw_volname, "XXXXXXX"); + p = (char *)&req; } /* Rebuild Null zv */ if (mgmt_test_case == 22) { hdr.opcode = ZVOL_OPCODE_START_REBUILD; - hdr.len = sizeof (mgmt_ack_t); - strcpy(mgmt_ack.dw_volname, zinfo->name); - p = (char *)&mgmt_ack; + hdr.len = sizeof (rebuild_req_t); + strcpy(req.dw_volname, zinfo->name); + p = (char *)&req; zv = zinfo->main_zv; zinfo->main_zv = NULL; } @@ -2988,9 +2988,9 @@ void mock_tgt_thread(void *arg) /*Volume is wrong rebuild state */ if (mgmt_test_case == 23) { hdr.opcode = ZVOL_OPCODE_START_REBUILD; - hdr.len = sizeof (mgmt_ack_t); - strcpy(mgmt_ack.dw_volname, zinfo->name); - p = (char *)&mgmt_ack; + hdr.len = sizeof (rebuild_req_t); + strcpy(req.dw_volname, zinfo->name); + p = (char *)&req; uzfs_zvol_set_rebuild_status(zinfo->main_zv, ZVOL_REBUILDING_SNAP); } @@ -2998,10 +2998,10 @@ void mock_tgt_thread(void *arg) /* Single Replica */ if (mgmt_test_case == 24) { hdr.opcode = ZVOL_OPCODE_START_REBUILD; - hdr.len = sizeof (mgmt_ack_t); - bzero(&mgmt_ack, sizeof (mgmt_ack)); - strcpy(mgmt_ack.dw_volname, zinfo->name); - p = (char *)&mgmt_ack; + hdr.len = sizeof (rebuild_req_t); + bzero(&req, sizeof (rebuild_req_t)); + strcpy(req.dw_volname, zinfo->name); + p = (char *)&req; } send_hdr: diff --git a/tests/cstor/gtest/test_zfs.cc b/tests/cstor/gtest/test_zfs.cc index 41ecb29c7154..6f4c7d5d413a 100644 --- a/tests/cstor/gtest/test_zfs.cc +++ b/tests/cstor/gtest/test_zfs.cc @@ -42,7 +42,7 @@ TEST(RedundantMetadata, NoneValue) { zrepl.start(); pool.create(); - pool.createZvol("vol1", "-o io.openebs:targetip=127.0.0.1"); + pool.createZvol("vol1", "-o io.openebs:targetip=127.0.0.1 -o io.openebs:zvol_replica_id=12345"); s = execCmd("zfs", std::string("get -Ho value redundant_metadata ") + zvol_name); EXPECT_STREQ(s.c_str(), "none"); diff --git a/tests/cstor/gtest/test_zrepl_prot.cc b/tests/cstor/gtest/test_zrepl_prot.cc index 908c67421f1d..4c04bf0a8789 100644 --- a/tests/cstor/gtest/test_zrepl_prot.cc +++ b/tests/cstor/gtest/test_zrepl_prot.cc @@ -300,24 +300,24 @@ static void transition_zvol_to_online(uint64_t &ioseq, int control_fd, std::string zvol_name, int res = ZVOL_OP_STATUS_OK, int version = REPLICA_VERSION) { zvol_io_hdr_t hdr_in, hdr_out = {0}; - struct mgmt_ack mgmt_ack = {0}; + rebuild_req_t req = {0}; int rc; hdr_out.version = version; hdr_out.opcode = ZVOL_OPCODE_START_REBUILD; hdr_out.status = ZVOL_OP_STATUS_OK; hdr_out.io_seq = ++ioseq; - hdr_out.len = sizeof (mgmt_ack); + hdr_out.len = sizeof (req); rc = write(control_fd, &hdr_out, sizeof (hdr_out)); ASSERT_ERRNO("write", rc >= 0); ASSERT_EQ(rc, sizeof (hdr_out)); // Hack to tell the replica that it is the only replica // -> rebuild will immediately finish - GtestUtils::strlcpy(mgmt_ack.dw_volname, zvol_name.c_str(), - sizeof (mgmt_ack.dw_volname)); - rc = write(control_fd, &mgmt_ack, sizeof (mgmt_ack)); + GtestUtils::strlcpy(req.dw_volname, zvol_name.c_str(), + sizeof (req.dw_volname)); + rc = write(control_fd, &req, sizeof (req)); ASSERT_ERRNO("write", rc >= 0); - ASSERT_EQ(rc, sizeof (mgmt_ack)); + ASSERT_EQ(rc, sizeof (req)); rc = read(control_fd, &hdr_in, sizeof (hdr_in)); ASSERT_ERRNO("read", rc >= 0); @@ -445,8 +445,8 @@ TEST(StaleSnapshot, Destroy) { zrepl.start(); pool.create(); - pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1"); - pool.createZvol("vol_rebuild_clone", "-o io.openebs:targetip=127.0.0.2"); + pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1 -o io.openebs:zvol_replica_id=12345"); + pool.createZvol("vol_rebuild_clone", "-o io.openebs:targetip=127.0.0.2 -o io.openebs:zvol_replica_id=12345"); output = execCmd("zfs", std::string("snapshot ") + snap_name1); output = execCmd("zfs", std::string("snapshot ") + snap_name2); output = execCmd("zfs", std::string("snapshot ") + snap_name3); @@ -483,7 +483,7 @@ class ZreplHandshakeTest : public testing::Test { m_pool = new TestPool("handshake"); m_zrepl->start(); m_pool->create(); - m_pool->createZvol("vol1", "-o io.openebs:targetip=127.0.0.1:6060"); + m_pool->createZvol("vol1", "-o io.openebs:targetip=127.0.0.1:6060 -o io.openebs:zvol_replica_id=12345"); m_zvol_name = m_pool->getZvolName("vol1"); } @@ -551,12 +551,15 @@ TEST_F(ZreplHandshakeTest, HandshakeOk) { output = execCmd("zfs", std::string("get guid -Hpo value ") + m_zvol_name); EXPECT_EQ(mgmt_ack.zvol_guid, std::stoul(output)); + output = execCmd("zfs", std::string("get io.openebs:zvol_replica_id -Hpo value ") + + m_zvol_name); + EXPECT_STREQ(mgmt_ack.replica_id, output.c_str()); } TEST_F(ZreplHandshakeTest, HandshakeMinVersion) { zvol_io_hdr_t hdr_in, hdr_out = {0}; std::string output; - mgmt_ack_t mgmt_ack; + mgmt_ack_ver_5_t mgmt_ack; int rc; hdr_out.version = MIN_SUPPORTED_REPLICA_VERSION; @@ -576,9 +579,9 @@ TEST_F(ZreplHandshakeTest, HandshakeMinVersion) { EXPECT_EQ(hdr_in.status, ZVOL_OP_STATUS_OK); EXPECT_EQ(hdr_in.io_seq, 0); EXPECT_EQ(hdr_in.offset, 0); - ASSERT_EQ(hdr_in.len, sizeof (mgmt_ack)); - rc = read(m_control_fd, &mgmt_ack, sizeof (mgmt_ack)); - ASSERT_EQ(rc, sizeof (mgmt_ack)); + ASSERT_EQ(hdr_in.len, sizeof (mgmt_ack_ver_5_t)); + rc = read(m_control_fd, &mgmt_ack, sizeof (mgmt_ack_ver_5_t)); + ASSERT_EQ(rc, sizeof (mgmt_ack_ver_5_t)); EXPECT_STREQ(mgmt_ack.volname, m_zvol_name.c_str()); output = execCmd("zpool", std::string("get guid -Hpo value ") + m_pool->m_name); @@ -695,7 +698,7 @@ class ZreplDataTest : public testing::Test { m_zrepl->start(); m_pool1->create(); - m_pool1->createZvol("ivol1", "-o io.openebs:targetip=127.0.0.1:6060"); + m_pool1->createZvol("ivol1", "-o io.openebs:targetip=127.0.0.1:6060 -o io.openebs:zvol_replica_id=12345"); m_zvol_name1 = m_pool1->getZvolName("ivol1"); rc = target1.listen(); @@ -716,7 +719,7 @@ class ZreplDataTest : public testing::Test { ZVOL_OP_STATUS_OK); m_pool2->create(); - m_pool2->createZvol("vol1", "-o io.openebs:targetip=127.0.0.1:12345"); + m_pool2->createZvol("vol1", "-o io.openebs:targetip=127.0.0.1:12345 -o io.openebs:zvol_replica_id=12345"); m_zvol_name2 = m_pool1->getZvolName("ivol1"); rc = target2.listen(12345); @@ -1111,8 +1114,8 @@ TEST(ReplicaState, SingleReplicaQuorumOff) { zrepl.start(); pool.create(); - pool.createZvol("quorumon", "-o quorum=on -o io.openebs:targetip=127.0.0.1:6060"); - pool.createZvol("quorumoff", "-o io.openebs:targetip=127.0.0.1:6161"); + pool.createZvol("quorumon", "-o quorum=on -o io.openebs:targetip=127.0.0.1:6060 -o io.openebs:zvol_replica_id=12345"); + pool.createZvol("quorumoff", "-o io.openebs:targetip=127.0.0.1:6161 -o io.openebs:zvol_replica_id=12345"); zvol_name1 = pool.getZvolName("quorumon"); zvol_name2 = pool.getZvolName("quorumoff"); @@ -1155,7 +1158,7 @@ TEST(ReplicaState, MultiReplicaAndDegradedSingleReplicaDuringUpgrade) { zrepl.start(); pool.create(); - pool.createZvol("quorumon", "-o quorum=on -o io.openebs:targetip=127.0.0.1:6060"); + pool.createZvol("quorumon", "-o quorum=on -o io.openebs:targetip=127.0.0.1:6060 -o io.openebs:zvol_replica_id=12345"); zvol_name1 = pool.getZvolName("quorumon"); rc = targetQuorumOn.listen(); @@ -1209,8 +1212,8 @@ TEST(TargetIPTest, CreateAndDestroy) { zrepl.start(); pool.create(); - pool.createZvol("implicit1", "-o io.openebs:targetip=127.0.0.1:6060"); - pool.createZvol("explicit1", "-o io.openebs:targetip=127.0.0.1:12345"); + pool.createZvol("implicit1", "-o io.openebs:targetip=127.0.0.1:6060 -o io.openebs:zvol_replica_id=12345"); + pool.createZvol("explicit1", "-o io.openebs:targetip=127.0.0.1:12345 -o io.openebs:zvol_replica_id=12345"); output = execCmd("zfs", std::string("stats ") + pool.getZvolName("implicit1")); ASSERT_NE(output.find("Offline"), std::string::npos); @@ -1231,8 +1234,8 @@ TEST(TargetIPTest, CreateAndDestroy) { fdExpl = targetExpl.accept(50); ASSERT_GE(fdExpl, 0); - pool.createZvol("implicit2", "-o io.openebs:targetip=127.0.0.1:6060"); - pool.createZvol("explicit2", "-o io.openebs:targetip=127.0.0.1:12345"); + pool.createZvol("implicit2", "-o io.openebs:targetip=127.0.0.1:6060 -o io.openebs:zvol_replica_id=12345"); + pool.createZvol("explicit2", "-o io.openebs:targetip=127.0.0.1:12345 -o io.openebs:zvol_replica_id=12345"); // no new connections rc = targetImpl.accept(5); @@ -1281,7 +1284,7 @@ TEST(TargetIPTest, Reconnect) { zrepl.start(); pool.create(); - pool.createZvol("reconnect", "-o io.openebs:targetip=127.0.0.1:6060"); + pool.createZvol("reconnect", "-o io.openebs:targetip=127.0.0.1:6060 -o io.openebs:zvol_replica_id=12345"); // First we test that zrepl connects even if it could not connect // first couple of times after start @@ -1346,8 +1349,8 @@ TEST(Misc, ZreplCheckpointInterval) { zrepl.start(); pool.create(); - pool.createZvol("slow", "-o io.openebs:targetip=127.0.0.1:6060"); - pool.createZvol("fast", "-o io.openebs:targetip=127.0.0.1:6060"); + pool.createZvol("slow", "-o io.openebs:targetip=127.0.0.1:6060 -o io.openebs:zvol_replica_id=12345"); + pool.createZvol("fast", "-o io.openebs:targetip=127.0.0.1:6060 -o io.openebs:zvol_replica_id=12345"); zvol_name_slow = pool.getZvolName("slow"); zvol_name_fast = pool.getZvolName("fast"); @@ -1456,7 +1459,7 @@ class ZreplBlockSizeTest : public testing::Test { rc = target.listen(); ASSERT_GE(rc, 0); - m_pool->createZvol("vol", "-o io.openebs:targetip=127.0.0.1"); + m_pool->createZvol("vol", "-o io.openebs:targetip=127.0.0.1 -o io.openebs:zvol_replica_id=12345"); m_zvol_name = m_pool->getZvolName("vol"); m_control_fd = target.accept(-1); ASSERT_GE(m_control_fd, 0); @@ -1568,7 +1571,7 @@ TEST(DiskReplaceTest, SpareReplacement) { vdev2.create(); spare.create(); pool.create(); - pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1"); + pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1 -o io.openebs:zvol_replica_id=12345"); init_buf(buf, sizeof (buf), "cStor-data"); rc = target.listen(); @@ -1717,7 +1720,7 @@ TEST(Snapshot, CreateAndDestroy) { zrepl.start(); pool.create(); - pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1"); + pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1 -o io.openebs:zvol_replica_id=12345"); rc = target.listen(); ASSERT_GE(rc, 0); @@ -1888,7 +1891,7 @@ TEST(ZvolResizeTest, DataConn) { zrepl.start(); pool.create(); - pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1"); + pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1 -o io.openebs:zvol_replica_id=12345"); // get the zvol size before str = execCmd("zfs", std::string("get -Hpo value volsize ") + zvolname); @@ -1954,7 +1957,7 @@ TEST(ZvolResizeTest, ResizeZvol) { zrepl.start(); pool.create(); - pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1"); + pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1 -o io.openebs:zvol_replica_id=12345"); // get the zvol size before str = execCmd("zfs", std::string("get -Hpo value volsize ") + zvolname); @@ -2035,7 +2038,7 @@ TEST(ZvolCloneTest, CloneZvol) { zrepl.start(); pool.create(); - pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1"); + pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1 -o io.openebs:zvol_replica_id=12345"); execCmd("zfs", std::string("snapshot " + snapname)); // clone the zvol @@ -2108,7 +2111,7 @@ TEST(ZvolStatsTest, StatsZvol) { zrepl.start(); pool.create(); - pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1"); + pool.createZvol("vol", "-o io.openebs:targetip=127.0.0.1 -o io.openebs:zvol_replica_id=12345"); rc = target.listen(); ASSERT_GE(rc, 0);