[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/28] sheepdog: support creating images on remote h
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 12/28] sheepdog: support creating images on remote hosts |
Date: |
Mon, 31 Jan 2011 16:29:00 +0100 |
From: MORITA Kazutaka <address@hidden>
This patch parses the input filename in sd_create(), and enables us
specifying a target server to create sheepdog images.
Signed-off-by: MORITA Kazutaka <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/sheepdog.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index e62820a..a54e0de 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1294,12 +1294,23 @@ static int do_sd_create(char *filename, int64_t
vdi_size,
static int sd_create(const char *filename, QEMUOptionParameter *options)
{
int ret;
- uint32_t vid = 0;
+ uint32_t vid = 0, base_vid = 0;
int64_t vdi_size = 0;
char *backing_file = NULL;
+ BDRVSheepdogState s;
+ char vdi[SD_MAX_VDI_LEN], tag[SD_MAX_VDI_TAG_LEN];
+ uint32_t snapid;
strstart(filename, "sheepdog:", (const char **)&filename);
+ memset(&s, 0, sizeof(s));
+ memset(vdi, 0, sizeof(vdi));
+ memset(tag, 0, sizeof(tag));
+ if (parse_vdiname(&s, filename, vdi, &snapid, tag) < 0) {
+ error_report("invalid filename\n");
+ return -EINVAL;
+ }
+
while (options && options->name) {
if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
vdi_size = options->value.n;
@@ -1338,11 +1349,11 @@ static int sd_create(const char *filename,
QEMUOptionParameter *options)
return -EINVAL;
}
- vid = s->inode.vdi_id;
+ base_vid = s->inode.vdi_id;
bdrv_delete(bs);
}
- return do_sd_create((char *)filename, vdi_size, vid, NULL, 0, NULL, NULL);
+ return do_sd_create((char *)vdi, vdi_size, base_vid, &vid, 0, s.addr,
s.port);
}
static void sd_close(BlockDriverState *bs)
--
1.7.2.3
- [Qemu-devel] [PULL 00/28] Block patches, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 01/28] strtosz(): use unsigned char and switch to qemu_isspace(), Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 04/28] strtosz(): Use suffix macros in switch() statement, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 02/28] strtosz() use qemu_toupper() to simplify switch statement, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 07/28] virtio-blk: tell the guest about size changes, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 03/28] strtosz(): Fix name confusion in use of modf(), Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 12/28] sheepdog: support creating images on remote hosts,
Kevin Wolf <=
- [Qemu-devel] [PATCH 05/28] block: add block_resize monitor command, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 08/28] virtio-pci: Disable virtio-ioeventfd when !CONFIG_IOTHREAD, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 10/28] ahci: Fix cpu_physical_memory_unmap() argument ordering, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 18/28] qcow2-refcount: remove write-only variables, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 15/28] qed: Images with backing file do not require QED_F_NEED_CHECK, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 11/28] Reorganize struct Qcow2Cache for better struct packing, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 14/28] qcow2: Add bdrv_discard support, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 17/28] scsi hotplug: Set DriveInfo member bus correctly, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 16/28] raw-win32: Fix bdrv_flush return value, Kevin Wolf, 2011/01/31
- [Qemu-devel] [PATCH 24/28] blockdev: Factor drive_index_to_{bus, unit}_id out of drive_init(), Kevin Wolf, 2011/01/31