diff options
author | Amar Tumballi <amar@kadalu.io> | 2019-11-17 11:00:50 +0530 |
---|---|---|
committer | Xavi Hernandez <xhernandez@redhat.com> | 2019-11-29 07:01:53 +0000 |
commit | 1bfb0a750c6fcd0bbf4d68a1890704f0aefe6337 (patch) | |
tree | 2e83e49dd2b68a96984f093be8309d23dc1cf8ac /xlators/protocol/client | |
parent | 7c1e383876ad15ec6fc93d412311662f42390a11 (diff) |
debug/io-stats: add an option to set volume-id
'volume-id' is good to have for a graph for uniquely identifying it.
Add it to graph->volume_id while generating volfile itself.
This can be further used in many other places.
Updates: #763
Change-Id: I80516d62d28a284e8ff4707841570ced97a37e73
Signed-off-by: Amar Tumballi <amar@kadalu.io>
Diffstat (limited to 'xlators/protocol/client')
-rw-r--r-- | xlators/protocol/client/src/client-handshake.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index e6a5e84f422..0437f1f272d 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -836,8 +836,7 @@ client_setvolume_cbk(struct rpc_req *req, struct iovec *iov, int count, goto out; } } else { - strncpy(ctx->volume_id, volume_id, - min(strlen(volume_id), GF_UUID_BUF_SIZE)); + strncpy(ctx->volume_id, volume_id, GF_UUID_BUF_SIZE); } } @@ -1036,6 +1035,10 @@ client_setvolume(xlator_t *this, struct rpc_clnt *rpc) if (strncmp("snapd", remote_subvol, 5)) { /* If any value is set, the first element will be non-0. It would be '0', but not '\0' :-) */ + if (!this->ctx->volume_id[0]) { + strncpy(this->ctx->volume_id, this->graph->volume_id, + GF_UUID_BUF_SIZE); + } if (this->ctx->volume_id[0]) { ret = dict_set_str(options, "volume-id", this->ctx->volume_id); if (ret < 0) { |