File glfs-discard-glfs_check_config of Package tcmu-runner.5250
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Date: Sun, 21 May 2017 15:14:05 +0530
Subject: glfs: discard glfs_check_config
Git-commit: 61bd03e600d2abf309173e9186f4d465bb1b7157
References: bsc#1049485
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Acked-by: Lee Duncan <lduncan@suse.com>
---
glfs.c | 85 -----------------------------------------------------------------
1 file changed, 85 deletions(-)
--- a/glfs.c
+++ b/glfs.c
@@ -117,89 +117,6 @@ fail:
return -1;
}
-static bool glfs_check_config(const char *cfgstring, char **reason)
-{
- char *path;
- char *servername = NULL;
- char *volname = NULL;
- char *pathname = NULL;
- glfs_t *fs = NULL;
- glfs_fd_t *gfd = NULL;
- struct stat st;
- int ret;
- bool result = true;
-
- path = strchr(cfgstring, '/');
- if (!path) {
- if (asprintf(reason, "No path found") == -1)
- *reason = NULL;
- result = false;
- goto done;
- }
- path += 1; /* get past '/' */
-
- if (parse_imagepath(path, &servername, &volname, &pathname) == -1) {
- if (asprintf(reason, "Invalid imagepath") == -1)
- *reason = NULL;
- result = false;
- goto done;
- }
-
- /* Actually attempt to open the volume to verify things are working */
- /* TODO: consolidate this with v. similar tcmu_glfs_open code? */
- fs = glfs_new(volname);
- if (!fs) {
- if (asprintf(reason, "glfs_new failed") == -1)
- *reason = NULL;
- result = false;
- goto done;
- }
-
- ret = glfs_set_volfile_server(fs, "tcp", servername,
- GLUSTER_PORT);
- if (ret) {
- if (asprintf(reason, "glfs_set_volfile_server failed: %m") == -1)
- *reason = NULL;
- result = false;
- goto done;
- }
-
- ret = glfs_init(fs);
- if (ret) {
- if (asprintf(reason, "glfs_init failed: %m") == -1)
- *reason = NULL;
- result = false;
- goto done;
- }
-
- gfd = glfs_open(fs, pathname, ALLOWED_BSOFLAGS);
- if (!gfd) {
- if (asprintf(reason, "glfs_open failed: %m") == -1)
- *reason = NULL;
- result = false;
- goto done;
- }
-
- ret = glfs_lstat(fs, pathname, &st);
- if (ret) {
- if (asprintf(reason, "glfs_lstat failed: %m") == -1)
- *reason = NULL;
- result = false;
- goto done;
- }
-
-done:
- if (gfd)
- glfs_close(gfd);
- if (fs)
- glfs_fini(fs);
- free(servername);
- free(volname);
- free(pathname);
-
- return result;
-}
-
static int tcmu_glfs_open(struct tcmu_device *dev)
{
struct glfs_state *gfsp;
@@ -553,8 +470,6 @@ struct tcmur_handler glfs_handler = {
.subtype = "glfs",
.cfg_desc = glfs_cfg_desc,
- .check_config = glfs_check_config,
-
.open = tcmu_glfs_open,
.close = tcmu_glfs_close,
.handle_cmd = tcmu_glfs_handle_cmd,