[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] qemu-img convert with block driver without .bdrv_create (li
From: |
Alexandre DERUMIER |
Subject: |
[Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi) |
Date: |
Thu, 25 Oct 2012 09:25:35 +0200 (CEST) |
Hello,
I'm looking to use qemu-img convert to write to iscsi block device (iscsi://..)
As iscsi doesn't have .bdrv_create, qemu-img convert hang on
/* Create the new image */
ret = bdrv_create(drv, out_filename, param);
if (ret < 0) {
if (ret == -ENOTSUP) {
error_report("Formatting not supported for file format '%s'",
out_fmt);
} else if (ret == -EFBIG) {
error_report("The image size is too large for file format '%s'",
out_fmt);
} else {
error_report("%s: error while converting %s: %s",
out_filename, out_fmt, strerror(-ret));
}
goto out;
}
What is the best way to get it working ?
1)add a .bdrv_create in block/iscsi.c ?
(like host_device block driver, only open/close the device and check if size if
big enough)
block/raw-posix.c
.bdrv_create = hdev_create,
static int hdev_create(const char *filename, QEMUOptionParameter *options)
{
int fd;
int ret = 0;
struct stat stat_buf;
int64_t total_size = 0;
/* Read out options */
while (options && options->name) {
if (!strcmp(options->name, "size")) {
total_size = options->value.n / BDRV_SECTOR_SIZE;
}
options++;
}
fd = qemu_open(filename, O_WRONLY | O_BINARY);
if (fd < 0)
return -errno;
if (fstat(fd, &stat_buf) < 0)
ret = -errno;
else if (!S_ISBLK(stat_buf.st_mode) && !S_ISCHR(stat_buf.st_mode))
ret = -ENODEV;
else if (lseek(fd, 0, SEEK_END) < total_size * BDRV_SECTOR_SIZE)
ret = -ENOSPC;
qemu_close(fd);
return ret;
}
2)or add a fallback in qemu-img, if bdrv_create doesn't exist, use bdrv_open to
see if the backend device is pre-existing ?
Regards,
Alexandre Derumier
- [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi),
Alexandre DERUMIER <=
- Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi), Paolo Bonzini, 2012/10/25
- Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi), Kevin Wolf, 2012/10/25
- Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi), Paolo Bonzini, 2012/10/25
- Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi), Kevin Wolf, 2012/10/25
- Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi), ronnie sahlberg, 2012/10/25
- Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi), Kevin Wolf, 2012/10/25
- Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi), Paolo Bonzini, 2012/10/25
- Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi), ronnie sahlberg, 2012/10/25
- Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi), Alexandre DERUMIER, 2012/10/26