object cache: cleanup strbuf usage

Don't use strbuf for hot path because it relys on the malloc(2) to allocate
memory and will add more presure to the glibc's ptmalloc layer.

This is a defensive patch because we observed segfault of malloc or other glibc
library calls (for e.g, opendir(2)) on top of malloc(2).

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
object cache: enable external cache location

Then we can specify external cache local as:
 $ sheep /store -w object:dir=/path/to/cache

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
net: don't use keepalive for sockfd

Since we already use timeout for IO requests, there is no need to use keepalive
to detect weather the target node is alive or not. For a busy network,
keepalive will false report the connection is broken.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
sheep: add option for dual nic support

This is a prepare patch, add one option to add another nic for IO requests.

Usage:
 sheep -i ip{,port} ...

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
net: cleanup str_to_addr()

We'd better embed inet type in it, then reduce one parameter passed in.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sockfd cache: cleanup parameter

This is a prepare patch for redundant nic support.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sockfd cache: support dual connections for a single node

This patch adds dual network card support.

- use one dedicated connection for IO requests
- if IO connection fails, then fallback to non-IO one

Redundant connection is supposed to make Sheepdog more reliable.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
tests: suppress false errors for zookeeper

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
tests: add 050 for IO NIC

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: fix hang when IO NIC is down only

If IO NIC is down but sheep alive, epoch isn't incremented, so we can't retry
poll for ever.

This problem can be demonstrated by 050.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
move node_to_str() and str_to_node() from sheep/cluster.h to include/sheep.h

shephered uses node_to_str() and str_to_node(), so they should be
moved to the header which can be included by other directories of
sheep/.
move enum cluster_join_result from sheep/cluster.h to include/internal_proto.h

enum cluster_join_result is also used by shepherd. So this patch
moves it from sheep/ to include/.
lib: sockaddr_in_to_str(), convert sockaddr_in to string representation

This patch adds new function sockaddr_in_to_str() to lib/net.c. This
is for converting variables typed struct sockaddr_in to string
representation.
shepherd: a new cluster manager specialized for sheepdog

This patch adds shepherd, a new cluster manager for sheepdog. shepherd
is specialized for sheepdog, so it can be optimized only for sheepdog.

shepherd cluster manager is designed as master-slave. So it can be
SPOF. But I'm planning to let it be redundant by utilizing corosync.
If it can be improved, this can be an alternative of the group
management part of ZooKeeper, and it doesn't depend on JVM.

This patch adds the new directory shepherd/ for it, and the
executable binary will be produced as shepherd/shepherd.
The cluster driver for sheep is added as sheep/cluster/shepherd.c.

If you have some opinions or feature requests for a cluster manager
designed and implemented from scratch, I'd like to hear your comments.