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