[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/93] sheepdog: fix clone operation by 'qemu-img cre
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 09/93] sheepdog: fix clone operation by 'qemu-img create -b' |
Date: |
Fri, 24 Jan 2014 18:20:52 +0100 |
From: Liu Yuan <address@hidden>
We should pass base_inode->vdi_id to base_vdi_id of SheepdogVdiReq so that sheep
can create a clone instead a fresh volume.
This fixes following command:
qemu-create -b sheepdog:base sheepdog:clone
so users can boot sheepdog:clone as a normal volume.
Cc: address@hidden
Cc: Kevin Wolf <address@hidden>
Cc: Stefan Hajnoczi <address@hidden>
Signed-off-by: Liu Yuan <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/sheepdog.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index b94ab6e..6088fa5 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -161,7 +161,7 @@ typedef struct SheepdogVdiReq {
uint32_t id;
uint32_t data_length;
uint64_t vdi_size;
- uint32_t vdi_id;
+ uint32_t base_vdi_id;
uint8_t copies;
uint8_t copy_policy;
uint8_t reserved[2];
@@ -1493,7 +1493,7 @@ static int do_sd_create(BDRVSheepdogState *s, uint32_t
*vdi_id, int snapshot)
memset(&hdr, 0, sizeof(hdr));
hdr.opcode = SD_OP_NEW_VDI;
- hdr.vdi_id = s->inode.vdi_id;
+ hdr.base_vdi_id = s->inode.vdi_id;
wlen = SD_MAX_VDI_LEN;
@@ -1684,7 +1684,7 @@ static int sd_create(const char *filename,
QEMUOptionParameter *options,
if (backing_file) {
BlockDriverState *bs;
- BDRVSheepdogState *s;
+ BDRVSheepdogState *base;
BlockDriver *drv;
/* Currently, only Sheepdog backing image is supported. */
@@ -1702,15 +1702,15 @@ static int sd_create(const char *filename,
QEMUOptionParameter *options,
goto out;
}
- s = bs->opaque;
+ base = bs->opaque;
- if (!is_snapshot(&s->inode)) {
+ if (!is_snapshot(&base->inode)) {
error_report("cannot clone from a non snapshot vdi");
bdrv_unref(bs);
ret = -EINVAL;
goto out;
}
-
+ s->inode.vdi_id = base->inode.vdi_id;
bdrv_unref(bs);
}
@@ -1743,7 +1743,7 @@ static void sd_close(BlockDriverState *bs)
memset(&hdr, 0, sizeof(hdr));
hdr.opcode = SD_OP_RELEASE_VDI;
- hdr.vdi_id = s->inode.vdi_id;
+ hdr.base_vdi_id = s->inode.vdi_id;
wlen = strlen(s->name) + 1;
hdr.data_length = wlen;
hdr.flags = SD_FLAG_CMD_WRITE;
@@ -1846,7 +1846,7 @@ static bool sd_delete(BDRVSheepdogState *s)
unsigned int wlen = SD_MAX_VDI_LEN, rlen = 0;
SheepdogVdiReq hdr = {
.opcode = SD_OP_DEL_VDI,
- .vdi_id = s->inode.vdi_id,
+ .base_vdi_id = s->inode.vdi_id,
.data_length = wlen,
.flags = SD_FLAG_CMD_WRITE,
};
--
1.8.1.4
- [Qemu-devel] [PULL v2 00/93] Block patches, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 01/93] rbd: switch from pipe to QEMUBH completion notification, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 02/93] qemu-iotests: Introduce _unsupported_imgopts, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 03/93] qemu-iotests: Add _unsupported_imgopts for vmdk subformats, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 05/93] block/iscsi: return -ENOMEM if an async call fails immediately, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 04/93] qemu-iotests: Clean up all extents for vmdk, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 08/93] gluster: Add support for creating zero-filled image, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 06/93] gluster: Convert aio routines into coroutines, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 09/93] sheepdog: fix clone operation by 'qemu-img create -b',
Kevin Wolf <=
- [Qemu-devel] [PULL 07/93] gluster: Implement .bdrv_co_write_zeroes for gluster, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 10/93] qtest: Fix the bug about disable vnc causes "make check" fail, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 11/93] docs: qcow2 compat=1.1 is now the default, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 12/93] vmdk: Fix big flat extent IO, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 13/93] readline: decouple readline from the monitor, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 14/93] readline: move readline to a generic location, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 15/93] osdep: add qemu_set_tty_echo(), Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 16/93] qemu-io: use readline.c, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 17/93] qemu-io: add command completion, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 18/93] blkdebug: Use errp for read_config(), Kevin Wolf, 2014/01/24