tests/002: add correct output file

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Revert "sheep: let all sheeps with smaller epoch added into delayed_nodes list"

This reverts commit 98241c50d23d99047c37a606a845f5f0bccbbf50.

We cannot pass test 002 after the commit and it looks difficult to fix
the problem.  The benefit of the commit is not mandatory, so let's
revert it for now and fix it in future.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
corosync: handle network partition

This patch adds support for network partition detection again with
more efficient way.

Even when many nodes go down at the same time, corosync dispatches
leave messages one by one.  It makes it difficult to detect a network
partition.  To determine whether there are succeeding leave events or
not, this patch uses a cpg file descriptor, which is used to check
notified corosync messages.  If the descriptor is ready for read,
sheep skip processing events and tries to receive the next events.  If
more than half numbers of nodes go down at the same time, sheep
determine that a network partition has occurred and stop serving.

With this patch, sheep can also detect NIC failure and avoid updating
epoch wrongly.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
tests: avoid false detection of network partion

If more than half nodes go down at the same time, sheep wrongly
detects a network partition failure.  This add one second sleep to
avoid the problem.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
collie: add helper function to read vdi objects

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
collie: add vdi backup support

This enables us to create an incremental backup between two snapshots.

  $ collie vdi backup
  Usage: collie vdi backup [-s snapshot] [-F from] [-a address] [-p port] [-h] <vdiname> <backup>
  Options:
    -s, --snapshot          specify a snapshot id or tag name
    -F, --from              create a differential backup from the snapshot
    -a, --address           specify the daemon address (default: localhost)
    -p, --port              specify the daemon port
    -h, --help              display this help and exit

The created backup file contains differential data for each data
objects.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
collie: vdi restore support

This enables us to restore vdi images with backup files created by
'vdi backup' command.

  $ collie vdi restore
  Usage: collie vdi restore [-s snapshot] [-a address] [-p port] [-h] <vdiname> <backup>
  Options:
    -s, --snapshot          specify a snapshot id or tag name
    -a, --address           specify the daemon address (default: localhost)
    -p, --port              specify the daemon port
    -h, --help              display this help and exit

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
tests: add test to check vdi backup and restore

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