From cc1294a86736a18955b76f4face415a6a070c445 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Sun, 19 Feb 2017 22:41:31 +0530 Subject: gluster-block: improve log messages improve strings add missing log messages wherever helpful Signed-off-by: Prasanna Kumar Kalever --- cli/gluster-block.c | 41 ++++++++++--- rpc/block_svc_routines.c | 156 ++++++++++++++++++++++++++++------------------- rpc/glfs-operations.c | 50 +++++++++------ utils/utils.h | 18 ++---- 4 files changed, 161 insertions(+), 104 deletions(-) diff --git a/cli/gluster-block.c b/cli/gluster-block.c index d8883ff..28ce99b 100644 --- a/cli/gluster-block.c +++ b/cli/gluster-block.c @@ -83,9 +83,10 @@ glusterBlockCliRPC_1(void *cobj, clioperations opt, char **out) create_obj = cobj; reply = block_create_cli_1(create_obj, clnt); if (!reply) { - LOG("cli", GB_LOG_ERROR, "%sblock %s create on volume %s failed\n", - clnt_sperror(clnt, "block_create_cli_1"), - create_obj->block_name, create_obj->volume); + LOG("cli", GB_LOG_ERROR, + "%sblock %s create on volume %s with hosts %s failed\n", + clnt_sperror(clnt, "block_create_cli_1"), create_obj->block_name, + create_obj->volume, create_obj->block_hosts); goto out; } break; @@ -128,12 +129,14 @@ glusterBlockCliRPC_1(void *cobj, clioperations opt, char **out) } out: - if (clnt) { - if (!reply || !clnt_freeres(clnt, (xdrproc_t)xdr_blockResponse, (char *)reply)) - LOG("cli", GB_LOG_ERROR, "%s", clnt_sperror(clnt, "clnt_freeres failed")); - + if (clnt && reply) { + if (!clnt_freeres(clnt, (xdrproc_t)xdr_blockResponse, (char *)reply)) { + LOG("cli", GB_LOG_ERROR, "%s", + clnt_sperror(clnt, "clnt_freeres failed")); + } clnt_destroy (clnt); } + if (sockfd != -1) { close (sockfd); } @@ -216,7 +219,8 @@ glusterBlockCreate(int argcount, char **options) case GB_CLI_CREATE_SIZE: cobj.size = glusterBlockCreateParseSize("cli", options[optind++]); if (cobj.size < 0) { - LOG("cli", GB_LOG_ERROR, "%s", "failed while parsing size"); + LOG("cli", GB_LOG_ERROR, "failed while parsing size for block %s", + cobj.block_name); ret = -1; goto out; } @@ -225,7 +229,8 @@ glusterBlockCreate(int argcount, char **options) case GB_CLI_CREATE_BACKEND_SERVESRS: if (GB_STRDUP(cobj.block_hosts, options[optind++]) < 0) { - LOG("cli", GB_LOG_ERROR, "%s", "failed while parsing size"); + LOG("cli", GB_LOG_ERROR, "failed while parsing servers for block %s", + cobj.block_name); ret = -1; goto out; } @@ -250,6 +255,11 @@ glusterBlockCreate(int argcount, char **options) } ret = glusterBlockCliRPC_1(&cobj, CREATE_CLI, &out); + if (ret) { + LOG("cli", GB_LOG_ERROR, + "failed creating block %s on volume %s with hosts %s", + cobj.block_name, cobj.volume, cobj.block_hosts); + } if(out) { MSG("%s", out); @@ -291,6 +301,10 @@ glusterBlockList(int argcount, char **options) strcpy(cobj.volume, options[optind]); ret = glusterBlockCliRPC_1(&cobj, LIST_CLI, &out); + if (ret) { + LOG("cli", GB_LOG_ERROR, "failed listing blocks from volume %s", + cobj.volume); + } if(out) { MSG("%s", out); @@ -333,6 +347,10 @@ glusterBlockDelete(int argcount, char **options) strcpy(cobj.volume, options[optind]); ret = glusterBlockCliRPC_1(&cobj, DELETE_CLI, &out); + if (ret) { + LOG("cli", GB_LOG_ERROR, "failed deleting block %s on volume %s", + cobj.block_name, cobj.volume); + } if(out) { MSG("%s", out); @@ -375,6 +393,11 @@ glusterBlockInfo(int argcount, char **options) strcpy(cobj.volume, options[optind]); ret = glusterBlockCliRPC_1(&cobj, INFO_CLI, &out); + if (ret) { + LOG("cli", GB_LOG_ERROR, + "failed getting info of block %s on volume %s", + cobj.block_name, cobj.volume); + } if(out) { MSG("%s", out); diff --git a/rpc/block_svc_routines.c b/rpc/block_svc_routines.c index 580ec71..1da5c18 100644 --- a/rpc/block_svc_routines.c +++ b/rpc/block_svc_routines.c @@ -64,8 +64,8 @@ glusterBlockCallRPC_1(char *host, void *cobj, server = gethostbyname(host); if (!server) { - LOG("mgmt", GB_LOG_ERROR, "gethostbyname failed (%s)", - strerror (errno)); + LOG("mgmt", GB_LOG_ERROR, "gethostbyname(%s) failed (%s)", + host, strerror (errno)); goto out; } @@ -75,14 +75,15 @@ glusterBlockCallRPC_1(char *host, void *cobj, sain.sin_port = htons(GB_TCP_PORT); if (connect(sockfd, (struct sockaddr *) &sain, sizeof(sain)) < 0) { - LOG("mgmt", GB_LOG_ERROR, "connect failed (%s)", strerror (errno)); + LOG("mgmt", GB_LOG_ERROR, "connect on %s failed (%s)", host, + strerror (errno)); goto out; } clnt = clnttcp_create ((struct sockaddr_in *) &sain, GLUSTER_BLOCK, GLUSTER_BLOCK_VERS, &sockfd, 0, 0); if (!clnt) { - LOG("mgmt", GB_LOG_ERROR, "%s, inet host %s", + LOG("mgmt", GB_LOG_ERROR, "%son inet host %s", clnt_spcreateerror("client create failed"), host); goto out; } @@ -91,16 +92,16 @@ glusterBlockCallRPC_1(char *host, void *cobj, case CREATE_SRV: reply = block_create_1((blockCreate *)cobj, clnt); if (!reply) { - LOG("mgmt", GB_LOG_ERROR, "%s", - clnt_sperror(clnt, "block create failed")); + LOG("mgmt", GB_LOG_ERROR, "%son host %s", + clnt_sperror(clnt, "block remote create failed"), host); goto out; } break; case DELETE_SRV: reply = block_delete_1((blockDelete *)cobj, clnt); if (!reply) { - LOG("mgmt", GB_LOG_ERROR, "%s", - clnt_sperror(clnt, "block delete failed")); + LOG("mgmt", GB_LOG_ERROR, "%son host %s", + clnt_sperror(clnt, "block remote delete failed"), host); goto out; } break; @@ -114,14 +115,13 @@ glusterBlockCallRPC_1(char *host, void *cobj, } out: - if (clnt) { - if (!reply || - !clnt_freeres(clnt, (xdrproc_t)xdr_blockResponse, (char *)reply)) { + if (clnt && reply) { + if (!clnt_freeres(clnt, (xdrproc_t)xdr_blockResponse, (char *)reply)) { LOG("mgmt", GB_LOG_ERROR, "%s", clnt_sperror(clnt, "clnt_freeres failed")); - clnt_destroy (clnt); } + clnt_destroy (clnt); } if (sockfd != -1) { @@ -229,7 +229,8 @@ glusterBlockCreateRemote(void *data) if (ret) { GB_METAUPDATE_OR_GOTO(lock, args->glfs, cobj.block_name, cobj.volume, ret, out, "%s: CONFIGFAIL\n", args->addr); - LOG("mgmt", GB_LOG_ERROR, "%s on host: %s", FAILED_CREATE, args->addr); + LOG("mgmt", GB_LOG_ERROR, "%s for block %s on host %s volume %s", + FAILED_REMOTE_CREATE, cobj.block_name, args->addr, args->volume); goto out; } @@ -333,8 +334,8 @@ glusterBlockDeleteRemote(void *data) if (ret) { GB_METAUPDATE_OR_GOTO(lock, args->glfs, dobj.block_name, args->volume, ret, out, "%s: CLEANUPFAIL\n", args->addr); - LOG("mgmt", GB_LOG_ERROR, "%s on host: %s", - FAILED_GATHERING_INFO, args->addr); + LOG("mgmt", GB_LOG_ERROR, "%s for block %s on host %s volume %s", + FAILED_REMOTE_DELETE, dobj.block_name, args->addr, args->volume); goto out; } GB_METAUPDATE_OR_GOTO(lock, args->glfs, dobj.block_name, args->volume, @@ -482,8 +483,8 @@ glusterBlockCleanUp(struct glfs *glfs, char *blockname, ret = glusterBlockDeleteRemoteAsync(info, glfs, &dobj, count, deleteall, reply); if (ret) { LOG("mgmt", GB_LOG_WARNING, "glusterBlockDeleteRemoteAsync: return %d" - " %s volume: %s blockname %s", ret, FAILED_DELETING_FILE, - info->volume, blockname); + " %s for block %s on volume %s", ret, FAILED_REMOTE_AYNC_DELETE, + blockname, info->volume); /* No action ? */ } @@ -513,8 +514,8 @@ glusterBlockCleanUp(struct glfs *glfs, char *blockname, if (glusterBlockDeleteEntry(glfs, info->volume, info->gbid)) { GB_METAUPDATE_OR_GOTO(lock, glfs, info->gbid, info->volume, ret, out, "ENTRYDELETE: FAIL\n"); - LOG("mgmt", GB_LOG_ERROR, "%s volume: %s host: %s", - FAILED_DELETING_FILE, info->volume, "localhost"); + LOG("mgmt", GB_LOG_ERROR, "%s %s for block %s", FAILED_DELETING_FILE, + info->volume, blockname); ret = -1; goto out; } @@ -522,7 +523,8 @@ glusterBlockCleanUp(struct glfs *glfs, char *blockname, ret, out, "ENTRYDELETE: SUCCESS\n"); ret = glusterBlockDeleteMetaFile(glfs, info->volume, blockname); if (ret) { - LOG("mgmt", GB_LOG_ERROR, "%s", "glusterBlockDeleteMetaFile: failed"); + LOG("mgmt", GB_LOG_ERROR, "%s %s for block %s", + FAILED_DELETING_META, info->volume, blockname); goto out; } } @@ -575,8 +577,9 @@ glusterBlockAuditRequest(struct glfs *glfs, /* check if mpath is satisfied */ if (blk->mpath == successcnt) { - LOG("mgmt", GB_LOG_INFO, "Block create request satisfied for block:" - " %s volume: %s", blk->block_name, blk->volume); + LOG("mgmt", GB_LOG_INFO, "Block create request satisfied for target:" + " %s on volume %s with given hosts %s", + blk->block_name, blk->volume, blk->block_hosts); ret = 0; goto out; } else { @@ -585,8 +588,9 @@ glusterBlockAuditRequest(struct glfs *glfs, morereq = blk->mpath - successcnt; /* needed nodes to complete req */ if (spare == 0) { LOG("mgmt", GB_LOG_WARNING, - "No Spare nodes to create (%s): rewinding creation of target", - blk->block_name); + "No Spare nodes to create (%s): rewinding creation of target" + " on volume %s with given hosts %s", + blk->block_name, blk->volume, blk->block_hosts); glusterBlockCleanUp(glfs, blk->block_name, TRUE, reply); needcleanup = FALSE; /* already clean attempted */ @@ -594,8 +598,9 @@ glusterBlockAuditRequest(struct glfs *glfs, goto out; } else if (spare < morereq) { LOG("mgmt", GB_LOG_WARNING, - "Not enough Spare nodes for (%s): rewinding creation of target", - blk->block_name); + "Not enough Spare nodes for (%s): rewinding creation of target" + " on volume %s with given hosts %s", + blk->block_name, blk->volume, blk->block_hosts); glusterBlockCleanUp(glfs, blk->block_name, TRUE, reply); needcleanup = FALSE; /* already clean attempted */ @@ -604,14 +609,15 @@ glusterBlockAuditRequest(struct glfs *glfs, } else { /* create on spare */ LOG("mgmt", GB_LOG_INFO, - "Trying to serve request for (%s) from spare machines", - blk->block_name); + "Trying to serve request for (%s) on volume %s from spare machines", + blk->block_name, blk->volume); ret = glusterBlockCreateRemoteAsync(list, spent, morereq, glfs, cobj, reply); if (ret) { LOG("mgmt", GB_LOG_WARNING, "glusterBlockCreateRemoteAsync: return %d" - " %s volume: %s hosts: %s blockname %s", ret, FAILED_CREATING_FILE, - blk->volume, blk->block_hosts, blk->block_name); + " %s for block %s on volume %s with hosts %s", ret, + FAILED_REMOTE_AYNC_CREATE, blk->block_name, + blk->volume, blk->block_hosts); } /* we could ideally moved this into #CreateRemoteAsync fail {} */ needcleanup = TRUE; @@ -621,7 +627,7 @@ glusterBlockAuditRequest(struct glfs *glfs, ret = glusterBlockAuditRequest(glfs, blk, cobj, list, reply); if (ret) { LOG("mgmt", GB_LOG_ERROR, "glusterBlockAuditRequest: return %d" - " %s volume: %s hosts: %s blockname %s", ret, FAILED_CREATING_FILE, + "volume: %s hosts: %s blockname %s", ret, blk->volume, blk->block_hosts, blk->block_name); } @@ -658,9 +664,9 @@ block_create_cli_1_svc(blockCreateCli *blk, struct svc_req *rqstp) /* Fail if mpath > list->nhosts */ if (blk->mpath > list->nhosts) { - LOG("mgmt", GB_LOG_ERROR, "block multipath request:%d is greater " - "than provided block-hosts:%s", - blk->mpath, blk->block_hosts); + LOG("mgmt", GB_LOG_ERROR, "for block %s multipath request:%d is greater " + "than provided block-hosts:%s on volume %s", + blk->block_name, blk->mpath, blk->block_hosts, blk->volume); if (asprintf(&reply->out, "multipath req: %d > block-hosts: %s\n", blk->mpath, blk->block_hosts) == -1) { reply->exit = -1; @@ -672,20 +678,25 @@ block_create_cli_1_svc(blockCreateCli *blk, struct svc_req *rqstp) glfs = glusterBlockVolumeInit(blk->volume); if (!glfs) { - LOG("mgmt", GB_LOG_ERROR, "%s", "glusterBlockVolumeInit failed"); + LOG("mgmt", GB_LOG_ERROR, + "glusterBlockVolumeInit(%s) for block %s with hosts %s failed", + blk->volume, blk->block_name, blk->block_hosts); goto optfail; } lkfd = glusterBlockCreateMetaLockFile(glfs, blk->volume); if (!lkfd) { - LOG("mgmt", GB_LOG_ERROR, "%s", - "glusterBlockCreateMetaLockFile failed"); + LOG("mgmt", GB_LOG_ERROR, "%s %s for block %s with hosts %s", + FAILED_CREATING_META, blk->volume, blk->block_name, blk->block_hosts); goto optfail; } GB_METALOCK_OR_GOTO(lkfd, blk->volume, ret, out); if (!glfs_access(glfs, blk->block_name, F_OK)) { + LOG("mgmt", GB_LOG_ERROR, + "block with name %s already exist in the volume %s", + blk->block_name, blk->volume); if (asprintf(&reply->out, "BLOCK with name: '%s' already EXIST\n", blk->block_name) == -1) { ret = -1; @@ -724,15 +735,16 @@ block_create_cli_1_svc(blockCreateCli *blk, struct svc_req *rqstp) glfs, &cobj, &savereply); if (ret) { LOG("mgmt", GB_LOG_WARNING, "glusterBlockCreateRemoteAsync: return %d" - " %s volume: %s hosts: %s blockname %s", ret, FAILED_CREATING_FILE, - blk->volume, blk->block_hosts, blk->block_name); + " %s for block %s on volume %s with hosts %s", ret, + FAILED_REMOTE_AYNC_CREATE, blk->block_name, + blk->volume, blk->block_hosts); } /* Check Point */ ret = glusterBlockAuditRequest(glfs, blk, &cobj, list, &savereply); if (ret) { LOG("mgmt", GB_LOG_ERROR, "glusterBlockAuditRequest: return %d" - " %s volume: %s hosts: %s blockname %s", ret, FAILED_CREATING_FILE, + "volume: %s hosts: %s blockname %s", ret, blk->volume, blk->block_hosts, blk->block_name); } @@ -745,8 +757,9 @@ block_create_cli_1_svc(blockCreateCli *blk, struct svc_req *rqstp) reply->exit = ret; if (lkfd && glfs_close(lkfd) != 0) { - LOG("mgmt", GB_LOG_ERROR, "glfs_close(%s): on volume %s failed[%s]", - GB_TXLOCKFILE, blk->volume, strerror(errno)); + LOG("mgmt", GB_LOG_ERROR, "glfs_close(%s): on volume %s for " + "block %s failed[%s]", GB_TXLOCKFILE, blk->volume, + blk->block_name, strerror(errno)); } glfs_fini(glfs); @@ -778,7 +791,9 @@ block_create_1_svc(blockCreate *blk, struct svc_req *rqstp) reply->exit = -1; if (gethostname(hostname, HOST_NAME_MAX)) { - LOG("mgmt", GB_LOG_ERROR, "gethostname failed (%s)", strerror(errno)); + LOG("mgmt", GB_LOG_ERROR, + "gethostname on localhost for block %s on volume %s failed (%s)", + blk->block_name, blk->volume, strerror(errno)); goto out; } @@ -828,15 +843,17 @@ block_create_1_svc(blockCreate *blk, struct svc_req *rqstp) if (fp) { size_t newLen = fread(reply->out, sizeof(char), 4096, fp); if (ferror( fp ) != 0) { - LOG("mgmt", GB_LOG_ERROR, "reading command %s output", exec); + LOG("mgmt", GB_LOG_ERROR, + "reading command %s output for block %s on volume %s failed", + exec, blk->block_name, blk->volume); } else { reply->out[newLen++] = '\0'; } reply->exit = WEXITSTATUS(pclose(fp)); } else { LOG("mgmt", GB_LOG_ERROR, - "popen(): for block %s executing command (%s) failed(%s)", - blk->block_name, exec, strerror(errno)); + "popen(): for block %s on volume %s executing command %s failed(%s)", + blk->block_name, blk->volume, exec, strerror(errno)); } out: @@ -867,21 +884,26 @@ block_delete_cli_1_svc(blockDeleteCli *blk, struct svc_req *rqstp) glfs = glusterBlockVolumeInit(blk->volume); if (!glfs) { - LOG("mgmt", GB_LOG_ERROR, "%s", "glusterBlockVolumeInit failed"); + LOG("mgmt", GB_LOG_ERROR, + "glusterBlockVolumeInit(%s) for block %s failed", + blk->volume, blk->block_name); goto out; } lkfd = glusterBlockCreateMetaLockFile(glfs, blk->volume); if (!lkfd) { - LOG("mgmt", GB_LOG_ERROR, "%s", - "glusterBlockCreateMetaLockFile failed"); + LOG("mgmt", GB_LOG_ERROR, "%s %s for block %s", + FAILED_CREATING_META, blk->volume, blk->block_name); goto out; } GB_METALOCK_OR_GOTO(lkfd, blk->volume, ret, out); if (glfs_access(glfs, blk->block_name, F_OK)) { - GB_STRDUP(reply->out, "BLOCK Doesn't EXIST"); + LOG("mgmt", GB_LOG_ERROR, + "block with name %s doesn't exist in the volume %s", + blk->block_name, blk->volume); + GB_STRDUP(reply->out, "BLOCK doesn't EXIST"); reply->exit = ENOENT; goto out; } @@ -889,8 +911,7 @@ block_delete_cli_1_svc(blockDeleteCli *blk, struct svc_req *rqstp) ret = glusterBlockCleanUp(glfs, blk->block_name, TRUE, &savereply); if (ret) { LOG("mgmt", GB_LOG_WARNING, "glusterBlockCleanUp: return %d" - " %s volume: %s blockname %s", ret, FAILED_DELETING_FILE, - blk->volume, blk->block_name); + " on block %s for volume %s", ret, blk->block_name, blk->volume); } out: @@ -901,8 +922,9 @@ block_delete_cli_1_svc(blockDeleteCli *blk, struct svc_req *rqstp) reply->exit = ret; if (lkfd && glfs_close(lkfd) != 0) { - LOG("mgmt", GB_LOG_ERROR, "glfs_close(%s): on volume %s failed[%s]", - GB_TXLOCKFILE, blk->volume, strerror(errno)); + LOG("mgmt", GB_LOG_ERROR, + "glfs_close(%s): for block %s on volume %s failed[%s]", + GB_TXLOCKFILE, blk->block_name, blk->volume, strerror(errno)); } glfs_fini(glfs); @@ -950,14 +972,16 @@ block_delete_1_svc(blockDelete *blk, struct svc_req *rqstp) if (fp) { size_t newLen = fread(reply->out, sizeof(char), 4096, fp); if (ferror( fp ) != 0) { - LOG("mgmt", GB_LOG_ERROR, "reading command %s output", exec); + LOG("mgmt", GB_LOG_ERROR, + "reading command %s output for block %s failed", + exec, blk->block_name); } else { reply->out[newLen++] = '\0'; } reply->exit = WEXITSTATUS(pclose(fp)); } else { LOG("mgmt", GB_LOG_ERROR, - "popen(): for block %s executing command (%s) failed(%s)", + "popen(): for block %s executing command %s failed(%s)", blk->block_name, exec, strerror(errno)); } @@ -985,14 +1009,15 @@ block_list_cli_1_svc(blockListCli *blk, struct svc_req *rqstp) glfs = glusterBlockVolumeInit(blk->volume); if (!glfs) { - LOG("mgmt", GB_LOG_ERROR, "%s", "glusterBlockVolumeInit failed"); + LOG("mgmt", GB_LOG_ERROR, + "glusterBlockVolumeInit(%s) failed", blk->volume); goto out; } lkfd = glusterBlockCreateMetaLockFile(glfs, blk->volume); if (!lkfd) { - LOG("mgmt", GB_LOG_ERROR, "%s", - "glusterBlockCreateMetaLockFile failed"); + LOG("mgmt", GB_LOG_ERROR, "%s %s", + FAILED_CREATING_META, blk->volume); goto out; } @@ -1065,14 +1090,16 @@ block_info_cli_1_svc(blockInfoCli *blk, struct svc_req *rqstp) glfs = glusterBlockVolumeInit(blk->volume); if (!glfs) { - LOG("mgmt", GB_LOG_ERROR, "%s", "glusterBlockVolumeInit failed"); + LOG("mgmt", GB_LOG_ERROR, + "glusterBlockVolumeInit(%s) for block %s failed", + blk->volume, blk->block_name); goto out; } lkfd = glusterBlockCreateMetaLockFile(glfs, blk->volume); if (!lkfd) { - LOG("mgmt", GB_LOG_ERROR, "%s", - "glusterBlockCreateMetaLockFile failed"); + LOG("mgmt", GB_LOG_ERROR, "%s %s for block %s", + FAILED_CREATING_META, blk->volume, blk->block_name); goto out; } @@ -1131,8 +1158,9 @@ block_info_cli_1_svc(blockInfoCli *blk, struct svc_req *rqstp) reply->exit = ret; if (lkfd && glfs_close(lkfd) != 0) { - LOG("mgmt", GB_LOG_ERROR, "glfs_close(%s): on volume %s failed[%s]", - GB_TXLOCKFILE, blk->volume, strerror(errno)); + LOG("mgmt", GB_LOG_ERROR, + "glfs_close(%s): on volume %s for block %s failed[%s]", + GB_TXLOCKFILE, blk->volume, blk->block_name, strerror(errno)); } glfs_fini(glfs); diff --git a/rpc/glfs-operations.c b/rpc/glfs-operations.c index 4b84528..e61f2b5 100644 --- a/rpc/glfs-operations.c +++ b/rpc/glfs-operations.c @@ -69,15 +69,17 @@ glusterBlockCreateEntry(struct glfs *glfs, ret = glfs_mkdir (glfs, GB_STOREDIR, 0); if (ret && errno != EEXIST) { - LOG("gfapi", GB_LOG_ERROR, "glfs_mkdir(%s) on volume %s failed[%s]", - GB_STOREDIR, blk->volume, strerror(errno)); + LOG("gfapi", GB_LOG_ERROR, + "glfs_mkdir(%s) on volume %s for block %s failed[%s]", + GB_STOREDIR, blk->volume, blk->block_name, strerror(errno)); goto out; } ret = glfs_chdir (glfs, GB_STOREDIR); if (ret) { - LOG("gfapi", GB_LOG_ERROR, "glfs_chdir(%s) on volume %s failed[%s]", - GB_STOREDIR, blk->volume, strerror(errno)); + LOG("gfapi", GB_LOG_ERROR, + "glfs_chdir(%s) on volume %s for block %s failed[%s]", + GB_STOREDIR, blk->volume, blk->block_name, strerror(errno)); goto out; } @@ -85,26 +87,30 @@ glusterBlockCreateEntry(struct glfs *glfs, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); if (!tgfd) { - LOG("gfapi", GB_LOG_ERROR, "glfs_creat(%s) on volume %s failed[%s]", - gbid, blk->volume, strerror(errno)); + LOG("gfapi", GB_LOG_ERROR, + "glfs_creat(%s) on volume %s for block %s failed[%s]", + gbid, blk->volume, blk->block_name, strerror(errno)); ret = -1; goto out; } else { ret = glfs_ftruncate(tgfd, blk->size); if (ret) { - LOG("gfapi", GB_LOG_ERROR, "glfs_ftruncate(%s): on volume %s " - "of size %zu failed[%s]", gbid, blk->volume, blk->size, - strerror(errno)); + LOG("gfapi", GB_LOG_ERROR, + "glfs_ftruncate(%s): on volume %s for block %s" + "of size %zu failed[%s]", gbid, blk->volume, blk->block_name, + blk->size, strerror(errno)); if (tgfd && glfs_close(tgfd) != 0) { - LOG("gfapi", GB_LOG_ERROR, "glfs_close(%s): on volume %s failed[%s]", - gbid, blk->volume, strerror(errno)); + LOG("gfapi", GB_LOG_ERROR, + "glfs_close(%s): on volume %s for block %s failed[%s]", + gbid, blk->volume, blk->block_name, strerror(errno)); } ret = glfs_unlink(glfs, gbid); if (ret && errno != ENOENT) { - LOG("gfapi", GB_LOG_ERROR, "glfs_unlink(%s) on volume %s failed[%s]", - gbid, blk->volume, strerror(errno)); + LOG("gfapi", GB_LOG_ERROR, + "glfs_unlink(%s) on volume %s for block %s failed[%s]", + gbid, blk->volume, blk->block_name, strerror(errno)); } ret = -1; @@ -112,8 +118,9 @@ glusterBlockCreateEntry(struct glfs *glfs, } if (tgfd && glfs_close(tgfd) != 0) { - LOG("gfapi", GB_LOG_ERROR, "glfs_close(%s): on volume %s failed[%s]", - gbid, blk->volume, strerror(errno)); + LOG("gfapi", GB_LOG_ERROR, + "glfs_close(%s): on volume %s for block %s failed[%s]", + gbid, blk->volume, blk->block_name, strerror(errno)); ret = -1; goto out; } @@ -191,8 +198,9 @@ glusterBlockDeleteMetaFile(struct glfs *glfs, ret = glfs_chdir (glfs, GB_METADIR); if (ret) { - LOG("gfapi", GB_LOG_ERROR, "glfs_chdir(%s) on volume %s failed[%s]", - GB_METADIR, volume, strerror(errno)); + LOG("gfapi", GB_LOG_ERROR, + "glfs_chdir(%s) on volume %s for block %s failed[%s]", + GB_METADIR, volume, blockname, strerror(errno)); goto out; } @@ -304,8 +312,9 @@ blockGetMetaInfo(struct glfs* glfs, char* metafile, MetaInfo *info) ret = glfs_chdir (glfs, GB_METADIR); if (ret) { - LOG("gfapi", GB_LOG_ERROR, "glfs_chdir(%s) on volume %s failed[%s]", - GB_METADIR, info->volume, strerror(errno)); + LOG("gfapi", GB_LOG_ERROR, + "glfs_chdir(%s) on volume %s for block %s failed[%s]", + GB_METADIR, info->volume, metafile, strerror(errno)); goto out; } @@ -322,6 +331,9 @@ blockGetMetaInfo(struct glfs* glfs, char* metafile, MetaInfo *info) count += strlen(tmp) + 1; ret = blockStuffMetaInfo(info, tmp); if (ret) { + LOG("gfapi", GB_LOG_ERROR, + "blockStuffMetaInfo: on volume %s for block %s failed[%s]", + info->volume, metafile, strerror(errno)); goto out; } glfs_lseek(tgmfd, count, SEEK_SET); diff --git a/utils/utils.h b/utils/utils.h index 6bae689..0e6ed9b 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -26,29 +26,23 @@ /* Target Create */ # define FAILED_CREATE "failed in create" +# define FAILED_REMOTE_CREATE "failed in remote create" +# define FAILED_REMOTE_AYNC_CREATE "failed in remote async create" # define FAILED_CREATING_FILE "failed while creating block file in gluster volume" -# define FAILED_CREATING_BACKEND "failed while creating glfs backend" -# define FAILED_CREATING_IQN "failed while creating IQN" -# define FAILED_CREATING_LUN "failed while creating LUN" -# define FAILED_SETTING_ATTRIBUTES "failed while setting attributes" -# define FAILED_SAVEING_CONFIG "failed while saving configuration" +# define FAILED_CREATING_META "failed while creating block meta file from volume" /* Target List */ # define FAILED_LIST "failed in list" -# define FAILED_LIST_BACKEND "failed while listing glfs backends" /* Target Info */ # define FAILED_INFO "failed in info" -# define FAILED_GATHERING_INFO "failed while gathering target info" - -/* Target get cfgstring */ -# define FAILED_GATHERING_CFGSTR "failed while gathering backend cfgstring" /* Target Delete */ # define FAILED_DELETE "failed in delete" -# define FAILED_DELETING_BACKEND "failed while deleting glfs backend" -# define FAILED_DELETING_IQN "failed while deleting IQN" +# define FAILED_REMOTE_DELETE "failed in remote delete" +# define FAILED_REMOTE_AYNC_DELETE "failed in remote async delete" # define FAILED_DELETING_FILE "failed while deleting block file from gluster volume" +# define FAILED_DELETING_META "failed while deleting block meta file from volume" # define LOCK(x) \ -- cgit