From: Alexandre DERUMIER <aderumier@odiso.com>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: kwolf@redhat.com, pbonzini@redhat.com,
ronnie sahlberg <ronniesahlberg@gmail.com>
Subject: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi)
Date: Thu, 25 Oct 2012 09:25:35 +0200 (CEST) [thread overview]
Message-ID: <93cf825d-ecca-4367-8b74-4a69c53b5801@mailpro> (raw)
In-Reply-To: <37f26e36-0239-4598-bfc3-477e7dcf3787@mailpro>
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
next parent reply other threads:[~2012-10-25 7:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <37f26e36-0239-4598-bfc3-477e7dcf3787@mailpro>
2012-10-25 7:25 ` Alexandre DERUMIER [this message]
2012-10-25 7:42 ` [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi) Paolo Bonzini
2012-10-25 7:46 ` Kevin Wolf
2012-10-25 7:52 ` Paolo Bonzini
2012-10-25 8:02 ` Kevin Wolf
2012-10-25 13:41 ` ronnie sahlberg
2012-10-25 13:54 ` Kevin Wolf
2012-10-25 13:58 ` Paolo Bonzini
2012-10-25 14:00 ` ronnie sahlberg
2012-10-26 5:37 ` Alexandre DERUMIER
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=93cf825d-ecca-4367-8b74-4a69c53b5801@mailpro \
--to=aderumier@odiso.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=ronniesahlberg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).