[pve-devel] [PATCH] iscsi : qemu-img convert workaround
Dietmar Maurer
dietmar at proxmox.com
Wed Oct 24 11:09:38 CEST 2012
> host_device block driver have same implementation (qemu-img convert
> /dev/....)
>
> So, I don't think it's wrong to do it in same way for iscsi block driver.....
> 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;
> }
But that look somehow different to your code? Why do you think that is the
same behavior?
++static int iscsi_create(const char *filename, QEMUOptionParameter *options)
++{
++
++ return 1;
++}
Besides, and option to 'qemu-img convert' to do not create files would be useful anyways?
- Dietmar
More information about the pve-devel
mailing list