sheepdog: adopting protocol update for VDI locking

The update is required for supporting iSCSI multipath. It doesn't
affect behavior of QEMU driver but adding a new field to vdi request
struct is required.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Liu Yuan <namei.unix@gmail.com>
Cc: MORITA Kazutaka <morita.kazutaka@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Hitoshi Mitake 2014-08-11 14:43:45 +09:00 committed by Stefan Hajnoczi
parent 40ed35a3c4
commit 1dbfafed7f

View File

@ -103,6 +103,9 @@
#define SD_INODE_SIZE (sizeof(SheepdogInode)) #define SD_INODE_SIZE (sizeof(SheepdogInode))
#define CURRENT_VDI_ID 0 #define CURRENT_VDI_ID 0
#define LOCK_TYPE_NORMAL 0
#define LOCK_TYPE_SHARED 1 /* for iSCSI multipath */
typedef struct SheepdogReq { typedef struct SheepdogReq {
uint8_t proto_ver; uint8_t proto_ver;
uint8_t opcode; uint8_t opcode;
@ -166,7 +169,8 @@ typedef struct SheepdogVdiReq {
uint8_t copy_policy; uint8_t copy_policy;
uint8_t reserved[2]; uint8_t reserved[2];
uint32_t snapid; uint32_t snapid;
uint32_t pad[3]; uint32_t type;
uint32_t pad[2];
} SheepdogVdiReq; } SheepdogVdiReq;
typedef struct SheepdogVdiRsp { typedef struct SheepdogVdiRsp {
@ -1090,6 +1094,7 @@ static int find_vdi_name(BDRVSheepdogState *s, const char *filename,
memset(&hdr, 0, sizeof(hdr)); memset(&hdr, 0, sizeof(hdr));
if (lock) { if (lock) {
hdr.opcode = SD_OP_LOCK_VDI; hdr.opcode = SD_OP_LOCK_VDI;
hdr.type = LOCK_TYPE_NORMAL;
} else { } else {
hdr.opcode = SD_OP_GET_VDI_INFO; hdr.opcode = SD_OP_GET_VDI_INFO;
} }
@ -1793,6 +1798,7 @@ static void sd_close(BlockDriverState *bs)
memset(&hdr, 0, sizeof(hdr)); memset(&hdr, 0, sizeof(hdr));
hdr.opcode = SD_OP_RELEASE_VDI; hdr.opcode = SD_OP_RELEASE_VDI;
hdr.type = LOCK_TYPE_NORMAL;
hdr.base_vdi_id = s->inode.vdi_id; hdr.base_vdi_id = s->inode.vdi_id;
wlen = strlen(s->name) + 1; wlen = strlen(s->name) + 1;
hdr.data_length = wlen; hdr.data_length = wlen;