|
|
50dc83 |
From f90df1167bc70c634ba33c181232321da6770709 Mon Sep 17 00:00:00 2001
|
|
|
50dc83 |
From: Raghavendra Bhat <raghavendra@redhat.com>
|
|
|
50dc83 |
Date: Tue, 25 Jun 2019 10:51:33 -0400
|
|
|
50dc83 |
Subject: [PATCH 256/261] features/snapview-server: use the same volfile server
|
|
|
50dc83 |
for gfapi options
|
|
|
50dc83 |
|
|
|
50dc83 |
snapview server xlator makes use of "localhost" as the volfile server while
|
|
|
50dc83 |
initing the new glfs instance to talk to a snapshot. While localhost is fine,
|
|
|
50dc83 |
better use the same volfile server that was used to start the snapshot
|
|
|
50dc83 |
daemon containing the snapview-server xlator.
|
|
|
50dc83 |
|
|
|
50dc83 |
Upstream Patch:
|
|
|
50dc83 |
>Change-Id: I4485d39b0e3d066f481adc6958ace53ea33237f7
|
|
|
50dc83 |
>fixes: bz#1725211
|
|
|
50dc83 |
>Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
|
|
|
50dc83 |
> patch: https://review.gluster.org/#/c/glusterfs/+/22974/
|
|
|
50dc83 |
|
|
|
50dc83 |
BUG: 1722757
|
|
|
50dc83 |
Change-Id: I4485d39b0e3d066f481adc6958ace53ea33237f7
|
|
|
50dc83 |
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
|
|
|
50dc83 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/175984
|
|
|
50dc83 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
50dc83 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
50dc83 |
---
|
|
|
50dc83 |
.../snapview-server/src/snapview-server-helpers.c | 44 ++++++++++++++++++++--
|
|
|
50dc83 |
.../snapview-server/src/snapview-server-messages.h | 2 +-
|
|
|
50dc83 |
2 files changed, 42 insertions(+), 4 deletions(-)
|
|
|
50dc83 |
|
|
|
50dc83 |
diff --git a/xlators/features/snapview-server/src/snapview-server-helpers.c b/xlators/features/snapview-server/src/snapview-server-helpers.c
|
|
|
50dc83 |
index 5514a54..62c1dda 100644
|
|
|
50dc83 |
--- a/xlators/features/snapview-server/src/snapview-server-helpers.c
|
|
|
50dc83 |
+++ b/xlators/features/snapview-server/src/snapview-server-helpers.c
|
|
|
50dc83 |
@@ -476,6 +476,7 @@ __svs_initialise_snapshot_volume(xlator_t *this, const char *name,
|
|
|
50dc83 |
char logfile[PATH_MAX] = {
|
|
|
50dc83 |
0,
|
|
|
50dc83 |
};
|
|
|
50dc83 |
+ char *volfile_server = NULL;
|
|
|
50dc83 |
|
|
|
50dc83 |
GF_VALIDATE_OR_GOTO("snapview-server", this, out);
|
|
|
50dc83 |
GF_VALIDATE_OR_GOTO(this->name, this->private, out);
|
|
|
50dc83 |
@@ -512,14 +513,50 @@ __svs_initialise_snapshot_volume(xlator_t *this, const char *name,
|
|
|
50dc83 |
goto out;
|
|
|
50dc83 |
}
|
|
|
50dc83 |
|
|
|
50dc83 |
- ret = glfs_set_volfile_server(fs, "tcp", "localhost", 24007);
|
|
|
50dc83 |
+ /*
|
|
|
50dc83 |
+ * Before, localhost was used as the volfile server. But, with that
|
|
|
50dc83 |
+ * method, accessing snapshots started giving ENOENT error if a
|
|
|
50dc83 |
+ * specific bind address is mentioned in the glusterd volume file.
|
|
|
50dc83 |
+ * Check the bug https://bugzilla.redhat.com/show_bug.cgi?id=1725211.
|
|
|
50dc83 |
+ * So, the new method is tried below, where, snapview-server first
|
|
|
50dc83 |
+ * uses the volfile server used by the snapd (obtained from the
|
|
|
50dc83 |
+ * command line arguments saved in the global context of the process).
|
|
|
50dc83 |
+ * If the volfile server in global context is NULL, then localhost
|
|
|
50dc83 |
+ * is tried (like before).
|
|
|
50dc83 |
+ */
|
|
|
50dc83 |
+ if (this->ctx->cmd_args.volfile_server) {
|
|
|
50dc83 |
+ volfile_server = gf_strdup(this->ctx->cmd_args.volfile_server);
|
|
|
50dc83 |
+ if (!volfile_server) {
|
|
|
50dc83 |
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM,
|
|
|
50dc83 |
+ SVS_MSG_VOLFILE_SERVER_GET_FAIL,
|
|
|
50dc83 |
+ "failed to copy volfile server %s. ",
|
|
|
50dc83 |
+ this->ctx->cmd_args.volfile_server);
|
|
|
50dc83 |
+ ret = -1;
|
|
|
50dc83 |
+ goto out;
|
|
|
50dc83 |
+ }
|
|
|
50dc83 |
+ } else {
|
|
|
50dc83 |
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM,
|
|
|
50dc83 |
+ SVS_MSG_VOLFILE_SERVER_GET_FAIL,
|
|
|
50dc83 |
+ "volfile server is NULL in cmd args. "
|
|
|
50dc83 |
+ "Trying with localhost");
|
|
|
50dc83 |
+ volfile_server = gf_strdup("localhost");
|
|
|
50dc83 |
+ if (!volfile_server) {
|
|
|
50dc83 |
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM,
|
|
|
50dc83 |
+ SVS_MSG_VOLFILE_SERVER_GET_FAIL,
|
|
|
50dc83 |
+ "failed to copy volfile server localhost.");
|
|
|
50dc83 |
+ ret = -1;
|
|
|
50dc83 |
+ goto out;
|
|
|
50dc83 |
+ }
|
|
|
50dc83 |
+ }
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+ ret = glfs_set_volfile_server(fs, "tcp", volfile_server, 24007);
|
|
|
50dc83 |
if (ret) {
|
|
|
50dc83 |
gf_msg(this->name, GF_LOG_ERROR, local_errno,
|
|
|
50dc83 |
SVS_MSG_SET_VOLFILE_SERVR_FAILED,
|
|
|
50dc83 |
"setting the "
|
|
|
50dc83 |
- "volfile server for snap volume %s "
|
|
|
50dc83 |
+ "volfile server %s for snap volume %s "
|
|
|
50dc83 |
"failed",
|
|
|
50dc83 |
- dirent->name);
|
|
|
50dc83 |
+ volfile_server, dirent->name);
|
|
|
50dc83 |
goto out;
|
|
|
50dc83 |
}
|
|
|
50dc83 |
|
|
|
50dc83 |
@@ -561,6 +598,7 @@ out:
|
|
|
50dc83 |
dirent->fs = fs;
|
|
|
50dc83 |
}
|
|
|
50dc83 |
|
|
|
50dc83 |
+ GF_FREE(volfile_server);
|
|
|
50dc83 |
return fs;
|
|
|
50dc83 |
}
|
|
|
50dc83 |
|
|
|
50dc83 |
diff --git a/xlators/features/snapview-server/src/snapview-server-messages.h b/xlators/features/snapview-server/src/snapview-server-messages.h
|
|
|
50dc83 |
index 8548015..f634ab5 100644
|
|
|
50dc83 |
--- a/xlators/features/snapview-server/src/snapview-server-messages.h
|
|
|
50dc83 |
+++ b/xlators/features/snapview-server/src/snapview-server-messages.h
|
|
|
50dc83 |
@@ -49,6 +49,6 @@ GLFS_MSGID(SNAPVIEW_SERVER, SVS_MSG_NO_MEMORY, SVS_MSG_MEM_ACNT_FAILED,
|
|
|
50dc83 |
SVS_MSG_CLOSEDIR_FAILED, SVS_MSG_CLOSE_FAILED,
|
|
|
50dc83 |
SVS_MSG_GFID_GEN_FAILED, SVS_MSG_GLFS_NEW_FAILED,
|
|
|
50dc83 |
SVS_MSG_SET_VOLFILE_SERVR_FAILED, SVS_MSG_SET_LOGGING_FAILED,
|
|
|
50dc83 |
- SVS_MSG_GLFS_INIT_FAILED);
|
|
|
50dc83 |
+ SVS_MSG_VOLFILE_SERVER_GET_FAIL, SVS_MSG_GLFS_INIT_FAILED);
|
|
|
50dc83 |
|
|
|
50dc83 |
#endif /* !_SNAPVIEW_CLIENT_MESSAGES_H_ */
|
|
|
50dc83 |
--
|
|
|
50dc83 |
1.8.3.1
|
|
|
50dc83 |
|