summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-store.c
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2011-03-25 05:58:35 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-25 04:38:04 -0700
commit1180b2136f6cf014a08f072f8ecc4aac2b69580f (patch)
tree3989ae8b7e7842a0adc291c7c637543e1a671a94 /xlators/mgmt/glusterd/src/glusterd-store.c
parentfc06afc8cd1a646f71e0ed1713b05b8aa533c6d2 (diff)
mgmt/glusterd: Fix import friend volumes
- Sync transport type of the volume - Stop stale bricks - start new bricks if the volume is started - Restart/Stop nfs server based on the new information Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2549 (Quota[glusterfs-3.2.1qa3]: enable/disable crashes the glusterd on other node) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2549
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index bb8b6b17c64..96af05d802e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -536,8 +536,9 @@ glusterd_volume_exclude_options_write (int fd, glusterd_volinfo_t *volinfo)
goto out;
out:
- gf_log ("", GF_LOG_ERROR, "Unable to write volume values"
- " for %s", volinfo->volname);
+ if (ret)
+ gf_log ("", GF_LOG_ERROR, "Unable to write volume values"
+ " for %s", volinfo->volname);
return ret;
}
@@ -694,6 +695,7 @@ glusterd_store_volinfo (glusterd_volinfo_t *volinfo, glusterd_volinfo_ver_ac_t a
GF_ASSERT (volinfo);
+ glusterd_perform_volinfo_version_action (volinfo, ac);
ret = glusterd_store_create_volume_dir (volinfo);
if (ret)
goto out;
@@ -705,7 +707,10 @@ glusterd_store_volinfo (glusterd_volinfo_t *volinfo, glusterd_volinfo_ver_ac_t a
ret = glusterd_store_perform_volume_store (volinfo);
if (ret)
goto out;
- glusterd_perform_volinfo_version_action (volinfo, ac);
+ //checksum should be computed at the end
+ ret = glusterd_volume_compute_cksum (volinfo);
+ if (ret)
+ goto out;
out:
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
@@ -728,7 +733,7 @@ glusterd_store_delete_volume (glusterd_volinfo_t *volinfo)
priv = THIS->private;
GF_ASSERT (priv);
- snprintf (pathname, 1024, "%s/vols/%s", priv->workdir,
+ snprintf (pathname, sizeof (pathname), "%s/vols/%s", priv->workdir,
volinfo->volname);
dir = opendir (pathname);
@@ -737,7 +742,8 @@ glusterd_store_delete_volume (glusterd_volinfo_t *volinfo)
ret = glusterd_store_remove_bricks (volinfo);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Remove bricks failed");
+ gf_log ("", GF_LOG_ERROR, "Remove bricks failed for %s",
+ volinfo->volname);
}
glusterd_for_each_entry (entry, dir);
@@ -768,14 +774,14 @@ stat_failed:
ret = closedir (dir);
if (ret) {
- gf_log ("", GF_LOG_NORMAL, "Failed to close dir, errno:%d",
+ gf_log ("", GF_LOG_ERROR, "Failed to close dir, errno:%d",
errno);
}
ret = rmdir (pathname);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Failed to rmdir: %s, errno: %d",
- pathname, errno);
+ gf_log ("", GF_LOG_ERROR, "Failed to rmdir: %s, err: %s",
+ pathname, strerror (errno));
}
@@ -1457,8 +1463,7 @@ glusterd_store_retrieve_volume (char *volname)
volinfo->status = atoi (value);
} else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_VERSION,
strlen (GLUSTERD_STORE_KEY_VOL_VERSION))) {
- if (gf_string2uint32 (value, &volinfo->version))
- gf_log ("", GF_LOG_ERROR, "%s", strerror(errno));
+ volinfo->version = atoi (value);
} else if (!strncmp (key, GLUSTERD_STORE_KEY_VOL_PORT,
strlen (GLUSTERD_STORE_KEY_VOL_PORT))) {
volinfo->port = atoi (value);