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