summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src/client-handshake.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2019-03-29 08:30:49 +0530
committerAmar Tumballi <amarts@redhat.com>2019-04-10 04:42:00 +0000
commit22e848f88e2cb9510e82fb4875c182240fff3303 (patch)
tree942279eb91eb3ba29727b0637b0878e6d197e89b /xlators/protocol/client/src/client-handshake.c
parent398b53adb281e459281f74a9f96a12ee48da7daa (diff)
protocol: add an option to force using old-protocol
As protocol implements every fop, and in general a large part of the codebase. Considering our regression is run mostly in 1 machine, there was no way of forcing the client to use old protocol (while new one is available). With this patch, a new 'testing' option is provided which forces client to use old protocol if found. This should help increase the code coverage by at least 10k lines overall. updates: bz#1693692 Change-Id: Ie45256f7dea250671b689c72b4b6f25037cef948 Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/protocol/client/src/client-handshake.c')
-rw-r--r--xlators/protocol/client/src/client-handshake.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index c43756a3fec..01505587243 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -1338,11 +1338,15 @@ select_server_supported_programs(xlator_t *this, gf_prog_detail *prog)
while (trav) {
/* Select 'programs' */
if ((clnt3_3_fop_prog.prognum == trav->prognum) &&
- (clnt3_3_fop_prog.progver == trav->progver) && !conf->fops) {
+ (clnt3_3_fop_prog.progver == trav->progver)) {
conf->fops = &clnt3_3_fop_prog;
if (conf->rpc)
conf->rpc->auth_value = AUTH_GLUSTERFS_v2;
ret = 0;
+ /* In normal flow, we don't want to use old protocol type.
+ but if it is for testing, lets use it */
+ if (conf->old_protocol)
+ goto done;
}
if ((clnt4_0_fop_prog.prognum == trav->prognum) &&
@@ -1351,8 +1355,10 @@ select_server_supported_programs(xlator_t *this, gf_prog_detail *prog)
if (conf->rpc)
conf->rpc->auth_value = AUTH_GLUSTERFS_v3;
ret = 0;
- /* this is latest program, lets use it */
- goto out;
+ /* this is latest program, lets use this program only */
+ /* if we are testing for old-protocol, lets not break this */
+ if (!conf->old_protocol)
+ goto done;
}
if (ret) {
@@ -1362,6 +1368,7 @@ select_server_supported_programs(xlator_t *this, gf_prog_detail *prog)
trav = trav->next;
}
+done:
if (!ret)
gf_msg(this->name, GF_LOG_INFO, 0, PC_MSG_VERSION_INFO,
"Using Program %s,"