487
495
/* disk I/O throttling */
488
496
io_limits.bps[BLOCK_IO_LIMIT_TOTAL] =
489
qemu_opt_get_number(opts, "bps", 0);
497
qemu_opt_get_number(opts, "throttling.bps-total", 0);
490
498
io_limits.bps[BLOCK_IO_LIMIT_READ] =
491
qemu_opt_get_number(opts, "bps_rd", 0);
499
qemu_opt_get_number(opts, "throttling.bps-read", 0);
492
500
io_limits.bps[BLOCK_IO_LIMIT_WRITE] =
493
qemu_opt_get_number(opts, "bps_wr", 0);
501
qemu_opt_get_number(opts, "throttling.bps-write", 0);
494
502
io_limits.iops[BLOCK_IO_LIMIT_TOTAL] =
495
qemu_opt_get_number(opts, "iops", 0);
503
qemu_opt_get_number(opts, "throttling.iops-total", 0);
496
504
io_limits.iops[BLOCK_IO_LIMIT_READ] =
497
qemu_opt_get_number(opts, "iops_rd", 0);
505
qemu_opt_get_number(opts, "throttling.iops-read", 0);
498
506
io_limits.iops[BLOCK_IO_LIMIT_WRITE] =
499
qemu_opt_get_number(opts, "iops_wr", 0);
507
qemu_opt_get_number(opts, "throttling.iops-write", 0);
501
509
if (!do_check_io_limits(&io_limits, &error)) {
502
510
error_report("%s", error_get_pretty(error));
739
static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to)
743
value = qemu_opt_get(opts, from);
745
qemu_opt_set(opts, to, value);
746
qemu_opt_unset(opts, from);
750
DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
755
* Check that only old options are used by copying into a QemuOpts with
756
* stricter checks. Going through a QDict seems to be the easiest way to
759
QemuOpts* check_opts;
761
Error *local_err = NULL;
763
qdict = qemu_opts_to_qdict(all_opts, NULL);
764
check_opts = qemu_opts_from_qdict(&qemu_old_drive_opts, qdict, &local_err);
767
if (error_is_set(&local_err)) {
768
qerror_report_err(local_err);
769
error_free(local_err);
772
qemu_opts_del(check_opts);
774
/* Change legacy command line options into QMP ones */
775
qemu_opt_rename(all_opts, "iops", "throttling.iops-total");
776
qemu_opt_rename(all_opts, "iops_rd", "throttling.iops-read");
777
qemu_opt_rename(all_opts, "iops_wr", "throttling.iops-write");
779
qemu_opt_rename(all_opts, "bps", "throttling.bps-total");
780
qemu_opt_rename(all_opts, "bps_rd", "throttling.bps-read");
781
qemu_opt_rename(all_opts, "bps_wr", "throttling.bps-write");
783
qemu_opt_rename(all_opts, "readonly", "read-only");
785
value = qemu_opt_get(all_opts, "cache");
789
if (bdrv_parse_cache_flags(value, &flags) != 0) {
790
error_report("invalid cache option");
794
/* Specific options take precedence */
795
if (!qemu_opt_get(all_opts, "cache.writeback")) {
796
qemu_opt_set_bool(all_opts, "cache.writeback",
797
!!(flags & BDRV_O_CACHE_WB));
799
if (!qemu_opt_get(all_opts, "cache.direct")) {
800
qemu_opt_set_bool(all_opts, "cache.direct",
801
!!(flags & BDRV_O_NOCACHE));
803
if (!qemu_opt_get(all_opts, "cache.no-flush")) {
804
qemu_opt_set_bool(all_opts, "cache.no-flush",
805
!!(flags & BDRV_O_NO_FLUSH));
807
qemu_opt_unset(all_opts, "cache");
810
return blockdev_init(all_opts, block_default_type);
729
813
void do_commit(Monitor *mon, const QDict *qdict)
731
815
const char *device = qdict_get_str(qdict, "device");
773
857
.has_mode = has_mode,
776
blockdev_do_action(BLOCKDEV_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC, &snapshot,
860
blockdev_do_action(TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC,
781
865
/* New and old BlockDriverState structs for group snapshots */
782
typedef struct BlkTransactionStates {
867
typedef struct BlkTransactionState BlkTransactionState;
869
/* Only prepare() may fail. In a single transaction, only one of commit() or
870
abort() will be called, clean() will always be called if it present. */
871
typedef struct BdrvActionOps {
872
/* Size of state struct, in bytes. */
873
size_t instance_size;
874
/* Prepare the work, must NOT be NULL. */
875
void (*prepare)(BlkTransactionState *common, Error **errp);
876
/* Commit the changes, can be NULL. */
877
void (*commit)(BlkTransactionState *common);
878
/* Abort the changes on fail, can be NULL. */
879
void (*abort)(BlkTransactionState *common);
880
/* Clean up resource in the end, can be NULL. */
881
void (*clean)(BlkTransactionState *common);
885
* This structure must be arranged as first member in child type, assuming
886
* that compiler will also arrange it to the same address with parent instance.
887
* Later it will be used in free().
889
struct BlkTransactionState {
890
TransactionAction *action;
891
const BdrvActionOps *ops;
892
QSIMPLEQ_ENTRY(BlkTransactionState) entry;
895
/* external snapshot private data */
896
typedef struct ExternalSnapshotState {
897
BlkTransactionState common;
783
898
BlockDriverState *old_bs;
784
899
BlockDriverState *new_bs;
785
QSIMPLEQ_ENTRY(BlkTransactionStates) entry;
786
} BlkTransactionStates;
900
} ExternalSnapshotState;
902
static void external_snapshot_prepare(BlkTransactionState *common,
907
Error *local_err = NULL;
909
const char *new_image_file;
910
const char *format = "qcow2";
911
enum NewImageMode mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
912
ExternalSnapshotState *state =
913
DO_UPCAST(ExternalSnapshotState, common, common);
914
TransactionAction *action = common->action;
917
g_assert(action->kind == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC);
919
device = action->blockdev_snapshot_sync->device;
920
new_image_file = action->blockdev_snapshot_sync->snapshot_file;
921
if (action->blockdev_snapshot_sync->has_format) {
922
format = action->blockdev_snapshot_sync->format;
924
if (action->blockdev_snapshot_sync->has_mode) {
925
mode = action->blockdev_snapshot_sync->mode;
928
/* start processing */
929
drv = bdrv_find_format(format);
931
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
935
state->old_bs = bdrv_find(device);
936
if (!state->old_bs) {
937
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
941
if (!bdrv_is_inserted(state->old_bs)) {
942
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
946
if (bdrv_in_use(state->old_bs)) {
947
error_set(errp, QERR_DEVICE_IN_USE, device);
951
if (!bdrv_is_read_only(state->old_bs)) {
952
if (bdrv_flush(state->old_bs)) {
953
error_set(errp, QERR_IO_ERROR);
958
flags = state->old_bs->open_flags;
960
/* create new image w/backing file */
961
if (mode != NEW_IMAGE_MODE_EXISTING) {
962
bdrv_img_create(new_image_file, format,
963
state->old_bs->filename,
964
state->old_bs->drv->format_name,
965
NULL, -1, flags, &local_err, false);
966
if (error_is_set(&local_err)) {
967
error_propagate(errp, local_err);
972
/* We will manually add the backing_hd field to the bs later */
973
state->new_bs = bdrv_new("");
974
/* TODO Inherit bs->options or only take explicit options with an
975
* extended QMP command? */
976
ret = bdrv_open(state->new_bs, new_image_file, NULL,
977
flags | BDRV_O_NO_BACKING, drv);
979
error_setg_file_open(errp, -ret, new_image_file);
983
static void external_snapshot_commit(BlkTransactionState *common)
985
ExternalSnapshotState *state =
986
DO_UPCAST(ExternalSnapshotState, common, common);
988
/* This removes our old bs and adds the new bs */
989
bdrv_append(state->new_bs, state->old_bs);
990
/* We don't need (or want) to use the transactional
991
* bdrv_reopen_multiple() across all the entries at once, because we
992
* don't want to abort all of them if one of them fails the reopen */
993
bdrv_reopen(state->new_bs, state->new_bs->open_flags & ~BDRV_O_RDWR,
997
static void external_snapshot_abort(BlkTransactionState *common)
999
ExternalSnapshotState *state =
1000
DO_UPCAST(ExternalSnapshotState, common, common);
1001
if (state->new_bs) {
1002
bdrv_delete(state->new_bs);
1006
typedef struct DriveBackupState {
1007
BlkTransactionState common;
1008
BlockDriverState *bs;
1012
static void drive_backup_prepare(BlkTransactionState *common, Error **errp)
1014
DriveBackupState *state = DO_UPCAST(DriveBackupState, common, common);
1015
DriveBackup *backup;
1016
Error *local_err = NULL;
1018
assert(common->action->kind == TRANSACTION_ACTION_KIND_DRIVE_BACKUP);
1019
backup = common->action->drive_backup;
1021
qmp_drive_backup(backup->device, backup->target,
1022
backup->has_format, backup->format,
1024
backup->has_mode, backup->mode,
1025
backup->has_speed, backup->speed,
1026
backup->has_on_source_error, backup->on_source_error,
1027
backup->has_on_target_error, backup->on_target_error,
1029
if (error_is_set(&local_err)) {
1030
error_propagate(errp, local_err);
1036
state->bs = bdrv_find(backup->device);
1037
state->job = state->bs->job;
1040
static void drive_backup_abort(BlkTransactionState *common)
1042
DriveBackupState *state = DO_UPCAST(DriveBackupState, common, common);
1043
BlockDriverState *bs = state->bs;
1045
/* Only cancel if it's the job we started */
1046
if (bs && bs->job && bs->job == state->job) {
1047
block_job_cancel_sync(bs->job);
1051
static void abort_prepare(BlkTransactionState *common, Error **errp)
1053
error_setg(errp, "Transaction aborted using Abort action");
1056
static void abort_commit(BlkTransactionState *common)
1058
g_assert_not_reached(); /* this action never succeeds */
1061
static const BdrvActionOps actions[] = {
1062
[TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC] = {
1063
.instance_size = sizeof(ExternalSnapshotState),
1064
.prepare = external_snapshot_prepare,
1065
.commit = external_snapshot_commit,
1066
.abort = external_snapshot_abort,
1068
[TRANSACTION_ACTION_KIND_DRIVE_BACKUP] = {
1069
.instance_size = sizeof(DriveBackupState),
1070
.prepare = drive_backup_prepare,
1071
.abort = drive_backup_abort,
1073
[TRANSACTION_ACTION_KIND_ABORT] = {
1074
.instance_size = sizeof(BlkTransactionState),
1075
.prepare = abort_prepare,
1076
.commit = abort_commit,
789
1081
* 'Atomic' group snapshots. The snapshots are taken as a set, and if any fail
790
1082
* then we do not pivot any of the devices in the group, and abandon the
793
void qmp_transaction(BlockdevActionList *dev_list, Error **errp)
1085
void qmp_transaction(TransactionActionList *dev_list, Error **errp)
796
BlockdevActionList *dev_entry = dev_list;
797
BlkTransactionStates *states, *next;
1087
TransactionActionList *dev_entry = dev_list;
1088
BlkTransactionState *state, *next;
798
1089
Error *local_err = NULL;
800
QSIMPLEQ_HEAD(snap_bdrv_states, BlkTransactionStates) snap_bdrv_states;
1091
QSIMPLEQ_HEAD(snap_bdrv_states, BlkTransactionState) snap_bdrv_states;
801
1092
QSIMPLEQ_INIT(&snap_bdrv_states);
803
1094
/* drain all i/o before any snapshots */
806
1097
/* We don't do anything in this loop that commits us to the snapshot */
807
1098
while (NULL != dev_entry) {
808
BlockdevAction *dev_info = NULL;
809
BlockDriver *proto_drv;
812
enum NewImageMode mode;
813
const char *new_image_file;
815
const char *format = "qcow2";
1099
TransactionAction *dev_info = NULL;
1100
const BdrvActionOps *ops;
817
1102
dev_info = dev_entry->value;
818
1103
dev_entry = dev_entry->next;
820
states = g_malloc0(sizeof(BlkTransactionStates));
821
QSIMPLEQ_INSERT_TAIL(&snap_bdrv_states, states, entry);
823
switch (dev_info->kind) {
824
case BLOCKDEV_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC:
825
device = dev_info->blockdev_snapshot_sync->device;
826
if (!dev_info->blockdev_snapshot_sync->has_mode) {
827
dev_info->blockdev_snapshot_sync->mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
829
new_image_file = dev_info->blockdev_snapshot_sync->snapshot_file;
830
if (dev_info->blockdev_snapshot_sync->has_format) {
831
format = dev_info->blockdev_snapshot_sync->format;
833
mode = dev_info->blockdev_snapshot_sync->mode;
839
drv = bdrv_find_format(format);
841
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
842
goto delete_and_fail;
845
states->old_bs = bdrv_find(device);
846
if (!states->old_bs) {
847
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
848
goto delete_and_fail;
851
if (!bdrv_is_inserted(states->old_bs)) {
852
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
853
goto delete_and_fail;
856
if (bdrv_in_use(states->old_bs)) {
857
error_set(errp, QERR_DEVICE_IN_USE, device);
858
goto delete_and_fail;
861
if (!bdrv_is_read_only(states->old_bs)) {
862
if (bdrv_flush(states->old_bs)) {
863
error_set(errp, QERR_IO_ERROR);
864
goto delete_and_fail;
868
flags = states->old_bs->open_flags;
870
proto_drv = bdrv_find_protocol(new_image_file);
872
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
873
goto delete_and_fail;
876
/* create new image w/backing file */
877
if (mode != NEW_IMAGE_MODE_EXISTING) {
878
bdrv_img_create(new_image_file, format,
879
states->old_bs->filename,
880
states->old_bs->drv->format_name,
881
NULL, -1, flags, &local_err, false);
882
if (error_is_set(&local_err)) {
883
error_propagate(errp, local_err);
884
goto delete_and_fail;
888
/* We will manually add the backing_hd field to the bs later */
889
states->new_bs = bdrv_new("");
890
/* TODO Inherit bs->options or only take explicit options with an
891
* extended QMP command? */
892
ret = bdrv_open(states->new_bs, new_image_file, NULL,
893
flags | BDRV_O_NO_BACKING, drv);
895
error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file);
1105
assert(dev_info->kind < ARRAY_SIZE(actions));
1107
ops = &actions[dev_info->kind];
1108
state = g_malloc0(ops->instance_size);
1110
state->action = dev_info;
1111
QSIMPLEQ_INSERT_TAIL(&snap_bdrv_states, state, entry);
1113
state->ops->prepare(state, &local_err);
1114
if (error_is_set(&local_err)) {
1115
error_propagate(errp, local_err);
896
1116
goto delete_and_fail;
901
/* Now we are going to do the actual pivot. Everything up to this point
902
* is reversible, but we are committed at this point */
903
QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) {
904
/* This removes our old bs from the bdrv_states, and adds the new bs */
905
bdrv_append(states->new_bs, states->old_bs);
906
/* We don't need (or want) to use the transactional
907
* bdrv_reopen_multiple() across all the entries at once, because we
908
* don't want to abort all of them if one of them fails the reopen */
909
bdrv_reopen(states->new_bs, states->new_bs->open_flags & ~BDRV_O_RDWR,
1120
QSIMPLEQ_FOREACH(state, &snap_bdrv_states, entry) {
1121
if (state->ops->commit) {
1122
state->ops->commit(state);
1281
1504
drive_get_ref(drive_get_by_blockdev(bs));
1507
void qmp_drive_backup(const char *device, const char *target,
1508
bool has_format, const char *format,
1509
enum MirrorSyncMode sync,
1510
bool has_mode, enum NewImageMode mode,
1511
bool has_speed, int64_t speed,
1512
bool has_on_source_error, BlockdevOnError on_source_error,
1513
bool has_on_target_error, BlockdevOnError on_target_error,
1516
BlockDriverState *bs;
1517
BlockDriverState *target_bs;
1518
BlockDriverState *source = NULL;
1519
BlockDriver *drv = NULL;
1520
Error *local_err = NULL;
1528
if (!has_on_source_error) {
1529
on_source_error = BLOCKDEV_ON_ERROR_REPORT;
1531
if (!has_on_target_error) {
1532
on_target_error = BLOCKDEV_ON_ERROR_REPORT;
1535
mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
1538
bs = bdrv_find(device);
1540
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
1544
if (!bdrv_is_inserted(bs)) {
1545
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
1550
format = mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs->drv->format_name;
1553
drv = bdrv_find_format(format);
1555
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
1560
if (bdrv_in_use(bs)) {
1561
error_set(errp, QERR_DEVICE_IN_USE, device);
1565
flags = bs->open_flags | BDRV_O_RDWR;
1567
/* See if we have a backing HD we can use to create our new image
1569
if (sync == MIRROR_SYNC_MODE_TOP) {
1570
source = bs->backing_hd;
1572
sync = MIRROR_SYNC_MODE_FULL;
1575
if (sync == MIRROR_SYNC_MODE_NONE) {
1579
size = bdrv_getlength(bs);
1581
error_setg_errno(errp, -size, "bdrv_getlength failed");
1585
if (mode != NEW_IMAGE_MODE_EXISTING) {
1586
assert(format && drv);
1588
bdrv_img_create(target, format, source->filename,
1589
source->drv->format_name, NULL,
1590
size, flags, &local_err, false);
1592
bdrv_img_create(target, format, NULL, NULL, NULL,
1593
size, flags, &local_err, false);
1597
if (error_is_set(&local_err)) {
1598
error_propagate(errp, local_err);
1602
target_bs = bdrv_new("");
1603
ret = bdrv_open(target_bs, target, NULL, flags, drv);
1605
bdrv_delete(target_bs);
1606
error_setg_file_open(errp, -ret, target);
1610
backup_start(bs, target_bs, speed, sync, on_source_error, on_target_error,
1611
block_job_cb, bs, &local_err);
1612
if (local_err != NULL) {
1613
bdrv_delete(target_bs);
1614
error_propagate(errp, local_err);
1618
/* Grab a reference so hotplug does not delete the BlockDriverState from
1621
drive_get_ref(drive_get_by_blockdev(bs));
1284
1624
#define DEFAULT_MIRROR_BUF_SIZE (10 << 20)
1286
1626
void qmp_drive_mirror(const char *device, const char *target,
1585
1921
.type = QEMU_OPT_STRING,
1586
1922
.help = "discard operation (ignore/off, unmap/on)",
1924
.name = "cache.writeback",
1925
.type = QEMU_OPT_BOOL,
1926
.help = "enables writeback mode for any caches",
1928
.name = "cache.direct",
1929
.type = QEMU_OPT_BOOL,
1930
.help = "enables use of O_DIRECT (bypass the host page cache)",
1932
.name = "cache.no-flush",
1933
.type = QEMU_OPT_BOOL,
1934
.help = "ignore any flush requests for the device",
1937
.type = QEMU_OPT_STRING,
1938
.help = "host AIO implementation (threads, native)",
1941
.type = QEMU_OPT_STRING,
1942
.help = "disk format (raw, qcow2, ...)",
1945
.type = QEMU_OPT_STRING,
1946
.help = "disk serial number",
1949
.type = QEMU_OPT_STRING,
1950
.help = "read error action",
1953
.type = QEMU_OPT_STRING,
1954
.help = "write error action",
1957
.type = QEMU_OPT_STRING,
1958
.help = "pci address (virtio only)",
1960
.name = "read-only",
1961
.type = QEMU_OPT_BOOL,
1962
.help = "open drive file as read-only",
1964
.name = "throttling.iops-total",
1965
.type = QEMU_OPT_NUMBER,
1966
.help = "limit total I/O operations per second",
1968
.name = "throttling.iops-read",
1969
.type = QEMU_OPT_NUMBER,
1970
.help = "limit read operations per second",
1972
.name = "throttling.iops-write",
1973
.type = QEMU_OPT_NUMBER,
1974
.help = "limit write operations per second",
1976
.name = "throttling.bps-total",
1977
.type = QEMU_OPT_NUMBER,
1978
.help = "limit total bytes per second",
1980
.name = "throttling.bps-read",
1981
.type = QEMU_OPT_NUMBER,
1982
.help = "limit read bytes per second",
1984
.name = "throttling.bps-write",
1985
.type = QEMU_OPT_NUMBER,
1986
.help = "limit write bytes per second",
1988
.name = "copy-on-read",
1989
.type = QEMU_OPT_BOOL,
1990
.help = "copy read data from backing file into image file",
1993
.type = QEMU_OPT_BOOL,
1994
.help = "(deprecated, ignored)",
1996
{ /* end of list */ }
2000
QemuOptsList qemu_old_drive_opts = {
2002
.head = QTAILQ_HEAD_INITIALIZER(qemu_old_drive_opts.head),
2006
.type = QEMU_OPT_NUMBER,
2007
.help = "bus number",
2010
.type = QEMU_OPT_NUMBER,
2011
.help = "unit number (i.e. lun for scsi)",
2014
.type = QEMU_OPT_STRING,
2015
.help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)",
2018
.type = QEMU_OPT_NUMBER,
2019
.help = "index number",
2022
.type = QEMU_OPT_NUMBER,
2023
.help = "number of cylinders (ide disk geometry)",
2026
.type = QEMU_OPT_NUMBER,
2027
.help = "number of heads (ide disk geometry)",
2030
.type = QEMU_OPT_NUMBER,
2031
.help = "number of sectors (ide disk geometry)",
2034
.type = QEMU_OPT_STRING,
2035
.help = "chs translation (auto, lba. none)",
2038
.type = QEMU_OPT_STRING,
2039
.help = "media type (disk, cdrom)",
2042
.type = QEMU_OPT_BOOL,
2043
.help = "enable/disable snapshot mode",
2046
.type = QEMU_OPT_STRING,
2047
.help = "disk image",
2050
.type = QEMU_OPT_STRING,
2051
.help = "discard operation (ignore/off, unmap/on)",
1588
2053
.name = "cache",
1589
2054
.type = QEMU_OPT_STRING,
1590
2055
.help = "host cache usage (none, writeback, writethrough, "
1658
2123
.name = "drive",
1659
2124
.head = QTAILQ_HEAD_INITIALIZER(qemu_drive_opts.head),
1663
.type = QEMU_OPT_NUMBER,
1664
.help = "bus number",
1667
.type = QEMU_OPT_NUMBER,
1668
.help = "unit number (i.e. lun for scsi)",
1671
.type = QEMU_OPT_STRING,
1672
.help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)",
1675
.type = QEMU_OPT_NUMBER,
1676
.help = "index number",
1679
.type = QEMU_OPT_NUMBER,
1680
.help = "number of cylinders (ide disk geometry)",
1683
.type = QEMU_OPT_NUMBER,
1684
.help = "number of heads (ide disk geometry)",
1687
.type = QEMU_OPT_NUMBER,
1688
.help = "number of sectors (ide disk geometry)",
1691
.type = QEMU_OPT_STRING,
1692
.help = "chs translation (auto, lba. none)",
1695
.type = QEMU_OPT_STRING,
1696
.help = "media type (disk, cdrom)",
1699
.type = QEMU_OPT_BOOL,
1700
.help = "enable/disable snapshot mode",
1703
.type = QEMU_OPT_STRING,
1704
.help = "disk image",
1707
.type = QEMU_OPT_STRING,
1708
.help = "discard operation (ignore/off, unmap/on)",
1711
.type = QEMU_OPT_STRING,
1712
.help = "host cache usage (none, writeback, writethrough, "
1713
"directsync, unsafe)",
1716
.type = QEMU_OPT_STRING,
1717
.help = "host AIO implementation (threads, native)",
1720
.type = QEMU_OPT_STRING,
1721
.help = "disk format (raw, qcow2, ...)",
1724
.type = QEMU_OPT_STRING,
1725
.help = "disk serial number",
1728
.type = QEMU_OPT_STRING,
1729
.help = "read error action",
1732
.type = QEMU_OPT_STRING,
1733
.help = "write error action",
1736
.type = QEMU_OPT_STRING,
1737
.help = "pci address (virtio only)",
1740
.type = QEMU_OPT_BOOL,
1741
.help = "open drive file as read-only",
1744
.type = QEMU_OPT_NUMBER,
1745
.help = "limit total I/O operations per second",
1748
.type = QEMU_OPT_NUMBER,
1749
.help = "limit read operations per second",
1752
.type = QEMU_OPT_NUMBER,
1753
.help = "limit write operations per second",
1756
.type = QEMU_OPT_NUMBER,
1757
.help = "limit total bytes per second",
1760
.type = QEMU_OPT_NUMBER,
1761
.help = "limit read bytes per second",
1764
.type = QEMU_OPT_NUMBER,
1765
.help = "limit write bytes per second",
1767
.name = "copy-on-read",
1768
.type = QEMU_OPT_BOOL,
1769
.help = "copy read data from backing file into image file",
1772
.type = QEMU_OPT_BOOL,
1773
.help = "(deprecated, ignored)",
2127
* no elements => accept any params
2128
* validation will happen later
1775
2130
{ /* end of list */ }