move vdi_is_snapshot() to sheepdog_proto.h

This allows us to use the macro outside of sheep/vdi.c.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
sheep: make oid_to_vid support any kind of objects

get_obj_copy_number() doesn't take into account vmstate objects.  This
fixes the problem by changing oid_to_vid() so that it supports any
kind of objects.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
sheep: store snapshot vid information in memory

This renames vdi_copy to vdi_state and adds a new field 'snapshot' to
it so that we can know whether the vdi is snapshot or not.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
sheep: return SD_RES_READONLY when write requests are sent to snapshots

This can notify the VM that it has to reload the vdi object.  In
addition, this can also prevent snapshot objects from being updated
wrongly.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
sheep: make SD_OP_GET_INFO a cluster operation

Sheepdog vdi snapshot works as follows:

 1. Update the inode header of the current working vdi.
 2. Create a new working vdi as a child of the previous one.

If QEMU reads the vdi object between 1 and 2, sheep returns
SD_RES_NO_VDI.  To avoid this problem, SD_OP_GET_INFO must be ordered
with other vdi operations.

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 live snapshot

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