The term "cell" in context of tabled and chunkd conflicts with the idea of a CLD cell. So, rename it to "group". Notice that we aren't introducing configuring of actual CLD paths yet. Coding that in the old CLD API is too hard, so it will come after ncld. Stay tuned. Signed-off-by: Pete Zaitcev <zaitcev@xxxxxxxxxx> --- doc/setup.txt | 22 ++++++++++++++-------- server/chunkd.h | 4 ++-- server/cldu.c | 32 ++++++++++++++++---------------- server/config.c | 12 ++++++------ server/server.c | 2 +- 5 files changed, 39 insertions(+), 33 deletions(-) commit 3eb4fcf8633393690c98a58bc882e950203b3df8 Author: Master <zaitcev@xxxxxxxxxxxxxxxxxxxxx> Date: Thu Jan 28 11:44:18 2010 -0700 Change cell to group. diff --git a/doc/setup.txt b/doc/setup.txt index 9c7f0ad..1c419af 100644 --- a/doc/setup.txt +++ b/doc/setup.txt @@ -65,23 +65,26 @@ _cld._udp.phx2.ex.com has SRV record 10 50 8081 maika.phx2.ex.com. <Cert>/etc/pki/cert-public-key.pem</Cert> </SSL> -*) configure the cell. This actually has a default, called "default". - Do not rely on it, unless you run an appartment-wide cloud cell - or something equally limited. +*) configure the group. The group is used by upper level applications to + find chunkservers that are assigned to them. So, typically, a group + is named after the application. - <Cell>picbak</Cell> + <Group>ultracart2</Group> It's best to use only ASCII letters, numbers, dash ('-'), underscore ('_'), - and period ('.') in cell names. + and period ('.') in group names. + + Keep in mind that if you do not assign a group, the chunkserver joins + the default group called "default". *) For a typical Chunk configuration (not running it standalone), configure Node ID (NID). The NID follows the data, so the best practice for NIDs is to have site-wide node bring-up scripts - create a unique identifier from a per-cell counter, instead of using - the MAC or IP, or such. One common trick is to use the creation time, + create a unique identifier from a per-group counter, instead of using + the MAC or IP address. One common trick is to use the creation time, from "date +%s", so for small clouds all you need is to remember not to create storage nodes in parallel. If NIDs conflict (they must be - unique within a cell), the new node will refuse to come up. This, + unique within a group), the new node will refuse to come up. This, however, is not bulletproof in the face of nodes going down and then back up, so implement those Jumpstart scripts as soon as you have the first 30..50 or so nodes installed. @@ -106,3 +109,6 @@ _cld._udp.phx2.ex.com has SRV record 10 50 8081 maika.phx2.ex.com. /usr/sbin/chunkd -C /etc/chunkd.conf + Once you are satisfied with the operation of the server, integrate + the daemon into your start-up sequence. Consult your local OS guru to + determine the site-appropriate way to do it. diff --git a/server/chunkd.h b/server/chunkd.h index 9b3eeb9..19b13a7 100644 --- a/server/chunkd.h +++ b/server/chunkd.h @@ -205,7 +205,7 @@ struct server { char *ourhost; char *vol_path; - char *cell; + char *group; uint32_t nid; struct geo loc; @@ -265,7 +265,7 @@ extern void cli_in_end(struct client *cli); /* cldu.c */ extern void cldu_add_host(const char *host, unsigned int port); -extern int cld_begin(const char *thishost, const char *thiscell, uint32_t nid, +extern int cld_begin(const char *thishost, const char *thisgroup, uint32_t nid, struct geo *locp, void (*cb)(enum st_cld)); extern void cld_end(void); diff --git a/server/cldu.c b/server/cldu.c index f748860..741845b 100644 --- a/server/cldu.c +++ b/server/cldu.c @@ -54,10 +54,10 @@ struct cld_session { struct timer timer; - char *cfname; /* /chunk-CELL directory */ - struct cldc_fh *cfh; /* /chunk-CELL directory fh */ - char *ffname; /* /chunk-CELL/NID */ - struct cldc_fh *ffh; /* /chunk-cell/NID, keep open for lock */ + char *cfname; /* /chunk-GROUP directory */ + struct cldc_fh *cfh; /* /chunk-GROUP directory fh */ + char *ffname; /* /chunk-GROUP/NID */ + struct cldc_fh *ffh; /* /chunk-GROUP/NID, keep open for lock */ uint32_t nid; const char *ourhost; /* N.B. points to some global data. */ struct geo *ploc; /* N.B. points to some global data. */ @@ -103,28 +103,28 @@ static int cldu_nextactive(struct cld_session *sp) return sp->actx; } -static int cldu_setcell(struct cld_session *sp, const char *thiscell, - uint32_t thisnid, const char *thishost, - struct geo *locp) +static int cldu_setgroup(struct cld_session *sp, const char *thisgroup, + uint32_t thisnid, const char *thishost, + struct geo *locp) { size_t cnlen; size_t mlen; char nbuf[11]; /* 32 bits in decimal and nul */ char *mem; - if (thiscell == NULL) { - thiscell = "default"; + if (thisgroup == NULL) { + thisgroup = "default"; } snprintf(nbuf, 11, "%u", thisnid); - cnlen = strlen(thiscell); + cnlen = strlen(thisgroup); mlen = sizeof("/" SVC "-")-1; mlen += cnlen; mlen++; // '\0' mem = malloc(mlen); - sprintf(mem, "/%s-%s", svc, thiscell); + sprintf(mem, "/%s-%s", svc, thisgroup); sp->cfname = mem; mlen = sizeof("/" SVC "-")-1; @@ -133,7 +133,7 @@ static int cldu_setcell(struct cld_session *sp, const char *thiscell, mlen += strlen(nbuf); mlen++; // '\0' mem = malloc(mlen); - sprintf(mem, "/%s-%s/%s", svc, thiscell, nbuf); + sprintf(mem, "/%s-%s/%s", svc, thisgroup, nbuf); sp->ffname = mem; sp->nid = thisnid; @@ -610,7 +610,7 @@ static struct cld_session ses; * by reference, so their lifetime must exceed the lifetime of the session * (the time between cld_begin and cld_end). */ -int cld_begin(const char *thishost, const char *thiscell, uint32_t nid, +int cld_begin(const char *thishost, const char *thisgroup, uint32_t nid, struct geo *locp, void (*cb)(enum st_cld)) { @@ -628,9 +628,9 @@ int cld_begin(const char *thishost, const char *thiscell, uint32_t nid, timer_init(&ses.timer, "chunkd_cldu_timer", cldu_timer_event, &ses); - if (cldu_setcell(&ses, thiscell, nid, thishost, locp)) { + if (cldu_setgroup(&ses, thisgroup, nid, thishost, locp)) { /* Already logged error */ - goto err_cell; + goto err_group; } if (!ses.forced_hosts) { @@ -677,7 +677,7 @@ int cld_begin(const char *thishost, const char *thiscell, uint32_t nid, err_net: err_addr: -err_cell: +err_group: return -1; } diff --git a/server/config.c b/server/config.c index 674e237..098bbbe 100644 --- a/server/config.c +++ b/server/config.c @@ -55,7 +55,7 @@ struct config_context { struct listen_cfg tmp_listen; }; -static bool is_good_cell_name(const char *s) +static bool is_good_group_name(const char *s) { char c; int n; @@ -391,9 +391,9 @@ static void cfg_elm_end (GMarkupParseContext *context, cc->text = NULL; } - else if (!strcmp(element_name, "Cell") && cc->text) { - free(chunkd_srv.cell); - chunkd_srv.cell = cc->text; + else if (!strcmp(element_name, "Group") && cc->text) { + free(chunkd_srv.group); + chunkd_srv.group = cc->text; cc->text = NULL; } @@ -508,8 +508,8 @@ void read_config(void) } } - if (chunkd_srv.cell && !is_good_cell_name(chunkd_srv.cell)) { - applog(LOG_ERR, "Cell name '%s' is invalid", chunkd_srv.cell); + if (chunkd_srv.group && !is_good_group_name(chunkd_srv.group)) { + applog(LOG_ERR, "Group name '%s' is invalid", chunkd_srv.group); exit(1); } diff --git a/server/server.c b/server/server.c index b04178b..ae0b966 100644 --- a/server/server.c +++ b/server/server.c @@ -1674,7 +1674,7 @@ int main (int argc, char *argv[]) goto err_out_fs; } - if (cld_begin(chunkd_srv.ourhost, chunkd_srv.cell, chunkd_srv.nid, + if (cld_begin(chunkd_srv.ourhost, chunkd_srv.group, chunkd_srv.nid, &chunkd_srv.loc, NULL)) { rc = 1; goto err_out_cld; -- To unsubscribe from this list: send the line "unsubscribe hail-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html