diff options
-rw-r--r-- | cli/src/cli-cmd-volume.c | 3 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 35 | ||||
-rw-r--r-- | cli/src/cli-xml-output.c | 45 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 32 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 97 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.h | 4 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 82 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 20 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 148 |
9 files changed, 0 insertions, 466 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 585865f5628..975536f9f69 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -3372,9 +3372,6 @@ struct cli_cmd volume_cmds[] = { "[replica <COUNT> [arbiter <COUNT>]] " "[disperse [<COUNT>]] [disperse-data <COUNT>] [redundancy <COUNT>] " "[transport <tcp|rdma|tcp,rdma>] <NEW-BRICK>" -#ifdef HAVE_BD_XLATOR - "?<vg_name>" -#endif "... [force]", cli_cmd_volume_create_cbk, diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index a80a23c6928..0c1205c40a0 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -656,9 +656,6 @@ print_brick_details(dict_t *dict, int volcount, int start_index, int end_index, int isArbiter = 0; int ret = -1; char *brick = NULL; -#ifdef HAVE_BD_XLATOR - char *caps = NULL; -#endif while (index <= end_index) { snprintf(key, 1024, "volume%d.brick%d", volcount, index); @@ -676,12 +673,6 @@ print_brick_details(dict_t *dict, int volcount, int start_index, int end_index, cli_out("Brick%d: %s (arbiter)", index, brick); else cli_out("Brick%d: %s", index, brick); -#ifdef HAVE_BD_XLATOR - snprintf(key, 1024, "volume%d.vg%d", volcount, index); - ret = dict_get_str(dict, key, &caps); - if (!ret) - cli_out("Brick%d VG: %s", index, caps); -#endif index++; } ret = 0; @@ -1022,32 +1013,6 @@ xml_output: cli_out("Status: %s", cli_vol_status_str[status]); cli_out("Snapshot Count: %d", snap_count); -#ifdef HAVE_BD_XLATOR - k = 0; - snprintf(key, sizeof(key), "volume%d.xlator%d", i, k); - ret = dict_get_str(dict, key, &caps); - if (ret) - goto next; - do { - j = 0; - cli_out("Xlator %d: %s", k + 1, caps); - do { - snprintf(key, sizeof(key), "volume%d.xlator%d.caps%d", i, k, - j++); - ret = dict_get_str(dict, key, &caps); - if (ret) - break; - cli_out("Capability %d: %s", j, caps); - } while (1); - - snprintf(key, sizeof(key), "volume%d.xlator%d", i, ++k); - ret = dict_get_str(dict, key, &caps); - if (ret) - break; - } while (1); - - next: -#endif gf_cli_print_number_of_bricks( type, brick_count, dist_count, stripe_count, replica_count, disperse_count, redundancy_count, arbiter_count); diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index b417bb807ba..54458987d9a 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -2618,51 +2618,6 @@ cli_xml_output_vol_info(cli_local_t *local, dict_t *dict) local->writer, (xmlChar *)"transport", "%d", transport); XML_RET_CHECK_AND_GOTO(ret, out); -#ifdef HAVE_BD_XLATOR - /* <xlators> */ - ret = xmlTextWriterStartElement(local->writer, (xmlChar *)"xlators"); - XML_RET_CHECK_AND_GOTO(ret, out); - - for (k = 0;; k++) { - snprintf(key, sizeof(key), "volume%d.xlator%d", i, k); - ret = dict_get_str(dict, key, &caps); - if (ret) - break; - - /* <xlator> */ - ret = xmlTextWriterStartElement(local->writer, (xmlChar *)"xlator"); - XML_RET_CHECK_AND_GOTO(ret, out); - - ret = xmlTextWriterWriteFormatElement( - local->writer, (xmlChar *)"name", "%s", caps); - XML_RET_CHECK_AND_GOTO(ret, out); - - /* <capabilities> */ - ret = xmlTextWriterStartElement(local->writer, - (xmlChar *)"capabilities"); - XML_RET_CHECK_AND_GOTO(ret, out); - - j = 0; - for (j = 0;; j++) { - snprintf(key, sizeof(key), "volume%d.xlator%d.caps%d", i, k, j); - ret = dict_get_str(dict, key, &caps); - if (ret) - break; - ret = xmlTextWriterWriteFormatElement( - local->writer, (xmlChar *)"capability", "%s", caps); - XML_RET_CHECK_AND_GOTO(ret, out); - } - /* </capabilities> */ - ret = xmlTextWriterEndElement(local->writer); - XML_RET_CHECK_AND_GOTO(ret, out); - /* </xlator> */ - ret = xmlTextWriterEndElement(local->writer); - XML_RET_CHECK_AND_GOTO(ret, out); - } - ret = xmlTextWriterFullEndElement(local->writer); - XML_RET_CHECK_AND_GOTO(ret, out); - /* </xlators> */ -#endif j = 1; /* <bricks> */ diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 38483a1ec42..001eac4d39e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -1294,10 +1294,6 @@ glusterd_op_perform_add_bricks(glusterd_volinfo_t *volinfo, int32_t count, if (count) brick = strtok_r(brick_list + 1, " \n", &saveptr); -#ifdef HAVE_BD_XLATOR - if (brickinfo->vg[0]) - caps = CAPS_BD | CAPS_THIN | CAPS_OFFLOAD_COPY | CAPS_OFFLOAD_SNAPSHOT; -#endif /* This check needs to be added to distinguish between * attach-tier commands and add-brick commands. @@ -1324,22 +1320,6 @@ glusterd_op_perform_add_bricks(glusterd_volinfo_t *volinfo, int32_t count, _gf_true); if (ret) goto out; -#ifdef HAVE_BD_XLATOR - char msg[1024] = ""; - /* Check for VG/thin pool if its BD volume */ - if (brickinfo->vg[0]) { - ret = glusterd_is_valid_vg(brickinfo, 0, msg); - if (ret) { - gf_msg(THIS->name, GF_LOG_CRITICAL, 0, GD_MSG_INVALID_VG, "%s", - msg); - goto out; - } - /* if anyone of the brick does not have thin support, - disable it for entire volume */ - caps &= brickinfo->caps; - } else - caps = 0; -#endif if (gf_uuid_is_null(brickinfo->uuid)) { ret = glusterd_resolve_brick(brickinfo); @@ -1708,18 +1688,6 @@ glusterd_op_stage_add_brick(dict_t *dict, char **op_errstr, dict_t *rsp_dict) } if (!gf_uuid_compare(brickinfo->uuid, MY_UUID)) { -#ifdef HAVE_BD_XLATOR - if (brickinfo->vg[0]) { - ret = glusterd_is_valid_vg(brickinfo, 1, msg); - if (ret) { - gf_msg(THIS->name, GF_LOG_ERROR, EINVAL, GD_MSG_INVALID_VG, - "%s", msg); - *op_errstr = gf_strdup(msg); - goto out; - } - } -#endif - ret = glusterd_validate_and_create_brickpath( brickinfo, volinfo->volume_id, volinfo->volname, op_errstr, is_force, _gf_false); diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index b63fa77478a..eb362eb9c1f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -51,10 +51,6 @@ #include "glusterd-syncop.h" #include "glusterd-messages.h" -#ifdef HAVE_BD_XLATOR -#include <lvm2app.h> -#endif - extern glusterd_op_info_t opinfo; static int volcount; @@ -565,89 +561,6 @@ glusterd_add_volume_detail_to_dict(glusterd_volinfo_t *volinfo, dict_t *volumes, if (ret) goto out; -#ifdef HAVE_BD_XLATOR - if (volinfo->caps) { - caps = 0; - keylen = snprintf(key, sizeof(key), "volume%d.xlator0", count); - buf = GF_MALLOC(256, gf_common_mt_char); - if (!buf) { - ret = ENOMEM; - goto out; - } - if (volinfo->caps & CAPS_BD) - snprintf(buf, 256, "BD"); - ret = dict_set_dynstrn(volumes, key, keylen, buf); - if (ret) { - GF_FREE(buf); - goto out; - } - - if (volinfo->caps & CAPS_THIN) { - snprintf(key, sizeof(key), "volume%d.xlator0.caps%d", count, - caps++); - buf = GF_MALLOC(256, gf_common_mt_char); - if (!buf) { - ret = ENOMEM; - goto out; - } - snprintf(buf, 256, "thin"); - ret = dict_set_dynstr(volumes, key, buf); - if (ret) { - GF_FREE(buf); - goto out; - } - } - - if (volinfo->caps & CAPS_OFFLOAD_COPY) { - snprintf(key, sizeof(key), "volume%d.xlator0.caps%d", count, - caps++); - buf = GF_MALLOC(256, gf_common_mt_char); - if (!buf) { - ret = ENOMEM; - goto out; - } - snprintf(buf, 256, "offload_copy"); - ret = dict_set_dynstr(volumes, key, buf); - if (ret) { - GF_FREE(buf); - goto out; - } - } - - if (volinfo->caps & CAPS_OFFLOAD_SNAPSHOT) { - snprintf(key, sizeof(key), "volume%d.xlator0.caps%d", count, - caps++); - buf = GF_MALLOC(256, gf_common_mt_char); - if (!buf) { - ret = ENOMEM; - goto out; - } - snprintf(buf, 256, "offload_snapshot"); - ret = dict_set_dynstr(volumes, key, buf); - if (ret) { - GF_FREE(buf); - goto out; - } - } - - if (volinfo->caps & CAPS_OFFLOAD_ZERO) { - snprintf(key, sizeof(key), "volume%d.xlator0.caps%d", count, - caps++); - buf = GF_MALLOC(256, gf_common_mt_char); - if (!buf) { - ret = ENOMEM; - goto out; - } - snprintf(buf, 256, "offload_zerofill"); - ret = dict_set_dynstr(volumes, key, buf); - if (ret) { - GF_FREE(buf); - goto out; - } - } - } -#endif - cds_list_for_each_entry(brickinfo, &volinfo->bricks, brick_list) { char brick[1024] = { @@ -677,16 +590,6 @@ glusterd_add_volume_detail_to_dict(glusterd_volinfo_t *volinfo, dict_t *volumes, if (ret) goto out; -#ifdef HAVE_BD_XLATOR - if (volinfo->caps & CAPS_BD) { - snprintf(key, sizeof(key), "volume%d.vg%d", count, i); - snprintf(brick, sizeof(brick), "%s", brickinfo->vg); - buf = gf_strdup(brick); - ret = dict_set_dynstr(volumes, key, buf); - if (ret) - goto out; - } -#endif i++; } ret = glusterd_add_arbiter_info_to_bricks(volinfo, volumes, count); diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h index 5f62ce0ad44..47c3ac44515 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h @@ -286,10 +286,6 @@ glusterd_stop_bricks(glusterd_volinfo_t *volinfo); int glusterd_defrag_volume_node_rsp(dict_t *req_dict, dict_t *rsp_dict, dict_t *op_ctx); -#ifdef HAVE_BD_XLATOR -int -glusterd_is_valid_vg(glusterd_brickinfo_t *brick, int check_tag, char *msg); -#endif int32_t glusterd_get_txn_opinfo(uuid_t *txn_id, glusterd_op_info_t *opinfo); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index dd4c02422e3..63cbaa16c1f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -74,9 +74,6 @@ #include <fnmatch.h> #include <sys/statvfs.h> #include <ifaddrs.h> -#ifdef HAVE_BD_XLATOR -#include <lvm2app.h> -#endif #ifdef GF_SOLARIS_HOST_OS #include <sys/sockio.h> @@ -1201,9 +1198,6 @@ glusterd_brickinfo_new_from_brick(char *brick, glusterd_brickinfo_t **brickinfo, char *path = NULL; char *tmp_host = NULL; char *tmp_path = NULL; -#ifdef HAVE_BD_XLATOR - char *vg = NULL; -#endif int32_t ret = -1; glusterd_brickinfo_t *new_brickinfo = NULL; xlator_t *this = NULL; @@ -1228,18 +1222,6 @@ glusterd_brickinfo_new_from_brick(char *brick, glusterd_brickinfo_t **brickinfo, if (ret) goto out; -#ifdef HAVE_BD_XLATOR - vg = strchr(path, '?'); - /* ? is used as a delimiter for vg */ - if (vg) { - if (snprintf(new_brickinfo->vg, PATH_MAX, "%s", vg + 1) >= PATH_MAX) { - ret = -1; - goto out; - } - *vg = '\0'; - } - new_brickinfo->caps = CAPS_BD; -#endif ret = gf_canonicalize_path(path); if (ret) goto out; @@ -1408,63 +1390,6 @@ out: return available; } -#ifdef HAVE_BD_XLATOR -/* - * Sets the tag of the format "trusted.glusterfs.volume-id:<uuid>" in - * the brick VG. It is used to avoid using same VG for another brick. - * @volume-id - gfid, @brick - brick info, @msg - Error message returned - * to the caller - */ -int -glusterd_bd_set_vg_tag(unsigned char *volume_id, glusterd_brickinfo_t *brick, - char *msg, int msg_size) -{ - lvm_t handle = NULL; - vg_t vg = NULL; - char *uuid = NULL; - int ret = -1; - - gf_asprintf(&uuid, "%s:%s", GF_XATTR_VOL_ID_KEY, uuid_utoa(volume_id)); - if (!uuid) { - snprintf(msg, sizeof(*msg), - "Could not allocate memory " - "for tag"); - return -1; - } - - handle = lvm_init(NULL); - if (!handle) { - snprintf(msg, sizeof(*msg), "lvm_init failed"); - goto out; - } - - vg = lvm_vg_open(handle, brick->vg, "w", 0); - if (!vg) { - snprintf(msg, sizeof(*msg), "Could not open VG %s", brick->vg); - goto out; - } - - if (lvm_vg_add_tag(vg, uuid) < 0) { - snprintf(msg, sizeof(*msg), - "Could not set tag %s for " - "VG %s", - uuid, brick->vg); - goto out; - } - lvm_vg_write(vg); - ret = 0; -out: - GF_FREE(uuid); - - if (vg) - lvm_vg_close(vg); - if (handle) - lvm_quit(handle); - - return ret; -} -#endif - int glusterd_validate_and_create_brickpath(glusterd_brickinfo_t *brickinfo, uuid_t volume_id, char *volname, @@ -1590,13 +1515,6 @@ glusterd_validate_and_create_brickpath(glusterd_brickinfo_t *brickinfo, } } -#ifdef HAVE_BD_XLATOR - if (brickinfo->vg[0]) { - ret = glusterd_bd_set_vg_tag(volume_id, brickinfo, msg, sizeof(msg)); - if (ret) - goto out; - } -#endif ret = glusterd_check_and_set_brick_xattr( brickinfo->hostname, brickinfo->path, volume_id, op_errstr, is_force); if (ret) diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 448dd8669a1..a0a9c3b6644 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1788,26 +1788,6 @@ brick_graph_add_bd(volgen_graph_t *graph, glusterd_volinfo_t *volinfo, ret = 0; -#ifdef HAVE_BD_XLATOR - if (*brickinfo->vg != '\0') { - xlator_t *xl = NULL; - /* Now add BD v2 xlator if volume is BD type */ - xl = volgen_graph_add(graph, "storage/bd", volinfo->volname); - if (!xl) { - ret = -1; - goto out; - } - - ret = xlator_set_fixed_option(xl, "device", "vg"); - if (ret) - goto out; - - ret = xlator_set_fixed_option(xl, "export", brickinfo->vg); - if (ret) - goto out; - } -#endif - out: return ret; } diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 7cfba3d22f7..317cb04dd00 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -7,10 +7,6 @@ later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation. */ -#ifdef HAVE_BD_XLATOR -#include <lvm2app.h> -#endif - #include <glusterfs/common-utils.h> #include <glusterfs/syscall.h> #include "cli1-xdr.h" @@ -1133,108 +1129,6 @@ glusterd_handle_cli_statedump_volume(rpcsvc_request_t *req) __glusterd_handle_cli_statedump_volume); } -#ifdef HAVE_BD_XLATOR -/* - * Validates if given VG in the brick exists or not. Also checks if VG has - * GF_XATTR_VOL_ID_KEY tag set to avoid using same VG for multiple bricks. - * Tag is checked only during glusterd_op_stage_create_volume. Tag is set during - * glusterd_validate_and_create_brickpath(). - * @brick - brick info, @check_tag - check for VG tag or not - * @msg - Error message to return to caller - */ -int -glusterd_is_valid_vg(glusterd_brickinfo_t *brick, int check_tag, char *msg) -{ - lvm_t handle = NULL; - vg_t vg = NULL; - char *vg_name = NULL; - int retval = 0; - char *p = NULL; - char *ptr = NULL; - struct dm_list *dm_lvlist = NULL; - struct dm_list *dm_seglist = NULL; - struct lvm_lv_list *lv_list = NULL; - struct lvm_property_value prop = { - 0, - }; - struct lvm_lvseg_list *seglist = NULL; - struct dm_list *taglist = NULL; - struct lvm_str_list *strl = NULL; - - handle = lvm_init(NULL); - if (!handle) { - sprintf(msg, "lvm_init failed, could not validate vg"); - return -1; - } - if (*brick->vg == '\0') { /* BD xlator has vg in brick->path */ - p = gf_strdup(brick->path); - vg_name = strtok_r(p, "/", &ptr); - } else - vg_name = brick->vg; - - vg = lvm_vg_open(handle, vg_name, "r", 0); - if (!vg) { - sprintf(msg, "no such vg: %s", vg_name); - retval = -1; - goto out; - } - if (!check_tag) - goto next; - - taglist = lvm_vg_get_tags(vg); - if (!taglist) - goto next; - - dm_list_iterate_items(strl, taglist) - { - if (!strncmp(strl->str, GF_XATTR_VOL_ID_KEY, - SLEN(GF_XATTR_VOL_ID_KEY))) { - sprintf(msg, - "VG %s is already part of" - " a brick", - vg_name); - retval = -1; - goto out; - } - } -next: - - brick->caps = CAPS_BD | CAPS_OFFLOAD_COPY | CAPS_OFFLOAD_SNAPSHOT; - - dm_lvlist = lvm_vg_list_lvs(vg); - if (!dm_lvlist) - goto out; - - dm_list_iterate_items(lv_list, dm_lvlist) - { - dm_seglist = lvm_lv_list_lvsegs(lv_list->lv); - dm_list_iterate_items(seglist, dm_seglist) - { - prop = lvm_lvseg_get_property(seglist->lvseg, "segtype"); - if (!prop.is_valid || !prop.value.string) - continue; - if (!strcmp(prop.value.string, "thin-pool")) { - brick->caps |= CAPS_THIN; - gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_THINPOOLS_FOR_THINLVS, - "Thin Pool " - "\"%s\" will be used for thin LVs", - lvm_lv_get_name(lv_list->lv)); - break; - } - } - } - - retval = 0; -out: - if (vg) - lvm_vg_close(vg); - lvm_quit(handle); - if (p) - GF_FREE(p); - return retval; -} -#endif - /* op-sm */ int glusterd_op_stage_create_volume(dict_t *dict, char **op_errstr, @@ -1373,13 +1267,6 @@ glusterd_op_stage_create_volume(dict_t *dict, char **op_errstr, } if (!gf_uuid_compare(brick_info->uuid, MY_UUID)) { -#ifdef HAVE_BD_XLATOR - if (brick_info->vg[0]) { - ret = glusterd_is_valid_vg(brick_info, 1, msg); - if (ret) - goto out; - } -#endif ret = glusterd_validate_and_create_brickpath( brick_info, volume_uuid, volname, op_errstr, is_force, _gf_false); @@ -1720,22 +1607,6 @@ glusterd_op_stage_start_volume(dict_t *dict, char **op_errstr, dict_t *rsp_dict) local_brick_count = brick_count; } } - -#ifdef HAVE_BD_XLATOR - if (brickinfo->vg[0]) - caps = CAPS_BD | CAPS_THIN | CAPS_OFFLOAD_COPY | - CAPS_OFFLOAD_SNAPSHOT; - /* Check for VG/thin pool if its BD volume */ - if (brickinfo->vg[0]) { - ret = glusterd_is_valid_vg(brickinfo, 0, msg); - if (ret) - goto out; - /* if anyone of the brick does not have thin support, - disable it for entire volume */ - caps &= brickinfo->caps; - } else - caps = 0; -#endif } ret = dict_set_int32n(rsp_dict, "brick_count", SLEN("brick_count"), @@ -2518,25 +2389,6 @@ glusterd_op_create_volume(dict_t *dict, char **op_errstr) goto out; } brickinfo->statfs_fsid = brickstat.f_fsid; - -#ifdef HAVE_BD_XLATOR - if (brickinfo->vg[0]) { - caps = CAPS_BD | CAPS_THIN | CAPS_OFFLOAD_COPY | - CAPS_OFFLOAD_SNAPSHOT; - ret = glusterd_is_valid_vg(brickinfo, 0, msg); - if (ret) { - gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_VG, "%s", - msg); - goto out; - } - - /* if anyone of the brick does not have thin - support, disable it for entire volume */ - caps &= brickinfo->caps; - } else { - caps = 0; - } -#endif } cds_list_add_tail(&brickinfo->brick_list, &volinfo->bricks); |