Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.4
kvm.573
qemu-img-vmdk-scsi.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File qemu-img-vmdk-scsi.patch of Package kvm.573
From 09686f619707ec98e073bf671b0334a2f65934ad Mon Sep 17 00:00:00 2001 From: Ulrich Hecht <uli@suse.de> Date: Tue, 14 Apr 2009 16:37:42 +0200 Subject: [PATCH 11/17] qemu-img-vmdk-scsi Support creation of SCSI VMDK images in qemu-img. Signed-off-by: Ulrich Hecht <uli@suse.de> --- block.c | 5 ++++- block/vmdk.c | 7 +++++-- block_int.h | 2 ++ qemu-img.c | 8 +++++++- 4 files changed, 18 insertions(+), 4 deletions(-) Index: qemu-kvm-0.14.0/block.c =================================================================== --- qemu-kvm-0.14.0.orig/block.c +++ qemu-kvm-0.14.0/block.c @@ -2800,7 +2800,7 @@ int bdrv_img_create(const char *filename char *options, uint64_t img_size, int flags) { QEMUOptionParameter *param = NULL, *create_options = NULL; - QEMUOptionParameter *backing_fmt, *backing_file; + QEMUOptionParameter *backing_fmt, *backing_file, *scsi; BlockDriverState *bs = NULL; BlockDriver *drv, *proto_drv; BlockDriver *backing_drv = NULL; @@ -2909,6 +2909,9 @@ int bdrv_img_create(const char *filename printf("Formatting '%s', fmt=%s ", filename, fmt); print_option_parameters(param); + scsi = get_option_parameter(param, BLOCK_OPT_SCSI); + if (scsi && scsi->value.n) + printf(", SCSI"); puts(""); ret = bdrv_create(drv, filename, param); Index: qemu-kvm-0.14.0/block/vmdk.c =================================================================== --- qemu-kvm-0.14.0.orig/block/vmdk.c +++ qemu-kvm-0.14.0/block/vmdk.c @@ -685,7 +685,7 @@ static int vmdk_create(const char *filen "ddb.geometry.cylinders = \"%" PRId64 "\"\n" "ddb.geometry.heads = \"16\"\n" "ddb.geometry.sectors = \"63\"\n" - "ddb.adapterType = \"ide\"\n"; + "ddb.adapterType = \"%s\"\n"; char desc[1024]; const char *real_filename, *temp_str; int64_t total_size = 0; @@ -701,6 +701,8 @@ static int vmdk_create(const char *filen backing_file = options->value.s; } else if (!strcmp(options->name, BLOCK_OPT_COMPAT6)) { flags |= options->value.n ? BLOCK_FLAG_COMPAT6: 0; + } else if (!strcmp(options->name, BLOCK_OPT_SCSI)) { + flags |= options->value.n ? BLOCK_FLAG_SCSI: 0; } options++; } @@ -798,7 +800,8 @@ static int vmdk_create(const char *filen snprintf(desc, sizeof(desc), desc_template, (unsigned int)time(NULL), total_size, real_filename, (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), - total_size / (int64_t)(63 * 16)); + total_size / (int64_t)(63 * 16), + flags & BLOCK_FLAG_SCSI ? "lsilogic" : "ide"); /* write the descriptor */ lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET); @@ -844,6 +847,11 @@ static QEMUOptionParameter vmdk_create_o .type = OPT_FLAG, .help = "VMDK version 6 image" }, + { + .name = BLOCK_OPT_SCSI, + .type = OPT_FLAG, + .help = "SCSI image" + }, { NULL } }; Index: qemu-kvm-0.14.0/block_int.h =================================================================== --- qemu-kvm-0.14.0.orig/block_int.h +++ qemu-kvm-0.14.0/block_int.h @@ -30,10 +30,12 @@ #define BLOCK_FLAG_ENCRYPT 1 #define BLOCK_FLAG_COMPAT6 4 +#define BLOCK_FLAG_SCSI 8 #define BLOCK_OPT_SIZE "size" #define BLOCK_OPT_ENCRYPT "encryption" #define BLOCK_OPT_COMPAT6 "compat6" +#define BLOCK_OPT_SCSI "scsi" #define BLOCK_OPT_BACKING_FILE "backing_file" #define BLOCK_OPT_BACKING_FMT "backing_fmt" #define BLOCK_OPT_CLUSTER_SIZE "cluster_size" Index: qemu-kvm-0.14.0/qemu-img.c =================================================================== --- qemu-kvm-0.14.0.orig/qemu-img.c +++ qemu-kvm-0.14.0/qemu-img.c @@ -576,7 +576,7 @@ static int img_convert(int argc, char ** const uint8_t *buf1; BlockDriverInfo bdi; QEMUOptionParameter *param = NULL, *create_options = NULL; - QEMUOptionParameter *out_baseimg_param; + QEMUOptionParameter *out_baseimg_param, *scsi; char *options = NULL; const char *snapshot_name = NULL; @@ -731,6 +731,12 @@ static int img_convert(int argc, char ** } } + if ((scsi = get_option_parameter(param, BLOCK_OPT_SCSI)) && scsi->value.n && strcmp(drv->format_name, "vmdk")) { + error_report("SCSI devices not supported for this file format"); + ret = -1; + goto out; + } + /* Create the new image */ ret = bdrv_create(drv, out_filename, param); if (ret < 0) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor