summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block.c3
-rw-r--r--block/vmdk.c10
-rw-r--r--include/block/block_int.h2
-rw-r--r--qemu-img.c7
4 files changed, 21 insertions, 1 deletions
diff --git a/block.c b/block.c
index a612594db..74af00718 100644
--- a/block.c
+++ b/block.c
@@ -5630,6 +5630,9 @@ void bdrv_img_create(const char *filename, const char *fmt,
if (!quiet) {
printf("Formatting '%s', fmt=%s ", filename, fmt);
qemu_opts_print(opts);
+ if (qemu_opt_get_bool(opts, BLOCK_OPT_SCSI, false)) {
+ printf(", SCSI");
+ }
puts("");
}
diff --git a/block/vmdk.c b/block/vmdk.c
index 2cbfd3e72..caefe1910 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1818,9 +1818,12 @@ static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp)
if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ZEROED_GRAIN, false)) {
zeroed_grain = true;
}
+ if (qemu_opt_get_bool_del(opts, BLOCK_OPT_SCSI, false)) {
+ flags |= BLOCK_FLAG_SCSI;
+ }
if (!adapter_type) {
- adapter_type = g_strdup("ide");
+ adapter_type = g_strdup(flags & BLOCK_FLAG_SCSI ? "lsilogic" : "ide");
} else if (strcmp(adapter_type, "ide") &&
strcmp(adapter_type, "buslogic") &&
strcmp(adapter_type, "lsilogic") &&
@@ -2223,6 +2226,11 @@ static QemuOptsList vmdk_create_opts = {
.help = "Enable efficient zero writes "
"using the zeroed-grain GTE feature"
},
+ {
+ .name = BLOCK_OPT_SCSI,
+ .type = QEMU_OPT_BOOL,
+ .help = "SCSI image"
+ },
{ /* end of list */ }
}
};
diff --git a/include/block/block_int.h b/include/block/block_int.h
index a1c17b957..9d03953dd 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -41,10 +41,12 @@
#define BLOCK_FLAG_ENCRYPT 1
#define BLOCK_FLAG_COMPAT6 4
#define BLOCK_FLAG_LAZY_REFCOUNTS 8
+#define BLOCK_FLAG_SCSI 16
#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"
diff --git a/qemu-img.c b/qemu-img.c
index a42335c63..21c3bae5e 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1583,6 +1583,13 @@ static int img_convert(int argc, char **argv)
}
}
+ if (qemu_opt_get_bool(opts, BLOCK_OPT_SCSI, false)
+ && strcmp(drv->format_name, "vmdk")) {
+ error_report("SCSI devices not supported for this file format");
+ ret = -1;
+ goto out;
+ }
+
if (!skip_create) {
/* Create the new image */
ret = bdrv_create(drv, out_filename, opts, &local_err);