summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2019-03-19 16:45:06 +0200
committerAtin Mukherjee <amukherj@redhat.com>2019-03-25 05:34:50 +0000
commit4acf03d304e88ca3d10d3d7076208f1462228bbb (patch)
treee333bc06afa3bc253bc3c008e8878429f9fb1d33 /xlators
parent1f94395c356748c0f51c76d5de3be5f6cf603547 (diff)
Multiple files: remove HAVE_BD_XLATOR related code.
The BD translator was removed some time ago, (in commit a907e468e724c32b9833ce59806fc215c7122d63). This completes the work. Compile-tested only! updates: bz#1635688 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I999df52e479a72d3cc9523f22f9056de17eb559c
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c32
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c97
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.h4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c82
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c148
6 files changed, 0 insertions, 383 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 38483a1..001eac4 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 b63fa77..eb362eb 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 5f62ce0..47c3ac4 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 dd4c024..63cbaa1 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 448dd86..a0a9c3b 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 7cfba3d..317cb04 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);